# Baking material with absolute world coordinates

**URL:** <https://forums.unrealengine.com/t/baking-material-with-absolute-world-coordinates/439342>\
**Category:** Rendering\
**Tags:** bake, unreal-engine, question\
**Created:** [December 12, 2018, 6:32am UTC](https://forums.unrealengine.com/t/baking-material-with-absolute-world-coordinates/439342 "2018-12-12T06:32:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rael55](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rael55](https://forums.unrealengine.com/u/Rael55)\
**Post date:** [December 12, 2018, 6:32am UTC](https://forums.unrealengine.com/t/baking-material-with-absolute-world-coordinates/439342/1 "2018-12-12T06:32:28Z")

</div>

Is there any way to bake a material with absolute world coordinates? I have a material on procedural meshes that fakes lighting for HTML5, and I want to run it once and bake it into a texture for performance.

---

<div class="post-metadata">

**Author:** ![Rael55](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rael55](https://forums.unrealengine.com/u/Rael55)\
**Post date:** [December 16, 2018, 12:46am UTC](https://forums.unrealengine.com/t/baking-material-with-absolute-world-coordinates/439342/2 "2018-12-16T00:46:05Z")

</div>

Anyone possibly know?

---

<div class="post-metadata">

**Author:** ![redbox](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redbox](https://forums.unrealengine.com/u/redbox)\
**Post date:** [December 16, 2018, 5:55am UTC](https://forums.unrealengine.com/t/baking-material-with-absolute-world-coordinates/439342/3 "2018-12-16T05:55:22Z")

</div>

You can bake it in some 3d soft, like 3dsmax or Maya like baking simple AO or so.

In unreal, as far as I know, with RenderToTexture tools, you can bake only flat or unwrapped mesh from one fixed camera point.

[link text](https://docs.unrealengine.com/en-US/Engine/Content/Tools/RenderToTextureTools)

---

<div class="post-metadata">

**Author:** ![Rael55](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rael55](https://forums.unrealengine.com/u/Rael55)\
**Post date:** [December 17, 2018, 6:44pm UTC](https://forums.unrealengine.com/t/baking-material-with-absolute-world-coordinates/439342/4 "2018-12-17T18:44:37Z")

</div>

Yea, the meshes are loaded runtime from a server so that’s why I’m trying to find an in-engine solution for this.

---

<div class="post-metadata">

**Author:** ![redbox](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redbox](https://forums.unrealengine.com/u/redbox)\
**Post date:** [December 17, 2018, 7:42pm UTC](https://forums.unrealengine.com/t/baking-material-with-absolute-world-coordinates/439342/5 "2018-12-17T19:42:16Z")

</div>

I think baking something in runtime is not good idea, specially if you want to optimize performance.

In this case, everything you can do - is optimize materials you use on that meshes.

---

<div class="post-metadata">

**Author:** ![Rael55](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rael55](https://forums.unrealengine.com/u/Rael55)\
**Post date:** [December 18, 2018, 4:09pm UTC](https://forums.unrealengine.com/t/baking-material-with-absolute-world-coordinates/439342/6 "2018-12-18T16:09:44Z")

</div>

It’s not something that I’m baking each frame or something though, I want to bake it during the loading process of a scene. Basically, I have a virtual art gallery app, and art galleries are loaded from a server (customer generated galleries), which also includes data for lights. The lights themselves are meant to be static, but of course I can’t just make static lights because they are created at runtime, and dynamic lights aren’t really supported in HTML5. So I’m using the light data to fake it in a material. But since the light is “static” I want to just do it once and bake it into a texture; I would do this only once per mesh per each scene that is loaded, and that would greatly increase performance for me (especially on mobile) since I’m just loading a texture instead of running a bunch of custom HLSL each frame.

---

<div class="post-metadata">

**Author:** ![redbox](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redbox](https://forums.unrealengine.com/u/redbox)\
**Post date:** [December 18, 2018, 7:41pm UTC](https://forums.unrealengine.com/t/baking-material-with-absolute-world-coordinates/439342/7 "2018-12-18T19:41:37Z")

</div>

I never heard about something like this in unreal. I think there is no good way to bake light during loading or in runtime. Here is small proof:

[https://forums.unrealengine.com/development-discussion/rendering/27069-can-unreal-bake-lights-at-run-time](https://forums.unrealengine.com/development-discussion/rendering/27069-can-unreal-bake-lights-at-run-time)

But, theoretically, it is possible to load scene information on some “server”, which loads it into editor, bake lightning with regular light build flow, and return you a fully ready map, which you can load inro application.

Yeah, this is kinda very complex and difficult solution…

---

<div class="post-metadata">

**Author:** ![Rael55](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rael55](https://forums.unrealengine.com/u/Rael55)\
**Post date:** [December 18, 2018, 10:44pm UTC](https://forums.unrealengine.com/t/baking-material-with-absolute-world-coordinates/439342/8 "2018-12-18T22:44:35Z")

</div>

Yea, I’ve been pulling hairs with this for awhile. That’s a good idea but would require me changing back to implementing actual static lights instead of the fake lighting I have. I’ve been trying to create a function which queue’s up a rendering command which would basically do a render of each mesh, separate from the main rendering of the meshes that happen in the engine, and try to return the shader results so I could create a texture from that, but that’s also a whole new demon for me to conquer…might have to put it off for the time being.
