vsg::RegionOfInterest node checked in, useful for guiding extents of shadows etc. #1146
robertosfield
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi All,
Ever since I started work on shadows in the VSG I've been contemplating a mechanism that could allow users to specify what extents of the scene graph to use when computing the shadow extents. Today I added the vsg::RegionOfInteret node for this purpose, and added support for it into VSG, now merged master, and added to the vsgshadow example to test it out.
The vsg::RegionOfInterest is a node that contains a list of dvec3 points that encompass the region of interest, optimally set up this would be the points of a convex hull thought this optimal configuration isn't required. You can place multiple RegionOfInterest nodes in your scene graph and nested them underneath transform nodes etc.
The vsgshadow additions illustrate how you can set up vsg::RegionOfInterest using the corners of the compute bound of a subgraph:
The vsg::RecordTraversal now tracks the vsg::RegionOfInterest nodes it comes across in a RecordTraversal::regionsOfInterest list and the vsg::ViewDependentState class that handles the shadow map creation now uses this list, transforms the points they enclose into eye coordinates and then adjusts the effective near/far when setting up the extents of the light space. What this means is the shadow maps are created for a more tightly bound region which increases the effective resolution of the generated shadow maps.
This is the results without RegionOfInterest node:
With RegionOfInterest node:
The vsg::RegionOfInterest node also has a mask member to enable different views to select different combinations of RegionOfInterest that should be enabled, and name member to aid to organization of different regions of interest.
While I have specifically implemented RegionOfInterest support into the shadow mapping backend I have kept the new node decoupled from the specifics of lighting/shadows, it's a general purpose class that you can use for your own purposes and potentially we can use it other places of the VSG such as clamping the projection matrix near/far to the extents of RegionOfInterest.
Beta Was this translation helpful? Give feedback.
All reactions