Raytracing problem.

Started by
5 comments, last by nickelplate 20 years, 1 month ago
Hi all, I'm writing a ray tracer and I'm having a problem displaying planes along with spheres in the same scene, in certain situations. Basically I can't make a sphere rest on a plane: the sphere is "clipped" and only the upside hemisphere is displayed. Here is the scene I'm talking about. Spheres with plane problem. In this scene, the spheres are each of radius 1.0 and located at Y=2.0, and the plane is at a distance 1.0 above the X-Z plane, with the Y unit vector as a normal. So the spheres should rest on the plane, but as you can see that's not what's happening here. When I remove the plane, the scene is as follows. Same scene without plane. In both images above, the camera is positionned at (0.0, 2.0, 6.0). In the following image, I moved the spheres and plane locations have not changed, but now the camera is positionned at (0.0, 1.0, 6.0). The results are slightly different, but still not accurate. Notice how the reflection effects on the plane surface don't quite match with the spheres locations. Same scene with camera moved up. Anyone ever had a similar problem? Any input would be appreciated. Cheers, nickelplate. [edited by - nickelplate on February 29, 2004 10:54:12 PM] [edited by - nickelplate on February 29, 2004 10:56:35 PM] [edited by - nickelplate on February 29, 2004 11:00:24 PM] [edited by - nickelplate on February 29, 2004 11:18:11 PM] [edited by - nickelplate on February 29, 2004 11:20:16 PM]
Advertisement
Your pictures are not working. Once I can see what''s going on I might be able to help.
Never mind. I pasted it twice by accident. Stupid me.
Unfortunatly, I don't know anything about raytracing(still quite a noob), but your Host doesn't allow outside linking(forget the fancy name right now).

Picture 1
Picture 2
Picture 3

Sorry I couldn't be help on the ray tracing, good luck.
Edit: forgot to mention, that those are the pics, that don't show up.

[edited by - HemoGloben on February 29, 2004 11:07:29 PM]
if(this.post == SATISFYING){money.send(1.00,&HemoGloben);return thanks;}
I''ve uploaded the pictures to my msn groups account. You should be able to view them by now. Sorry for the trouble.
Humm, I''m just guessing at this because the pictures can''t tell everything. Are you testing for the closest hit for each ray, rather than the first object that intersect the ray. Oftan the ray will hit more than one object and you have to check to see which one is closest, this appear to be the case with the plane, the ray caster is simply returning the first intersection it comes across. Sorry if this seems trivial, but its worth checking the obvious stuff.
kohonen seems to be on the right track. The other thing I would suggest is making sure you don''t have a minor arithmetic error in your plane intersection function. If you are using object transformations (scale, translate, etc.) to move your objects around, double-check the math there as well. I once spent several weeks scouring my code for a tiny yet frustrating visual error that ended up being a reversed sign in the matrix math library... very annoying.


PiQ Software - Tiny KeyCounter - Freon 2/7 Raytracing Accelerator

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

This topic is closed to new replies.

Advertisement