<p>I have a mesh in my scene. That mesh has an emissive texture mapped on it.</p>
<p>For my direct lighting integration, I'll need to sample that mesh. I could sample it uniformly and read the emissive texture at the sampled point but if the emissive texture has high frequencies, this will result in high variance.</p>
<p>I could also importance sample the emissive texture directly but then, how do I find the point on my mesh that corresponds to the texel of the emissive texture that I just sampled?</p>
<p>How do we importance sample emissive textures in practice?</p>

CC BY-SA 4.0
2024-08-16T07:02:11.973Z
Have you thought about mipmapping?
Thomas
CC BY-SA 4.0
2024-08-16T12:09:50.820Z
This would depend on the way your model does its UV-mapping. For example, if you project the polygons onto the U-V plane, and there are overlapping polygons, then things will be tricky: even if you have a perfect inverse CDF for emissive texture (i.e. you can importance-sample the emissive texture), you will have multiple candidate faces when mapping the sampled tex-coord back to the mesh.
Enigmatisms
CC BY-SA 4.0
2024-08-16T12:15:05.240Z
So method like this could be employed (not sure whether this is good though): (1) build a Piecewise-Constant 2D Distributions (as stated in PBR-book). (2) Project your mesh onto the UV plane and let's assume there is no overlapping: you will have a new texture, where each pixel in it is an index (to the mesh face). So when you sample the piecewise constant 2d distributions, you can have a index that points back to the face you should retrieve. The texture of indices should have the same shape as the piecewise constant 2d distributions.
Enigmatisms
CC BY-SA 4.0
2024-08-16T20:02:27.107Z
@Enigmatisms So if i understand correctly, I'm going to need one texture per mesh that has an emissive texture? Sounds VRAM-expensive.
Tom Clabault
CC BY-SA 4.0
2024-08-16T20:03:17.207Z
@Thomas I'm not sure I see what you intend by using mipmapping, could you elaborate?
Tom Clabault
CC BY-SA 4.0
2024-08-17T02:24:41.863Z
It will just be an additional texture for each object, but I thought of this method off the top of my head so I am not sure whether it is good practice. I was going to suggest Light BVH, though I was not sure either since light BVH I came across mostly handles many light (known importance) problem. Check out this paper: Importance Sampling of Many Lights with Adaptive Tree Splitting. It seems applicable to complex mesh-light.
Enigmatisms
<texture><pathtracing><lighting><importance-sampling>
How to importance sample emissive textures on meshes?
Tom Clabault
# How to importance sample emissive textures on meshes?

(Asked by: username_0 on 2024-08-15)

I have a mesh in my scene. That mesh has an emissive texture mapped on it.

For my direct lighting integration, I'll need to sample that mesh. I could sample it uniformly and read the emissive texture at the sampled point but if the emissive texture has high frequencies, this will result in high variance.

I could also importance sample the emissive texture directly but then, how do I find the point on my mesh that corresponds to the texel of the emissive texture that I just sampled?

How do we importance sample emissive textures in practice?

**Tags:** texture, pathtracing, lighting, importance-sampling

> **Comments:**
> **username_1**: Have you thought about mipmapping?  
> **username_2**: This would depend on the way your model does its UV-mapping. For example, if you project the polygons onto the U-V plane, and there are overlapping polygons, then things will be tricky: even if you have a perfect inverse CDF for emissive texture (i.e. you can importance-sample the emissive texture), you will have multiple candidate faces when mapping the sampled tex-coord back to the mesh.  
> **username_2**: So method like this could be employed (not sure whether this is good though): (1) build a Piecewise-Constant 2D Distributions (as stated in PBR-book). (2) Project your mesh onto the UV plane and let's assume there is no overlapping: you will have a new texture, where each pixel in it is an index (to the mesh face). So when you sample the piecewise constant 2d distributions, you can have a index that points back to the face you should retrieve. The texture of indices should have the same shape as the piecewise constant 2d distributions.  
> **username_0**: @username_2 So if i understand correctly, I'm going to need one texture per mesh that has an emissive texture? Sounds VRAM-expensive.  
> **username_0**: @username_1 I'm not sure I see what you intend by using mipmapping, could you elaborate?  
> **username_2**: It will just be an additional texture for each object, but I thought of this method off the top of my head so I am not sure whether it is good practice. I was going to suggest Light BVH, though I was not sure either since light BVH I came across mostly handles many light (known importance) problem. Check out this paper: Importance Sampling of Many Lights with Adaptive Tree Splitting. It seems applicable to complex mesh-light.  

---

## 0 answers

