GetNormalEC in PostProcessStage

Hi,

I’m testing postprocessstage - in which way is it possible to get the normal to the terrain. Is there a way similar to positionEC ?

In the shadowMapshader there exists a function/define getNormalEC is it possible to use this function ?

“vec3 getNormalEC() \n” +
“{ \n” +
(hasNormalVarying
? " return normalize(" + normalVaryingName + “); \n”
: " return vec3(1.0); \n") +
“} \n” +

Is there a czm-Function ?

Regards

Rüdiger

Hi @Ruediger_Brand ,

PostProcessStage processes the result of rendering the scene, so it’s no longer possible to access the individual model data in the shader. In other words, after all the terrain / models are rendered, the result is a flat image that then gets passed to the PostProcessStage. At that point, the data is all pixels, and it’s not possible to derive the normals from any of the models.

It would be possible to do this if you used g-buffers, which could store the normals in a scene after it rendered everything. Unfortunately, I don’t believe this is achievable with the Cesium API at this point in time.

@janine thank you for the explanation - but I wonder, that I can access the lightPosition and the positionEC, i.e.

vec4 getPositionEC(){
    return czm_windowToEyeCoordinates(gl_FragCoord);
}

so I thought it is maybe possible to get the normal in a similar way.

Rüdiger