Skip to main content
GameDev.net gamedev.net
🔒 Locked

Render to texture

Started by bakery2k1 Jan 10, 2002 at 9:16 AM 0 replies 250+ views
Original Post
bakery2k1
bakery2k1
OK, I''ve now got my projective textures working, so would like to try shadow mapping. This involves first rendering the scene from the lights point of view to a smaller(eg 256x256 viewport), obtaining te depth values for each pixel and using these as a texture. How can I: a) Render my scene so that the depth buffer is automatically rendered to a 256x256 texture? OR: b) -Reduce the viewport size to 256x256 (without changing the window size) AND -Read back depth values from the resulting image? Thanks
CrazedGenius
CrazedGenius
nVidia has a sample on their site that does exactly what you''re talking about.

a) Create a 256x256 texture and backbuffer. Set both when rendering your scene.

and

b) Call SetViewport()

See the nVidia sample about the depth buffer. Alternatively, you can use a vertex shader to write derived depth values to the color channel and use that for your shadow map.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.