Advertisement Jump to content
Sign in to follow this  
george7378

Ray tracer minor issue

This topic is 1779 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 everyone,

 

Here's a picture from my ray tracer:

 

[attachment=20203:pyramid1.png]

 

It looks mostly find but if you zoom in on the top sphere in the pyramid (a glass one with a refractive index of 1.5), you can see that there are some dark pixels which shouldn't be there. These don't show up if I remove the glass sphere and they don't show up on any of the reflective ones.

 

I've tried replacing it with another sphere with a refractive index of 1 (so no deviation to the light's path) but I still get these weird artefact pixels (in different places though). Has anyone else come across the same problem while creating a ray tracer? I tried changing my maximum ray depth to be larger but it made no difference.

 

Thanks!

Share this post


Link to post
Share on other sites
Advertisement

Are you pushing your rays in/out sufficiently to prevent self-intersection? What does your refraction code look like? It's possible it has a bug that causes light paths refracted at some height/angle to get stuck inside the sphere and never escaping, so increasing the ray depth would not change anything (think getting stuck between two mirrors, different geometry but similar problem).

 

Just a guess, though. It's hard to tell. Maybe try removing the Fresnel for now to try and isolate the bug.

Share this post


Link to post
Share on other sites

enable floating point exceptions, that way you'll usually hunt down most of those issues (even some more hidden that you might not even notice visually).

 

in my tracers I've usually added a ray picking for debugging, at the place you click with the mouse cursor, I simply cast a ray. in the debugger you setup a breakpoint at the trace function and then you can easily track down the source of the problem.

Share this post


Link to post
Share on other sites

Thanks very much for the replies, Bacterius was correct - my bias was too small. I don't know why I didn't think of that, it's sitting there right underneath my ray depth constant, in big capital letters!

 

Krypt0n - I also enabled floating point exceptions (at least I think I did!) and ran my program in debug in VS2012 and nothing showed up. Thanks for the suggestion :)

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!