Welcome, Guest. Please login or register.

Author Topic: Raytracer Math Question  (Read 1457 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Rogue

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 566
    • Show all replies
    • http://www.hyperion-entertainment.com
Re: Raytracer Math Question
« on: November 16, 2003, 12:20:20 PM »
Quote

JetRacer wrote:
When a raytracer inside/outside (object) test is performed, a positive or negative float is returned, right?

Is this float the exact distance between the surface and the ray?


I'm not sure I understand what you mean with inside/outside tests...

Most tests assume that the ray is given as

r = P + t*d

with P being the origin point of the ray (eye or previous intersection), d being the direction vector, and t being a parameter in the range [0..+inf]. Most intersection tests will return the t of the intersection. Thus you can calculate the point of intercept by replacing the returned t in the above equation.

Is that what you mean?
Look out, I\'ve got a gun
 

Offline Rogue

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 566
    • Show all replies
    • http://www.hyperion-entertainment.com
Re: Raytracer Math Question
« Reply #1 on: November 16, 2003, 03:24:00 PM »
Quote

JetRacer wrote:
Sorry, I should have been more specific.

In the case of a native object, I shoot a ray and give it's coordinates (as distance equals object distance from camera) to the native formula which then return a float. This float is positive if the ray miss, or negative if ray hits.

Is this float reflecting distance; ray vs surface?



What do you mean with "native formula"? Can you give an example of the type of primitive and the formula you are using?
Look out, I\'ve got a gun