Archived

This topic is now archived and is closed to further replies.

D3D Texture as rendering target?

This topic is 6276 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Have you ever considered using a texture as a rendering (D3DDevice) target? Think about it a moment. You could make a mirror - just set the texture of the polygon that''s a mirror to be another texture that gets rendered to. Then you could find what direction in space the mirror is reflecting to the viewer (a simple dot-product/cross-product procedure), and have D3D render your scene onto the mirror before rendering the main scene. Just remember not to use mirrors that face eachother Thoughts? Comments? Bean Dog

Share this post


Link to post
Share on other sites
Haha, mirrors which accidentally faced each other would be a brilliant way to do a stack overflow! On a T&L card it would probably mess up display memory and crash the GPU.

Hmm, I wonder if you could make any optimisations if the viewpoint never changed... this could be quite a good way to do mirrors actually, I hadn't really thought about it before.

------------------------------
#pragma twice


sharewaregames.20m.com

Edited by - furby100 on October 9, 2000 3:36:27 AM

Share this post


Link to post
Share on other sites
Well it would not crash CPU nor GPU, but your engine (if you would not watch for this).
Because it goes something like this:

SetRenderTarget(texture1);
Draw what ever you want...

SetRenderTarger(back_buffer);
SetTexture(texture1);
Draw frame...

furby100: Yup you simply leave render texture for multiple frames... You don''t need to render it every frame.

Share this post


Link to post
Share on other sites
I''m not seeing how it would crash. The way I envision it, the only negative consequence of facing mirrors would be that they would not show infinite reflections. I render to the one, and then render to the other. Then I render the scene that the player sees. How would this cause a crash? I would only render once to each mirror per frame no matter what.

Share this post


Link to post
Share on other sites
Oh, yeah, unless it was doing a crazy parallel processing thingummy.....

Well, there is a way to do reflections like this, it has some sort of sample in the DX7SDK, yes the stencil mirror sample, how does that do it, hmm... well, using a texture as a render target is even more interesting than texturing a television screen with streaming video...

Furby100 contemplates his overuse of poseopoeses...

------------------------------
#pragma twice


sharewaregames.20m.com

Share this post


Link to post
Share on other sites