<div dir="ltr">Ahh, I am not sure about from Python. Sounds like it isn't.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 20, 2017 at 10:14 AM, Quentan Qi <span dir="ltr"><<a href="mailto:quentan@gmail.com" target="_blank">quentan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Thanks Ken. <div><br></div><div>I am using vtk 7.1.0<div><br></div><div>But the python wrapping of `vtkOpenGLPolyDataMapper` has no attribute `AddShaderReplacement`. Is there any way to do this with python wrapping?</div><div><br></div><div>Cheers,</div><div>Quentan<br><br class="m_-7094181475431821785Apple-interchange-newline"><br><div><blockquote type="cite"><div>On 20 Feb 2017, at 13:34, Ken Martin <<a href="mailto:ken.martin@kitware.com" target="_blank">ken.martin@kitware.com</a>> wrote:</div><br class="m_-7094181475431821785Apple-interchange-newline"><div><div dir="ltr">If using the new OpenGL rendering backend end see <div><br></div><div><a href="http://www.vtk.org/Wiki/Shader_In_VTK" target="_blank">http://www.vtk.org/Wiki/<wbr>Shader_In_VTK</a><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 20, 2017 at 8:17 AM, Quentan Qi <span dir="ltr"><<a href="mailto:quentan@gmail.com" target="_blank">quentan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><p style="box-sizing:border-box;margin:0px 0px 16px;color:rgb(51,51,51);font-family:helvetica,arial,freesans,clean,sans-serif;font-size:16px;background-color:rgb(255,255,255)">Hi,</p><p style="box-sizing:border-box;margin:0px 0px 16px;color:rgb(51,51,51);font-family:helvetica,arial,freesans,clean,sans-serif;font-size:16px;background-color:rgb(255,255,255)">I want to ask how to pass uniform and attribute from host to shader by vtk’s python wrapping.</p><p style="box-sizing:border-box;margin:0px 0px 16px;color:rgb(51,51,51);font-family:helvetica,arial,freesans,clean,sans-serif;font-size:16px;background-color:rgb(255,255,255)">I follow <a style="box-sizing:border-box;background-color:transparent;color:rgb(65,131,196);text-decoration:none">this instruction</a> to implement <a style="box-sizing:border-box;background-color:transparent;color:rgb(65,131,196);text-decoration:none">this result</a>, but don’t know how to pass uniform variables from host to fragment shader. </p><p style="box-sizing:border-box;margin:0px 0px 16px;color:rgb(51,51,51);font-family:helvetica,arial,freesans,clean,sans-serif;font-size:16px;background-color:rgb(255,255,255)">Could anybody tell me how to do this?</p><p style="box-sizing:border-box;margin:0px 0px 16px;color:rgb(51,51,51);font-family:helvetica,arial,freesans,clean,sans-serif;font-size:16px;background-color:rgb(255,255,255)">Cheers,<br style="box-sizing:border-box">Quentan</p><hr style="box-sizing:content-box;height:4px;margin:16px 0px;overflow:hidden;background-color:rgb(231,231,231);border:0px none;padding:0px;color:rgb(51,51,51);font-family:helvetica,arial,freesans,clean,sans-serif;font-size:16px"><ul style="box-sizing:border-box;padding:0px 0px 0px 2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:helvetica,arial,freesans,clean,sans-serif;font-size:16px;background-color:rgb(255,255,255)"><li style="box-sizing:border-box">Shader02.py</li></ul><pre style="box-sizing:border-box;overflow:auto;margin-top:0px;margin-bottom:16px;line-height:1.45;padding:16px;background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal;height:2266px"><code class="m_-7094181475431821785m_6227054243253370675nix m_-7094181475431821785m_6227054243253370675(null) m_-7094181475431821785m_6227054243253370675hljs" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box;padding:0.5em;margin:0px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;border:0px;display:block;overflow-x:auto;line-height:inherit;word-wrap:normal;height:auto"><span class="m_-7094181475431821785m_6227054243253370675hljs-built_in" style="box-sizing:border-box;color:rgb(0,134,179)">import</span> vtk
<span class="m_-7094181475431821785m_6227054243253370675hljs-built_in" style="box-sizing:border-box;color:rgb(0,134,179)">import</span> time
<span class="m_-7094181475431821785m_6227054243253370675hljs-attr" style="box-sizing:border-box">timer</span> = [time.clock()]
<span class="m_-7094181475431821785m_6227054243253370675hljs-attr" style="box-sizing:border-box">resolution</span> = [<span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">600</span>, <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">480</span>]
<span class="m_-7094181475431821785m_6227054243253370675hljs-attr" style="box-sizing:border-box">file</span> = open('Shader02.vert', 'r')
<span class="m_-7094181475431821785m_6227054243253370675hljs-attr" style="box-sizing:border-box">vert</span> = file.read()
file.close()
<span class="m_-7094181475431821785m_6227054243253370675hljs-attr" style="box-sizing:border-box">file</span> = open('Shader02.frag', 'r')
<span class="m_-7094181475431821785m_6227054243253370675hljs-attr" style="box-sizing:border-box">frag</span> = file.read()
file.close()
<span class="m_-7094181475431821785m_6227054243253370675hljs-comment" style="box-sizing:border-box;color:rgb(153,153,136);font-style:italic"># Plane. Is there better way to show ShaderToy's effect without use vtkPlaneSource?</span>
<span class="m_-7094181475431821785m_6227054243253370675hljs-attr" style="box-sizing:border-box">plane</span> = vtk.vtkPlaneSource()
plane.SetNormal([<span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">0</span>, <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">0</span>, <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">1</span>])
plane.SetResolution(<span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">100</span>, <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">100</span>)
plane.SetOrigin(-<span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">1</span>, -<span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">1</span>, <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">0</span>)
plane.SetPoint1(<span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">1</span>, -<span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">1</span>, <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">1</span>)
plane.SetPoint2(-<span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">1</span>, <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">1</span>, <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">0</span>)
<span class="m_-7094181475431821785m_6227054243253370675hljs-attr" style="box-sizing:border-box">mapper</span> = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(plan<wbr>e.GetOutputPort())
<span class="m_-7094181475431821785m_6227054243253370675hljs-attr" style="box-sizing:border-box"><br></span></code><code class="m_-7094181475431821785m_6227054243253370675nix m_-7094181475431821785m_6227054243253370675(null) m_-7094181475431821785m_6227054243253370675hljs" style="box-sizing:border-box;padding:0.5em;margin:0px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;border:0px;display:block;overflow-x:auto;line-height:inherit;word-wrap:normal;height:auto"><span class="m_-7094181475431821785m_6227054243253370675hljs-attr" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">actor</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3"> = vtk.vtkActor()
actor.SetMapper(mapper)
actor.GetProperty().SetOpacity<wbr>(</font><span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="color:rgb(0,128,128);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">1</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">)
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-comment" style="color:rgb(153,153,136);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box;font-style:italic"># Handle the rendering and interaction</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-attr" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">ren</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3"> = vtk.vtkRenderer()
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-attr" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">renWin</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3"> = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-attr" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">iren</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3"> = vtk.vtkRenderWindowInteractor(<wbr>)
iren.SetRenderWindow(renWin)
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-attr" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">resolutionUniform</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3"> = vtk.vtkUniformVariables()
resolutionUniform.SetUniformi(<wbr>'iResolution', </font><span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="color:rgb(0,128,128);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">2</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">, resolution)
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-attr" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">timeUniform</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3"> = vtk.vtkUniformVariables()
timeUniform.SetUniformf('iGlob<wbr>alTime', </font><span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="color:rgb(0,128,128);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">1</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">, timer)
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-comment" style="color:rgb(153,153,136);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box;font-style:italic"># Now let's get down to shader-business...</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-comment" style="color:rgb(153,153,136);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box;font-style:italic"># First we make a ShaderProgram2 and set it up on a date with the RenderWindow</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-attr" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">pgm</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3"> = vtk.vtkShaderProgram2()
pgm.SetContext(renWin)
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-comment" style="color:rgb(153,153,136);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box;font-style:italic"># For both the vertex and fragment shader, we need to make a Shader2</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-comment" style="color:rgb(153,153,136);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box;font-style:italic"># Also set them up with the RenderWindow, by asking the ShaderProgram2 for</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-comment" style="color:rgb(153,153,136);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box;font-style:italic"># an introduction</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-attr" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">shaderv</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3"> = vtk.vtkShader2()
shaderv.SetType(vtk.VTK_SHADER<wbr>_TYPE_VERTEX)
shaderv.SetSourceCode(vert)
shaderv.SetContext(pgm.GetCont<wbr>ext())
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-attr" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">shaderf</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3"> = vtk.vtkShader2()
shaderf.SetType(vtk.VTK_SHADER<wbr>_TYPE_FRAGMENT)
shaderf.SetSourceCode(frag)
shaderf.SetContext(pgm.GetCont<wbr>ext())
shaderf.SetUniformVariables(re<wbr>solutionUniform) </font><span style="color:rgb(153,153,136);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;font-style:italic"># is this correct?</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-comment" style="color:rgb(153,153,136);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box;font-style:italic"># print shaderf.GetUniformVariables()</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">
shaderf.SetUniformVariables(ti<wbr>meUniform)
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-comment" style="color:rgb(153,153,136);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box;font-style:italic"># print shaderf.GetUniformVariables()</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-comment" style="color:rgb(153,153,136);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box;font-style:italic"># Now we add the shaders to the program</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">
pgm.GetShaders().AddItem(shade<wbr>rv)
pgm.GetShaders().AddItem(shade<wbr>rf)
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-comment" style="color:rgb(153,153,136);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box;font-style:italic"># And tell the actor property that it should totally use this cool program</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-attr" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">openGLproperty</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3"> = actor.GetProperty()
openGLproperty.SetPropProgram(<wbr>pgm)
openGLproperty.ShadingOn()
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-comment" style="color:rgb(153,153,136);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box;font-style:italic"># openGLproperty.AddShaderVariab<wbr>le('iGlobalTime', 1, timer) # is this correct?</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-comment" style="color:rgb(153,153,136);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box;font-style:italic"># openGLproperty.AddShaderVariab<wbr>le('iResolution', 2, resolution)</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">
</font><span class="m_-7094181475431821785m_6227054243253370675hljs-comment" style="color:rgb(153,153,136);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box;font-style:italic"># Add the actor and set a nice bg color</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">
ren.AddActor(actor)
ren.SetBackground(</font><span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="color:rgb(0,128,128);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">0.3</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">, </font><span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="color:rgb(0,128,128);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">0</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">, </font><span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="color:rgb(0,128,128);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">0.4</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">)
ren.SetBackground2(</font><span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="color:rgb(0,128,128);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">0.1</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">, </font><span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="color:rgb(0,128,128);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">0</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">, </font><span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="color:rgb(0,128,128);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">0.2</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">)
ren.SetGradientBackground(</font><span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="color:rgb(0,128,128);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">1</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">)
renWin.SetSize(resolution)
iren.Initialize()
ren.GetActiveCamera().SetPosit<wbr>ion(</font><span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="color:rgb(0,128,128);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">0</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">, -</font><span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="color:rgb(0,128,128);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">1</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">, </font><span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="color:rgb(0,128,128);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">0</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">)
ren.GetActiveCamera().SetViewU<wbr>p(</font><span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="color:rgb(0,128,128);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">0</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">, </font><span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="color:rgb(0,128,128);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">0</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">, </font><span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="color:rgb(0,128,128);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;box-sizing:border-box">1</span><font color="#333333" face="Consolas, Liberation Mono, Menlo, Courier, monospace" size="3">)
ren.ResetCamera()
renWin.Render()
iren.Start()
</font></code></pre><ul style="box-sizing:border-box;padding:0px 0px 0px 2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:helvetica,arial,freesans,clean,sans-serif;font-size:16px;background-color:rgb(255,255,255)"><li style="box-sizing:border-box">Shader02.vert</li></ul><pre style="box-sizing:border-box;overflow:auto;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:16px;line-height:1.45;padding:16px;background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal;color:rgb(51,51,51);height:106px"><code class="m_-7094181475431821785m_6227054243253370675hljs m_-7094181475431821785m_6227054243253370675(null) m_-7094181475431821785m_6227054243253370675glsl" style="box-sizing:border-box;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;padding:0.5em;margin:0px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;border:0px;display:block;overflow-x:auto;line-height:inherit;word-wrap:normal;height:auto"><span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">void</span> propFuncVS(<span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">void</span>) {
<span class="m_-7094181475431821785m_6227054243253370675hljs-built_in" style="box-sizing:border-box;color:rgb(0,134,179)">gl_Position</span> = <span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">vec4</span>((<span class="m_-7094181475431821785m_6227054243253370675hljs-built_in" style="box-sizing:border-box;color:rgb(0,134,179)">gl_Vertex</span>.xy), <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">0.0</span>, <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">1.0</span>);
}</code></pre><ul style="box-sizing:border-box;padding:0px 0px 0px 2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:helvetica,arial,freesans,clean,sans-serif;font-size:16px;background-color:rgb(255,255,255)"><li style="box-sizing:border-box">Shader02.frag</li></ul><pre style="box-sizing:border-box;overflow:auto;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;line-height:1.45;padding:16px;background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal;color:rgb(51,51,51);height:1386px;margin-bottom:0px!important"><code class="m_-7094181475431821785m_6227054243253370675hljs m_-7094181475431821785m_6227054243253370675(null) m_-7094181475431821785m_6227054243253370675glsl" style="box-sizing:border-box;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;padding:0.5em;margin:0px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;border:0px;display:block;overflow-x:auto;line-height:inherit;word-wrap:normal;height:auto"><span class="m_-7094181475431821785m_6227054243253370675hljs-comment" style="box-sizing:border-box;color:rgb(153,153,136);font-style:italic">// ShaderToy: The Blob</span>
<span class="m_-7094181475431821785m_6227054243253370675hljs-comment" style="box-sizing:border-box;color:rgb(153,153,136);font-style:italic">// <a href="https://www.shadertoy.com/view/XsXGRS" target="_blank">https://www.shadertoy.com/view<wbr>/XsXGRS</a></span>
<span class="m_-7094181475431821785m_6227054243253370675hljs-keyword" style="box-sizing:border-box;font-weight:bold">uniform</span> <span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">float</span> iGlobalTime; <span style="color:rgb(153,153,136);font-style:italic">// not work. uniform or varying?</span>
<span class="m_-7094181475431821785m_6227054243253370675hljs-keyword" style="box-sizing:border-box;font-weight:bold">uniform</span> <span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">vec2</span> iResolution;
<span class="m_-7094181475431821785m_6227054243253370675hljs-comment" style="box-sizing:border-box;color:rgb(153,153,136);font-style:italic">// float iGlobalTime = 1.0;</span>
<span class="m_-7094181475431821785m_6227054243253370675hljs-comment" style="box-sizing:border-box;color:rgb(153,153,136);font-style:italic">// vec2 iResolution = vec2(600, 480); // This works, but not from host</span>
<span class="m_-7094181475431821785m_6227054243253370675hljs-meta" style="box-sizing:border-box;color:rgb(153,153,153);font-weight:bold">#ifdef GL_ES</span>
<span class="m_-7094181475431821785m_6227054243253370675hljs-keyword" style="box-sizing:border-box;font-weight:bold">precision</span> <span class="m_-7094181475431821785m_6227054243253370675hljs-keyword" style="box-sizing:border-box;font-weight:bold">highp</span> <span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">float</span>;
<span class="m_-7094181475431821785m_6227054243253370675hljs-meta" style="box-sizing:border-box;color:rgb(153,153,153);font-weight:bold">#endif</span>
<span class="m_-7094181475431821785m_6227054243253370675hljs-meta" style="box-sizing:border-box;color:rgb(153,153,153);font-weight:bold">#define AA 4.</span>
<span class="m_-7094181475431821785m_6227054243253370675hljs-meta" style="box-sizing:border-box;color:rgb(153,153,153);font-weight:bold">#define CI vec3(.3,.5,.6)</span>
<span class="m_-7094181475431821785m_6227054243253370675hljs-meta" style="box-sizing:border-box;color:rgb(153,153,153);font-weight:bold">#define CO vec3(.2)</span>
<span class="m_-7094181475431821785m_6227054243253370675hljs-meta" style="box-sizing:border-box;color:rgb(153,153,153);font-weight:bold">#define CM vec3(.0)</span>
<span class="m_-7094181475431821785m_6227054243253370675hljs-meta" style="box-sizing:border-box;color:rgb(153,153,153);font-weight:bold">#define CE vec3(.8,.7,.5)</span>
<span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">float</span> metaball(<span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">vec2</span> p, <span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">float</span> r)
{
<span class="m_-7094181475431821785m_6227054243253370675hljs-keyword" style="box-sizing:border-box;font-weight:bold">return</span> r / <span class="m_-7094181475431821785m_6227054243253370675hljs-built_in" style="box-sizing:border-box;color:rgb(0,134,179)">dot</span>(p, p);
}
<span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">vec3</span> samplef(<span class="m_-7094181475431821785m_6227054243253370675hljs-keyword" style="box-sizing:border-box;font-weight:bold">in</span> <span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">vec2</span> uv)
{
<span class="m_-7094181475431821785m_6227054243253370675hljs-meta" style="box-sizing:border-box;color:rgb(153,153,153);font-weight:bold">#if 1</span>
<span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">float</span> t0 = <span class="m_-7094181475431821785m_6227054243253370675hljs-built_in" style="box-sizing:border-box;color:rgb(0,134,179)">sin</span>(iGlobalTime * <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">1.9</span>) * <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">.46</span>;
<span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">float</span> t1 = <span class="m_-7094181475431821785m_6227054243253370675hljs-built_in" style="box-sizing:border-box;color:rgb(0,134,179)">sin</span>(iGlobalTime * <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">2.4</span>) * <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">.49</span>;
<span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">float</span> t2 = <span class="m_-7094181475431821785m_6227054243253370675hljs-built_in" style="box-sizing:border-box;color:rgb(0,134,179)">cos</span>(iGlobalTime * <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">1.4</span>) * <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">.57</span>;
<span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">float</span> r = metaball(uv + <span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">vec2</span>(t0, t2), <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">.33</span>) *
metaball(uv - <span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">vec2</span>(t0, t1), <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">.27</span>) *
metaball(uv + <span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">vec2</span>(t1, t2), <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">.59</span>);
<span class="m_-7094181475431821785m_6227054243253370675hljs-meta" style="box-sizing:border-box;color:rgb(153,153,153);font-weight:bold">#else</span>
<span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">float</span> r = <span class="m_-7094181475431821785m_6227054243253370675hljs-built_in" style="box-sizing:border-box;color:rgb(0,134,179)">length</span>(uv); <span style="color:rgb(153,153,136);font-style:italic">// test for time-independent</span>
<span class="m_-7094181475431821785m_6227054243253370675hljs-meta" style="box-sizing:border-box;color:rgb(153,153,153);font-weight:bold">#endif</span>
<span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">vec3</span> c = (r > <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">.4</span> && r < <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">.7</span>)
? (<span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">vec3</span>(<span class="m_-7094181475431821785m_6227054243253370675hljs-built_in" style="box-sizing:border-box;color:rgb(0,134,179)">step</span>(<span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">.1</span>, r*r*r)) * CE)
: (r < <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">.9</span> ? (r < <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">.7</span> ? CO: CM) : CI);
<span class="m_-7094181475431821785m_6227054243253370675hljs-keyword" style="box-sizing:border-box;font-weight:bold">return</span> c;
}
<span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">void</span> propFuncFS(<span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">void</span>)
{
<span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">vec2</span> uv = (<span class="m_-7094181475431821785m_6227054243253370675hljs-built_in" style="box-sizing:border-box;color:rgb(0,134,179)">gl_FragCoord</span>.xy / iResolution.xy * <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">2.</span> - <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">1.</span>)
* <span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">vec2</span>(iResolution.x / iResolution.y, <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">1</span>) * <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">1.25</span>;
<span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">vec3</span> col = <span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">vec3</span>(<span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">0</span>);
<span class="m_-7094181475431821785m_6227054243253370675hljs-meta" style="box-sizing:border-box;color:rgb(153,153,153);font-weight:bold">#ifdef AA</span>
<span class="m_-7094181475431821785m_6227054243253370675hljs-comment" style="box-sizing:border-box;color:rgb(153,153,136);font-style:italic">// Antialiasing via supersampling</span>
<span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">float</span> e = <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">1.</span> / <span class="m_-7094181475431821785m_6227054243253370675hljs-built_in" style="box-sizing:border-box;color:rgb(0,134,179)">min</span>(iResolution.y , iResolution.x);
<span class="m_-7094181475431821785m_6227054243253370675hljs-keyword" style="box-sizing:border-box;font-weight:bold">for</span> (<span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">float</span> i = -AA; i < AA; ++i) {
<span class="m_-7094181475431821785m_6227054243253370675hljs-keyword" style="box-sizing:border-box;font-weight:bold">for</span> (<span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">float</span> j = -AA; j < AA; ++j) {
col += samplef(uv + <span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">vec2</span>(i, j) * (e/AA)) / (<span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">4.</span>*AA*AA);
}
}
<span class="m_-7094181475431821785m_6227054243253370675hljs-meta" style="box-sizing:border-box;color:rgb(153,153,153);font-weight:bold">#else</span>
col += <span class="m_-7094181475431821785m_6227054243253370675hljs-keyword" style="box-sizing:border-box;font-weight:bold">sample</span>(uv);
<span class="m_-7094181475431821785m_6227054243253370675hljs-meta" style="box-sizing:border-box;color:rgb(153,153,153);font-weight:bold">#endif /* AA */</span>
<span class="m_-7094181475431821785m_6227054243253370675hljs-built_in" style="box-sizing:border-box;color:rgb(0,134,179)">gl_FragColor</span> = <span class="m_-7094181475431821785m_6227054243253370675hljs-type" style="box-sizing:border-box;color:rgb(68,85,136);font-weight:bold">vec4</span>(<span class="m_-7094181475431821785m_6227054243253370675hljs-built_in" style="box-sizing:border-box;color:rgb(0,134,179)">clamp</span>(col, <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">0.</span>, <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">1.</span>), <span class="m_-7094181475431821785m_6227054243253370675hljs-number" style="box-sizing:border-box;color:rgb(0,128,128)">1</span>);
}</code></pre><div><br></div></div><br>______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com/" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensou<wbr>rce/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FA<wbr>Q</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/vtkusers</a><br>
<br></blockquote></div><br><br clear="all"><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_-7094181475431821785gmail_signature" data-smartmail="gmail_signature">Ken Martin PhD<div>Chairman & CFO<br>Kitware Inc.<br>28 Corporate Drive<br>Clifton Park NY 12065<br><a href="tel:(518)%20371-3971" value="+15183713971" target="_blank">518 371 3971</a><div><br></div><div><span style="font-size:10pt;font-family:Tahoma,sans-serif">This communication,
including all attachments, contains confidential and legally privileged
information, and it is intended only for the use of the addressee. Access to this email by anyone else is
unauthorized. If you are not the intended recipient, any disclosure, copying,
distribution or any action taken in reliance on it is prohibited and may be
unlawful. If you received this communication in error please notify us
immediately and destroy the original message.
Thank you.</span></div></div></div>
</font></span></div>
</div></blockquote></div><br></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Ken Martin PhD<div>Chairman & CFO<br>Kitware Inc.<br>28 Corporate Drive<br>Clifton Park NY 12065<br>518 371 3971<div><br></div><div><span style="font-size:10pt;font-family:Tahoma,sans-serif">This communication,
including all attachments, contains confidential and legally privileged
information, and it is intended only for the use of the addressee. Access to this email by anyone else is
unauthorized. If you are not the intended recipient, any disclosure, copying,
distribution or any action taken in reliance on it is prohibited and may be
unlawful. If you received this communication in error please notify us
immediately and destroy the original message.
Thank you.</span></div></div></div>
</div>