Sign in to follow this  
Focusrite

Stencil test and shader

Recommended Posts

Hello Gamedev,
I'm working on a 2d shadow system (by drawing to an alpha layer texture, which blends the world accordingly) and require a stencil test to make multiple light sources to work propperly.
However, there's an issue with the stencil test when it passes through the shader, it still renders. The "algorithm" used is:[list=1]
[*]Draw point light onto stencil.
[*]Apply shadow (ie. remove the drawn light where it does not reach, behind walls etc)
[*]Render the point light to the alpha layer where stencil allows (ie. where shadows haven't removed)
[/list]
The render, step 3, has to pass through the shader and isn't blocked by the stencil, and it's completely rendered onto the alpha layer, is there any way you can make the shader too be blocked by the stencil test?

Regards
Focusrite [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this