6.1 C
New York
Saturday, March 15, 2025

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


I’ve a ahead reflexion protocol producing a reflexion map used for closing scene rendering. I can have a number of heights of floor we will outlined as “mirrors”. With a purpose to have just one map for all “mirrors” I’ve set a D24S8 depthstencil buffer which can be used for rendering the scene to avoid wasting assets. The stencil is full of worth related to the heights of the varied “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 will not be used when rendering the ultimate scene.

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

I feel it must be doable to make use of this to render to my two rendertargets. On this case we want 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 following 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 assets spend.

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

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles