[SOLVED] DepthRange

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
nickygs
Gnoblar
Posts: 15
Joined: Wed Jul 20, 2016 7:55 pm

[SOLVED] DepthRange

Post by nickygs »

For my shader I have this line of code when setting the uniform parameter.

Code: Select all

//Passed as float4(minDepth, maxDepth, depthRange, 1 / depthRange)
	vertexParams->setNamedAutoConstant("depthRange", Ogre::GpuProgramParameters::ACT_SCENE_DEPTH_RANGE);
Now after shading using depthRange and farClipDistance I have obtained different images. Previously I thought that depthRange = farClipDistance-nearClipDistance but this does not seem to be the case.
This would also imply that the minDepth is not equal to the nearClipDistance and similarly the maxDepth is not equal to the farClipDistance.

Can someone please clarify what the depthRange really is and also how I can get the values in code and not just through the Ogre::GpuProgramParameters enumeration.
Last edited by nickygs on Wed Mar 01, 2017 7:23 pm, edited 1 time in total.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: DepthRange

Post by dark_sylinc »

In Ogre 1.x it returns the actual depth difference between the closest and furthest object in display by the camera.
In Ogre 2.x it returns far - near.
nickygs
Gnoblar
Posts: 15
Joined: Wed Jul 20, 2016 7:55 pm

Re: DepthRange

Post by nickygs »

Thanks, that's would my results got me to believe
Post Reply