vtkPointGaussianMapper - SetSplatShaderCode

Dear VTK Users,
I am using vtkPointGaussianMapper and set the SplatShaderCode as below:
“float dist = dot(offsetVCVSOutput.xy,offsetVCVSOutput.xy);\n”
“if (dist > 1.0) {\n”
" discard;\n"
“} else {\n”
" float scale = (1.0 - dist);\n"
" ambientColor *= scale;\n"
" diffuseColor *= scale;\n"
which render the points as spheres as shown below .

I want to render these points as Cubes, Can anyone provide me an example shader code for cubes?
Thanks in advance.

Please note that the points are not rendered as spheres but as disks with a fake shading.
You cannot render cubes with this mapper (you can render squares but I guess you do not want that).

You might be interested by vtkGlyph3DMapper (use SetSourceData with a box).

Thank you Michael for the reply .

Yes, I don’t want squares… Even I don’t want to render cubes.

If not with this mapper, Is there any other mapper where there is an option to do fake shading these points as Cubes…

Thank you.

With Kind Regards,


Is there any reason why you do not want to render cubes with vtkGlyph3DMapper? This is pretty cheap compared to spheres.

I’m not sure if it’s any faster than vtkGlyph3DMapper, but you could try generating your own cubes in a geometry shader. I linked to a simple example in another post here.

Hi Michael,
I tried using vtkGlyph3DMapper and set actor->GetProperty()->SetInterpolationToGouraud(), I get the output like as shown below.

I see steps in the rendered object surface but I want to render it as a smooth surface. Are there any property settings/ shading effects to set to make it smoothed surface?

Thank you @dmreagan for the example. I will check it.