VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



DirectX, Realtime Lighting with Dynamic Stencil Shadows

by CadeF (1 Submission)
Category: DirectX
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating: (5 Votes)

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

Download DirectX, Realtime Lighting with Dynamic Stencil Shadows

Download DirectX, Realtime Lighting with Dynamic Stencil Shadows (25 KB)

DirectX, Realtime Lighting with Dynamic Stencil Shadows Comments

No comments have been posted about DirectX, Realtime Lighting with Dynamic Stencil Shadows. Why not be the first to post a comment about DirectX, Realtime Lighting with Dynamic Stencil Shadows.

Post your comment

Subject:
Message:
0/1000 characters