Amiga.org

Amiga computer related discussion => Amiga Software Issues and Discussion => Topic started by: JetRacer on November 16, 2003, 12:00:17 PM

Title: Raytracer Math Question
Post by: JetRacer on November 16, 2003, 12:00:17 PM
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?
Title: Re: Raytracer Math Question
Post by: Rogue 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?
Title: Re: Raytracer Math Question
Post by: JetRacer on November 16, 2003, 12:41:51 PM
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?

Title: Re: Raytracer Math Question
Post by: Rogue 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?
Title: Re: Raytracer Math Question
Post by: Karlos on November 17, 2003, 04:36:09 AM
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?


Are you saying that the value returned is the (scalar) distance of 'current' position along the ray, from the point on the surface that the ray intersects?

Thats the only logical way I can see that the value would have a different sign on different sides of the surface.