VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

DirectX, Realtime Lighting with Dynamic Stencil Shadows

CadeF  (1 Submission)   DirectX   Advanced   Wed 3rd February 2021

This code shows how to use DirectX to render realtime lightmaps. 2 buffers are used, a scene buffer and a light buffer. The lights & shadows of a scene are first rendered to the backbuffer(stencil shadows), and then the backbuffer's contents are copied to the light buffer. The backbuffer is then cleared and the scene is rendered, after which the backbuffer is copied to the scenebuffer. The final part is to render the scene buffer multiplied by the light buffer onto the backbuffer.
1 of the 3 lights in this demo can be moved around with the mouse.
Note that this demo does not work properly if 2 objects are intersecting as on the area they intersect, they cut out the shadows and cast shadows from around the point of intersection.
Please post any comments you have...

Rate DirectX, Realtime Lighting with Dynamic Stencil Shadows (6(6 Vote))

Download DirectX, Realtime Lighting with Dynamic Stencil Shadows

DirectX, Realtime Lighting with Dynamic Stencil Shadows Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters