D3D Texture as rendering target?

Started by
4 comments, last by BeanDog 23 years, 6 months ago
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
Advertisement
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

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.
You would only need to render when the scene was changed, and only when the player was actually looking at the mirror.

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


sharewaregames.20m.com

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.
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

This topic is closed to new replies.

Advertisement