Hi,
I am starting developing a new tool - Texture baker
What it does ?
-Specular Bake-
To use a texture in the specular family of shaders you have to add the specular map in the alpha channel of the diffuse map.
Say you have a diffuse map and a specular map. Simply add the maps in their slots and hit a button - ready.
-Specular Extract-
You have some textures that have specular baked in their alpha channel and you want to tweak them.
Add the texture to the slot and hit the button.
-AO Bake-
Put the diffuse map and the ambient occlusion map in their slots, hit button → a diffuse map with baked AO.
-Tint Bake-
Tint a texture by a color.
If you have some ideas - suggestions let me know.
Kind regards
-Ippokratis
Looks like you are a bit of a pioneer Yes that’s how it would work, so it’s easy to author textures but mangle them to fit Unity workflows. A lot of artists would find it easier. It needs to support automatically updating a texture though. For example the source file was changed in photoshop, so the conversion should automatically run again, and the same textures as before should be spit out, as to emulate the Unity hot updating method, since artists do this frequently and tab to Unity to check.
I don’t think they mind a couple seconds delay in updating, you could always make that another option as alternative to update button.
Hi Robert, the script is… Done. 5hrs
( I was thinking that automatic updating should be there anyway, didn’t occur to me that it is a feature )
I 'll try to show some examples next.
Hopefully you will sell it on asset store, it would be useful for current Unity too I think - people often have difficulties with packing things in alpha. I wonder if packing things in normal map alpha channel is also an optimisation, for example less texture read in fragment.
Seems like an advanced user case but interesting nonetheless.
@hippocoder
Well, the alpha in Normal maps can be written - as is - with the Texture Baker.
Someone should write special shaders to make it work though - if you have specific info you need to pack in the shader in mind, let me know in a pm.
To those who wonder, what is a specular map and why should I bake it in alpha ?
-Specular maps define how much light is reflected in each part of a model.
-They come as a black and white texture, either exported directly by the modeling app or made by hand.
-Artists usually create many maps for a model : specular, AO, diffuse, normal and provide them as separate maps for flexibility.
-Shaders that use many maps are expensive, so developers try to pack the textures.
-Unity Specular shaders support specular (or gloss) maps by putting them in the alpha channel.
Ok now suppose that you have a diffuse and a specular map for a given model. Using Texture Baker you just put the diffuse in a slot, the specular in another, hit the Bake button. A dialog appears and asks you where you want to save the texture. You choose a name, press save and it’s done.
Substance outputs all textures in separate files, PBR shaders like what LUX uses need these packed into a single texture… For example a metal mask in the red channel , AO in green , specular in the blue channel and roughness in alpha. Doing this in editor would be far better than flipping to photoshop all the time.
I understand the workflow.
Would you like to send me an example scene so I can try it out ?
A simple model, with the substance textures ( native output ), the modified textures (for use with Lux) ?
Sounds good, so overall we get cheaper materials for rendering (what is overall improvement with that technic VRAM sparing or drawcalls or?). Will this work with any shader overall?
Hi,
The main issue this tool exists is to make it easier to perform some actions that make materials more performant.
It eases the workflow - no flipping to photoshop to use a specular or an ambient occlusion map.
Or, instead of using the tint in the desktop diffuse shader, you can bake the tint in the texture and use the mobile desktop instead.
I am working on a demo using the model coastal gun battery from Mr Necturus.
This is how it looks using the diffuse shader
the model comes with separate specular maps. To make them usable you normally have to export them to photoshop, along with the diffuse, add a channel to the diffuse, copy paste the specular in diffuse alpha, reimport in unity.
With the tool you just put the textures in their slots and press bake.
Sounds great. Along this tool would be cool to have some atlas baking tool too something that would bake multiple textures into single atlas. That would make great combo as it would reduce use of Photoshop for such things.
Another great plugin helper that should be integrated in Unity editor.
Why not making the plugin lot more universal ? with the possibility to map any textures to any channels or to alpha ?
Like you choose the number of source textures then for each you attribute rgb, or rgba , or only one channel (alpha, r,g,b).
This would make the tool lot more universal for any use, people could decide to bake AO, specular, curvatureor any map information they need on any channels.
@zenGarden
Yup, I 've had the same thought after reading @dirtybasett’s post. Someone else besides Lars will develop a clever shader that uses multiple channels of one texture for different maps, like DOTA etc does.
I am thinking about giving another two options :
Composer mode : choose a color or a channel (rgba) from a source texture to be remapped in one channel of the destination texture, for every channel of the destination texture.
Color or R-source1 or G-source1 or B-source1 or A-Source1 to R-Dest
Color or R-source2 or G-source2 or B-source2 or A-Source2 to G-Dest
Color or R-source3 or G-source3 or B-source3 or A-Source3 to B-Dest
Color or R-source4 or G-source4 or B-source4 or A-Source4 to A-Dest
[EDIT]
It is not useful to implement this, since few people will compose textures and fewer will compose textures from composite textures. I opt for making the following instead :
map1 or value1 to R - Dest
map2 or value2 to G - Dest
map3 or value3 to B - Dest
map4 or value4 to A - Dest
[EDIT]
Decomposer mode : Extract one channel of the Source texture to a destination texture
Here is a demonstration of the Ambient occlusion baker.
I used the Cartoon Submachine Gun model from Torry.
Torry includes a diffuse and an ambient occlusion map.
I developed an unlit shader (included in the package) that uses an ambient occlusion texture, multiplied by a ambient occlusion factor. In plain Greek, or English, the ambient occlusion factor accentuates or diminishes the ambient occlusion effect.
Examples :
with ambient occlusion factor = 0
with ambient occlusion factor = 1
with ambient occlusion factor = 3
What is cool is I included an option to recreate this effect in the AO Bake
So, after you decide on the AO factor you like on the shader
you enter the same value on the AO Bake AO factor
and you get the baked texture, ready to be used in a regular Unlit shader
@janpec I love atlases but I wish to keep the price low, around 10$. There are many solutions available that allow you to combine materials, including Batching Tools (an atlas without uv remapping and vertices merge is useless really).