hlsl – Can we use geometry shader to permit or not the drawing based mostly on a stencil worth?


I’ve a ahead reflexion protocol producing a reflexion map used for ultimate scene rendering. I can have a number of heights of floor we will outlined as “mirrors”. As a way to have just one map for all “mirrors” I’ve set a D24S8 depthstencil buffer which can also be used for rendering the scene to save lots of sources. The stencil is stuffed with worth related to the heights of the assorted “mirrors”. As every mirror has an inventory of objects being on it, solely objects related to a mirror are rendered within the stencil a part of this mirror. The stencil just isn’t used when rendering the ultimate scene.

I am considering of an extra attainable optimization utilizing a geometry shader to render the scene and the reflexion on the identical time. Can we use a stencil info to selectively draw issues from the geometry shader?

I believe it ought to be attainable to make use of this to render to my two rendertargets. On this case we’d like a “rolling” reflexion map to render the scene with the reflextionmap1 whereas we’re additionally rendering within the reflexionmap2. Then roll map1/2 for the subsequent spherical. The issue I believe is that we have to have RTV2DArray and DSV2Darray to have one separate depth buffer for every goal. An excessive amount of sources spend.

In constrast is it possible to attract evryting on the primary rendertarget straight based mostly on the stencil information?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles