Help with reflections...

Started by
5 comments, last by Kirkbag 22 years, 3 months ago
Hey ppl, i have problem. i wanna reflect a ball on each wall of a room... so far i am unsuccessful... tried 2 use NeHe''s tutorial but got in a mess. if anyone can help me or direct me 2 some site or something it would b really gr8... thanks.
Advertisement
Are you trying to write to the stencil buffer twice ? That *may* be a problem. I tried creating two relfections and was also un-successful. I think it might be that you can only write once into the stencil buffer. Not 100 sure though.

Also check your clipping planes if you have any.

Nitzan

-------------------------
www.geocities.com/nitzanw
www.scorchedearth3d.net
-------------------------
well, technically i am trying 2 make 6 reflections at once.. hehe, anyway, just one refelction would b great for starters. problem is... i''m not sure how 2 reflect on a plane that is not (0,0,0,0)
If you are with the camera always inside the walls i don''t think you''ll need the stencil buffer, and that can really increase the speed of you app.
So for what i see your problem is a math problem right?
You have to find a vector that is parallel to the normal of the plane and intersects the center of the ball.
Then find the point where the plane intercepts that vector and add the symmetrical of that vector to that point.
You now have found the center of the reflected ball.
This won''t even require trignometry, just simple geometry.
Well, I actually succeeded creating the reflections, and i used the stencil buffer so that the reflections will show up only on the walls of the room and not anywhere else! another thing i did was make some reflections disappear if u rotate the scene 2 a certain angle, but that''s just bcz i couldn''t figure out how 2 clip a certain plane that is not intersecting 0,0... if anyone knows how 2 do this (and i''m sure some of u know), plz enlighten me. Thanks!
If you have 6 reflective surfaces facing each other, shouldn''t have the infinite mirror thing that you get...?

Death of one is a tragedy, death of a million is just a statistic.
If at first you don't succeed, redefine success.
Well python_regious if you look at how reflections are done than it would take alot of work to do that. Reflections are created useing the Stencil Buffer which you use to define an area that is cut out (an invisible area) then you redraw anything in your scene that is reflected from one side of the buffer shape to the other. Then you disable the stencil buffer and put a polygon of the same shape that is blended to around 40% on the buffer shape. Now if you can see through the buffer shape you are allowed to see the redrawn scene and poof reflections.
A man walks into a bar.....ouch!?! Ya get it, do ya huh huh well....awww I give up.

This topic is closed to new replies.

Advertisement