<p>Yes, you should set the lightmap texture as the render target and use UV-coordinates as vertex position coordinates in your shader to bake lighting into lightmaps. This way you'll write the baked lighting data of triangles into the correct lightmap texels that are used for rendering the triangles on the screen. The UV-map should be unique and no triangles should overlap in the UV-space. The lightmap data needs to be also expanded so that when you later use bilinear filtering to fetch the data from the texture that you don't end up having dark borders following triangle edges at UV seams.</p>

<p>Instead of baking indirect illumination into surface lightmaps, you could also use volume textures. Nice thing is that the with volume textures you'll have the indirect illumination data available everywhere in the scene and you don't need unique UV-mapping, but you'll also have less resolution due to the added memory usage.</p>

<p>If you need to bake indirect illumination into textures depends on the complexity of the scene, quality of the lighting and performance/mem usage you want to achieve, so there's no easy answer.</p>

CC BY-SA 3.0
2016-11-06T05:37:19.627Z
2016-11-06T05:37:19.627Z
JarkkoL
<p>So currently I want to implement radiosity in my engine. After figuring out the amount of light that bounces between elements/disks/patches <em>(I've been told disks are the best - correct me if I'm wrong)</em> <strong>how do you bake it into a texture?</strong></p>

<p>Do I set the render target as the size of my texture and modify my  shader to work with UV coordinates? This is really confusing me so <strong>is there another way?</strong> <strong>Do I even need to bake the light into the textures</strong>, is hardware good enough these days?</p>

<texture><radiosity>
How to implement Texture Baking?
Arjan Singh
# How to implement Texture Baking?

(Asked by: username_0 on 2016-11-04)

So currently I want to implement radiosity in my engine. After figuring out the amount of light that bounces between elements/disks/patches *(I've been told disks are the best - correct me if I'm wrong)* **how do you bake it into a texture?**

Do I set the render target as the size of my texture and modify my shader to work with UV coordinates? This is really confusing me so **is there another way?** **Do I even need to bake the light into the textures**, is hardware good enough these days?

**Tags:** texture, radiosity


---

## 1 answers

### Answer by username_1 on 2016-11-06. Score: 4 | Accepted answer

Yes, you should set the lightmap texture as the render target and use UV-coordinates as vertex position coordinates in your shader to bake lighting into lightmaps. This way you'll write the baked lighting data of triangles into the correct lightmap texels that are used for rendering the triangles on the screen. The UV-map should be unique and no triangles should overlap in the UV-space. The lightmap data needs to be also expanded so that when you later use bilinear filtering to fetch the data from the texture that you don't end up having dark borders following triangle edges at UV seams.

Instead of baking indirect illumination into surface lightmaps, you could also use volume textures. Nice thing is that the with volume textures you'll have the indirect illumination data available everywhere in the scene and you don't need unique UV-mapping, but you'll also have less resolution due to the added memory usage.

If you need to bake indirect illumination into textures depends on the complexity of the scene, quality of the lighting and performance/mem usage you want to achieve, so there's no easy answer.


---

