Jump to content
  • Advertisement
Sign in to follow this  
BadEggGames

What to do with reflected color?

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

 

Just about to implement reflection in my tracer. I can calculate the reflected ray, just not sure what to do with the color it hits?

 

Do I just return the color of the object the reflection ray hits and add it to the first objects color?

 

Or do I need to do something else with it?

 

Do I need to take into account shadow and speculatity of the second object or do I apply that to the blended color?

 

Also, if the reflection ray hits the sky, so I just add nothing?

 

Thanks

Share this post


Link to post
Share on other sites
Advertisement

Ideally you'd start a secondary ray where the primary one intersects the object (keeping count of how "deep" the recursion is, or you might end up never finishing). You can then just add the color from the two rays for dielectric reflections or multiply them for metallic reflections.

 

In the case of dielectric reflections you can also scale the secondary color based on the angles of incident for a more realistic appearance, adding a frensel term for example.

Edited by kolrabi

Share this post


Link to post
Share on other sites

Thanks Kolrabi

 

Actually just working on the color combination code now. Thanks for the pointers.

 

Right now I was just adding the color and like you said, not very realist. Will experiment with scaling and metallic.

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.

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!