Unknown intersection information in "__closesthit__" funtion

Hi!I recently try to simulate radio wave propagation by optix. Now, I have a point as transmitter and some target end points in buildings.After i launch optixtrace, I got some Intersection information, but I found some wrong infomation like this.

these points i set:
OriginPoint (x = 669105.875000 y = 3540470.000000 z = 29.000000) 
TargetPoint (x = 669310.250000 y = 3541398.750000 z = 22.500000)
-------------------
the first trajectory:
OriginPoint: x = 669105.875000 y = 3540470.000000 z = 29.000000
Intersection : x = 669310.250000 y = 3541398.750000 z = 22.500294
RayDirection: x = 0.214907 y = 0.976611 z = -0.006835
Normal: x = 0.037557 y = -0.999294 z = 0.000000
ReflectionRayDirection: x = 0.287607 y = -0.957724 z = -0.006835
Distance = 950.993138

the second trajectory:
OriginPoint: x = 669310.250000 y = 3541398.750000 z = 22.500294
Intersection: x = 669310.250000 y = 3541398.750000 z = 22.500000
RayDirection: x = 0.287607 y = -0.957724 z = -0.006835
Normal: x = 0.037557 y = -0.999294 z = 0.000000
ReflectionRayDirection: x = 0.214907 y = 0.976610 z = -0.006835
Distance = 0.000294


the third trajectory:
OriginPoint: x = 669310.250000 y = 3541398.750000 z = 22.500000
Intersection : x = 669313.562500 y = 3541413.750000 z = 22.395020
RayDirection: x = 0.214907 y = 0.976610 z = -0.006835
Normal: x = 0.000000 y = -1.000000 z = -0.000000
ReflectionRayDirection: x = 0.214907 y = -0.976610 z = -0.006835
Distance = 15.361760

From this information, the first the first trajectory may be correct, but i have no idea how i got the second trajectory.
And by the way, if i try to simulate diffraction, where i can get some examples?
I am a beginner in optix and hope your help.
Thanks!

From this information, the first the first trajectory may be correct, but i have no idea how i got the second trajectory.

With a result Distance = 0.000294 that could be due to self-intersection of the same geometry you started the continuation ray from.

You would need to implement some mechanism to avoid such self-intersections.
There are different ways to prevent that, where the simplest and least robust method would be shifting the ray t_min interval start away from the current hit point by some scene size dependent epsilon.
Your coordinate range looks to be quite big in the multi-million range which will affect the possible precision inside the 32-bit float representation which uses a 23-bit mantissa, means you need to determine that epsilon to match your scene size.
Many OptiX SDK and open-source examples show that. Just look at the optixTrace calls arguments for the t_min values.
There is a similar but numerically more robust method inside the Ray Tracing Gems books. (Search the web.)
Completely robust methods would track some unique geometry ID of the surface the ray started from and filter out hits on the same unique geometry ID, but that is slower and more advanced.
(In image rendering algorithms such self-intersections are visible on the shadow rays as “shadow acne” since incorrect intersections would produce shadows where there shouldn’t be some.)

And by the way, if i try to simulate diffraction, where i can get some examples?

I don’t know about example code using diffraction. In the end it’s some ray distribution function you would need to know and implement when there is a case requiring diffraction on surface hits.
That methodology is similar to other bi-directional reflection distribution functions (BRDF) used when rendering materials, just with a different distribution function.

This is not the first time this topic had appeared on this forum.
Please have a look into this thread and follow the links in there for more information:
https://forums.developer.nvidia.com/t/visual-representation-of-ray-propagation-using-ray-tracing/191564

Thanks for the clear reply!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.