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

## 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 on other sites
what the heck is an e book cover creator?

##### Share on other sites
See http://www.ecoverstudio.com/.

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

##### Share on other sites
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 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 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

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633725
• Total Posts
3013567
×