Jump to content
  • Advertisement
Sign in to follow this  
mike74

fast reflections

This topic is 4874 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 create an ebook cover generator, but I'm not sure exactly how to do fast reflections. Although I programmed reflections into my ray tracer at http://www.coolgroups.com/raytracer/, they're just too slow. Does anyone have any ideas on accelerating the code for an ebook cover creator that supports reflections? Mike http://www.coolgroups.com/

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure exactly what you want, but how about this:
You run along the bottom edge of your shape that you want to reflect, pixel-by-pixel from left to right. You copy the pixel from the bottom of the shape, write it to the pixel underneath it then move the "read" pointer up one pixel and the "write" pointer down one pixel, copy again. Carry on for however many pixels you need, fading out the value of the written pixel as you go (so at the top you write a very strong value, at the bottom edge you have a faint one showing through the background colour more. Once you have faded out to nothing, move to the next pixel right and repeat.
I hope this is sort of clear...

Share this post


Link to post
Share on other sites
That would create a 2d reflection, but I'd like a mathematically correct 3d reflection. In some cases they may be similar, but not always.

Mike
http://www.coolgroups.com/forum

Share this post


Link to post
Share on other sites
To reflect a point in 3D you can create a vector from your point to the nearest position on the plane you are reflecting over. Then the reflected point is the old point plus two times that vector.

If you were trying to create a reflection in real time the basic method would be to create the reflection as a 3D object and place it where it would be behind the surface that is reflecting. Then draw the reflection only inside the other object.


btw:the easiest way to find the closest point on the plane is to create a line perpendicular to the plane and see where it collides with the plane

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!