Dear VTK Users,
I am using vtkPointGaussianMapper and set the SplatShaderCode as below:
mapper->SetSplatShaderCode(
“//VTK::Color::Impl\n”
“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"
“}\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).
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.
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.