Jump to content
  • Advertisement

Archived

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

nickelplate

Raytracing problem.

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

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]

Share this post


Link to post
Share on other sites
Advertisement
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

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!