I am trying to shading a point cloud in point gaussian representation.
But I cannot figure out how to get vertex normal or how to get camera position through shader replacement/ custom shader.
Could someone give me some hints? Thanks!
I am trying to shading a point cloud in point gaussian representation.
But I cannot figure out how to get vertex normal or how to get camera position through shader replacement/ custom shader.
Could someone give me some hints? Thanks!
Hi,
The spheres displayed by the Point Gaussian representation are fake spheres, it is is actually quads facing the camera, so getting the normal and camera position to compute shading would be useless (the normal is always pointing to the camera).
The default shading is computed this way:
float dist = dot(offsetVCGSOutput.xy,offsetVCGSOutput.xy);
if (dist > 1.0) {
discard;
} else {
float scale = (1.0 - dist);
ambientColor *= scale;
diffuseColor *= scale;
}
If the fragment of the quad is outside the unit circle, it is discarded.
Otherwise, the color is scaled down with the distance from the fragment to the center of the quad.
The VTK shader examples also might help: https://lorensen.github.io/VTKExamples/site/Cxx/#shaders
Current URL: https://examples.vtk.org/site/