Hello everyone,

I've been grappling with a problem in which I would like your resourceful help.

When doing volumetric scattering of a particle in a medium in which boundaries are involved, for example... outside is void and inside is a material, to check if the ray is within the volume, ray-intersection test will be important. When ray intersects the first boundary like a sphere, the ray will get into the volume and when the ray intersects the second boundary, the particle will get out of the volume. When the scattered particle is too close to the boundary, ray-intersection test would fail to detect the intersection and regard the ray still within the volume, even though the ray already got out of the volume. All this is due to the epsilon value issue that is required in ray-intersection with purpose of preventing self-intersection. No matter how small the epsilon value I use, I'm still grappled with the problem described above.

What are the possible solutions to such?

Thank you.

## Epsilon problem in volumetric scattering of particle

### Re: Epsilon problem in volumetric scattering of particle

You could try to avoid scattering points so near to the volume surface (i.e. the distance must be > epsilon). You can add some safety check code where you generate scattering points and reject the one not suitable (or better avoid to generate them).

### Re: Epsilon problem in volumetric scattering of particle

Dade,

Thank you for your insight. A form of rejection sampling as one option or reject the path if necessary. Let me do some test and see.

Thank you for your insight. A form of rejection sampling as one option or reject the path if necessary. Let me do some test and see.