Jump to content
  • Advertisement

Archived

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

g___a___r___y

Raytracing Transparancy

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

I''m trying to write a ray-tracer in C++. I''ve been stuck on setting the direction of refracted rays for days, I''m wondering if anyone has any ideas on why the following does not work. ... Ray refractedRay; Point3 adjustedStart(-e * normal.x + hitPoint.x, -e * normal.y + hitPoint.y, -e * normal.z + hitPoint.z); // Point3 holds xyz coordinates. I assume the hit point is correct, as reflection and shading work correctly ray.dir.normalize(); Vector direction; GLfloat ni = normal.dot(v); // v is the direction to the camera eye GLfloat eta = obj->mtrl.transparency; // transparency varies between 0 and 1 dir = normal * (eta * ni - sqrt(1.0 - eta * eta * (1 - ni * ni))) + ray.dir * eta; dir.normalize(); refractedRay.start = adjustedStart; refractedRay.dir = dir; refractedRay.recurseLevel = ray.recurseLevel + 1; // recursive call to this shading method follows ... Hope this is the right forum for this question. Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
I think you will find that this is in fact impossible!!



[edited by - jmaceee on March 5, 2003 8:19:48 PM]

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!