Jump to content


Creating a glass object in ray tracing


7 replies to this topic

#1 Psycho_Gamer

    New Member

  • Members
  • Pip
  • 8 posts

Posted 30 March 2007 - 08:12 PM

I've been stumped on how I can go about creating an object that looks like glass. No matter what I do, I always get a solid colour. Any hints?

#2 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 31 March 2007 - 01:03 AM

Google for refraction and Snell's law.
reedbeta.com - developer blog, OpenGL demos, and other projects

#3 Psycho_Gamer

    New Member

  • Members
  • Pip
  • 8 posts

Posted 31 March 2007 - 05:43 AM

Reedbeta said:

Google for refraction and Snell's law.

Yeah, I have been trying refraction, but I think I might have the formula for my refraction ray direction in correct. On my sphere, i currently get a ring that looks transparent, while the inside is solid.

#4 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 31 March 2007 - 06:04 AM

Try working out the vectors on paper for a simple scene, using your formula, and check that everything looks like it's going the right direction. There are different sign conventions in use for the incident ray and refracted ray, so you might have a formula that doesn't match your program.
reedbeta.com - developer blog, OpenGL demos, and other projects

#5 roel

    Senior Member

  • Members
  • PipPipPipPip
  • 697 posts

Posted 31 March 2007 - 09:08 AM

And if Reedbeta's solution fails, and you are unsure about your formula, this might help.

#6 Psycho_Gamer

    New Member

  • Members
  • Pip
  • 8 posts

Posted 02 April 2007 - 07:32 AM

Thanks folks.

#7 anubis

    Senior Member

  • Members
  • PipPipPipPip
  • 2225 posts

Posted 03 April 2007 - 09:46 AM

and there is always the excellent raytracing article series here at devmaster :

http://www.devmaster...eries/part3.php
If Prolog is the answer, what is the question ?

#8 Psycho_Gamer

    New Member

  • Members
  • Pip
  • 8 posts

Posted 03 April 2007 - 10:25 PM

anubis said:

and there is always the excellent raytracing article series here at devmaster :

http://www.devmaster...eries/part3.php
Yup, I got it using that :D





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users