Bake Shaders to Objects Textures

So I have been developing shaders for a little while. A function that would be very helpful in optimizing when merging objects would be a way to bake shaders to a texture.

What I mean, is if I made a gradient to help add depth to several objects, I would like to be able to bake the textures created with the math into a single texture. That way when I go to merge my objects in Unreal the effects the math had based on the object’s bounding box, or Object space, would not be lost.

Does anyone know of a plugin that does this, or a way to do this in engine?

Thank you so much!

You can create textures from objects using render targets.
Maybe take a look at this :slight_smile:

Thank you so much for the reply, I think this would be useful for a lot of my textures!

What I was wondering tho, is if there is a way to do this for a texture with the objects UVs. For instance, an unwrapped rock that has math textures on it, and you want to just get the end result color map from it. When looking at this, what I’m seeing mainly is just a projected shader on a plane.

Yes it should work, it may look like a rock when viewing it but we all know its just colors wrapped
to a plane :wink:
I’l be honest i have not used render targets to bake textures myself, mostly for runtime generational stuff but i have seen people use it. so i suggest to just dive in and try it out.

I tried it out, but it doesn’t work for my purposes. I tried it with a normal type of material shader, and it works. The issue is that the material I am trying to use needs to reference its static object, because it doesn’t use an actual color map inside of it. It is using the bounding-box, and object space to add effects to it.

I tried to reference the object, and get the material from the referenced object, but that doesn’t seem to result in anything either.

Hmm…
I’l do some testing today.
Get back to you when i have taken a look.
//
Alright i have taken a look and you are right.
Anything having to do with world position etc is not having any effect. Now i did look through documentation and stumbled upon the “render to texture blueprint toolset”.
That does seem to have a “render an unwrapped static mesh material to textures” option.
Sadly its more complicated then just baking to a render target. But it might be what you were looking for.
Hope this helps :slight_smile: