Jump to content
  • Advertisement

Archived

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

88er

about reflection......

This topic is 5389 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

I want to render the reflected scene to a texture map, but how to calculate the UV coords for the reflection texture? how can i get the correct reflection?? Some article suggest reset the project matrix before render the reflection texture,is this way viable?? Some code fragement will be helpful for me.

Share this post


Link to post
Share on other sites
Advertisement
There is an SDK sample I belive that shows a teapot rotating, and in the background there is a mirror reflecting it. So you may want to check that out - it was fairly simple, I think. I''m pretty sure it used the render-to-texture method.

Share this post


Link to post
Share on other sites
thx.
but which sample it is??
cube map or clip mirror??
i can''t find any other sample use render to texture,except for
cube map.
I''d like to render the reflection scene to texture on the reflection plan(erose) ,i can''t understood how to set the
uv coords or set the projective matrix when render the reflection texture.would you explain to me.

thank you.

Share this post


Link to post
Share on other sites
You need to set a new projection matrix just prior to the rendering to the texture. It has to match the dimensions of the texture you are rendering to. An example being if you create a 256 x 256 texture. Your projection matrix would be something like

D3DXMATRIX matProj;
D3DXMatrixPerspectiveFovLH( &matProj, D3DXToRadian(45), 1, 1, 10000 );

Notice that the aspect in the second line is just '1' because 256 / 256 = 1.

The "Two Kings" DirectX site has a great render to texture tutorial here

The texture coordinates are set in the individual vertices of your model you're texturing.


[edited by - __Daedalus__ on January 14, 2004 3:19:35 AM]

Share this post


Link to post
Share on other sites
Is this approach can be use for reflection???
It looks like can''t get the correct reflection texture,
and the reflection plane must be rectangle.

may be had i wrong.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!