Hi,

I'm writing a laser range finder simulator using the depth component of a scene.

I'm linearising the range in a fragment shader using..

linearRange = (2.0*near) /(far+near-(nonLinearRange*(far-near)))

I was hoping to display the foggy depth image by allowing the rtt camera to 
calculate the near/far planes and pass these values to the shader for use in 
the linearisation.

I had hoped that this would mean that the calculated range should remain the 
same whether DO_NOT_COMPUTE_NEAR_FAR was set or not.

I'm getting the near/far numbers from rttCamera->getProjectionMatrixAs Frustum 
and passing these to the shaders in a viewer->frame loop using Uniform->set(), 
but the linearised range is different dependent on DO_NOT_COMPUTE_NEAR_FAR.

I can confirm that the near/far values change within the loop as the scene 
changes.

Is it valid to pass data to a shader using Uniform-set() in a viewer->frame 
loop?

Is my assumption that linearised range should be independent of 
DO_NOT_COMPUTE_NEAR_FAR if the near/planes are passed to the linearisation 
algorithm correct?

Can anyone comment on the algorithm used (which seems to be generally 
accepted)?   

Ta.

John

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=35796#35796





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to