<p>I got a function that generates samples from a GGX visible normal distribution function. When I use it to calculate reflection directions obviously some of these intersect with the surface agin (negative).
These bas samples become more of an issue if the roughness increases.
How to handle this case ?</p>

CC BY-SA 4.0
2020-03-27T07:26:40.357Z
Is this for the case where parts of the reflected lobe intersect the surface, usually seen at glancing angles? I think for that case you need to flip the vector using the surface normal.
PaulHK
CC BY-SA 4.0
2020-03-27T14:06:43.857Z
I solved it by just resampling the normal if the reflection direction is bad. This might be rather computationally expensive but I was able to reduce the overhead so it is barely noticeable.
noName
CC BY-SA 4.0
2020-03-27T14:07:40.597Z
just flipping results in non accurate reflections
noName
<raytracing><brdf><pbr><sampling><ggx>
How to handle negative reflection directions in raytracing?
noName
# How to handle negative reflection directions in raytracing?

(Asked by: username_0 on 2020-03-25)

I got a function that generates samples from a GGX visible normal distribution function. When I use it to calculate reflection directions obviously some of these intersect with the surface agin (negative).
These bas samples become more of an issue if the roughness increases.
How to handle this case ?

**Tags:** raytracing, brdf, pbr, sampling, ggx

> **Comments:**
> **username_1**: Is this for the case where parts of the reflected lobe intersect the surface, usually seen at glancing angles? I think for that case you need to flip the vector using the surface normal.  
> **username_0**: I solved it by just resampling the normal if the reflection direction is bad. This might be rather computationally expensive but I was able to reduce the overhead so it is barely noticeable.  
> **username_0**: just flipping results in non accurate reflections  

---

## 0 answers

