Hi Terry,
On 2/8/07, Terry Welsh <[EMAIL PROTECTED]> wrote:
> I think I could get a good performance boost rendering shadow maps if
> I didn't sort anything. Since shadow texels are either on or off with
> no medium gray, I shouldn't matter what order in which geometry is
> rendered. Is there a way I can completely disable sorting when
> rendering with a CameraNode, even if some of my geometry is in the
> transparent bin?
You can control the draw order by setting the sort order on the
RenderBIn's. You can override the render bin details of StateSet's
below by using the OVERRIDE_RENDERBIN_DETAILS in StateSet, and then
set a custom RenderBin with the depth first sort order.
In other words, I can do this?
myShadowMapCameraStateSet->setRenderBinDetails(0, "RenderBin",
StateSet::OVERRIDE_RENDERBIN_DETAILS);
This seems to work, temporarily placing everything in the opaque bin
when rendering shadows. Why do you prefer using a cull callback
instead of this one simple line?
I haven't updated OSG and tried ABSOLUTE_RF_INHERIT_VIEWPOINT yet.
I'll try it soon I hope. Thanks for the heads up on that.....
- Terry
Another possibilty is to use a cull callback that allows the cull
traversal within the camera to be done and then goes through the
cameras RenderStage and resets the bin orders by hand. This requires
a bit more knowledge of the back end, but would be my preferred route
for doing this. See the osgshadow example source for some code that
does this something similar for stencil volume.
BTW, yesterday I had to change the way the view point was managed to
make it more flexible and to retain backwards compatibility of how
absolute Transform's/Camera's used to work. If you look in
include/osg/Transform you 'll now find a new option of ReferenceFrame:
ABSOLUTE_RF_INHERIT_VIEWPOINT. This is the option you'll need to use
in the RTT Camera's. I modified you PSSM example and it works fine.
This new option also mean you don't need to worry about assign a View
to your camera.
Robert.
enum ReferenceFrame
{
RELATIVE_RF,
ABSOLUTE_RF,
ABSOLUTE_RF_INHERIT_VIEWPOINT
};
/** Set the transform's ReferenceFrame, either to be relative to its
* parent reference frame, or relative to an absolute coordinate
* frame. RELATIVE_RF is the default.
* Note: Setting the ReferenceFrame to be ABSOLUTE_RF will
* also set the CullingActive flag on the transform, and hence all
* of its parents, to false, thereby disabling culling of it and
* all its parents. This is neccessary to prevent inappropriate
* culling, but may impact cull times if the absolute transform is
* deep in the scene graph. It is therefore recommended to only use
* absolute Transforms at the top of the scene, for such things as
* heads up displays.
* ABSOLUTE_RF_INHERIT_VIEWPOINT is the same as ABSOLUTE_RF except it
* adds the ability to use the parents view points position
in world coordinates
* as its local viewpoint in the new coordinates frame. This
is useful for
* Render to texture Cameras that wish to use the main views
LOD range computation
* (which uses the viewpoint rather than the eye point)
rather than use the local
* eye point defined by the this Transforms' abosolute view matrix.
*/
void setReferenceFrame(ReferenceFrame rf);
ReferenceFrame getReferenceFrame() const { return _referenceFrame; }
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/