Search Unity

Total Baker - Texture Baking System

Discussion in 'Assets and Asset Store' started by fra3point, Aug 21, 2018.

  1. grejtoth

    grejtoth

    Joined:
    Aug 7, 2015
    Posts:
    10
    I'm actually interested in this approach! Currently I'm working on a cylindrical projection shader (for body painting) and my next step is to bake this decals in a Texture using the character uvs. Is this similar to the algorithm that you used on the car project?
     
  2. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    I didn't use any cylindrical projection. I basically used another camera which rendered objects in a certain position so that they covered the model's UV Map. This camera had a render target so that I could later convert it into a Texture2D and encode it as a JPG/PNG file.
     
  3. grejtoth

    grejtoth

    Joined:
    Aug 7, 2015
    Posts:
    10
    Thanks for the reply!

    Oh I see! But in my case I need to warp the texture around the character (
    like the tattoos on this video) so I need the cylinder projection there (a planar one would cut the texture) think that your approach would still work in this case?
     
  4. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    Now I do understand why you use cylindrical projection. So no, the uv-based approach would not work in this case.
     
  5. grejtoth

    grejtoth

    Joined:
    Aug 7, 2015
    Posts:
    10

    Yeah ):

    But what about TB? Do you think its viable for me?

    Thanks!
     
  6. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    No, Total Baker is not meant to work in realtime. It works in the old classic way. :(
     
  7. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    @fherbst Here the first comparison between xNormal and Total Baker. Here I've baked Normals and AO. Since the two bakers have different parameters I couldn't reproduce the same exact results. But I think that with minor tweaking it is possible to get very similar results.

    As you may notice looking at the following image, Total Baker has been more precise with Normal Maps. In fact, xNormal created some artifacts on the bottom-left part of the head while Total Baker didn't. Total Baker gives you a realtime visual feedback on your automatically generated cage, so you can instantly enlarge it if some highpoly polygons aren't inside of it, drastically reducing errors like this.

    upload_2019-10-19_22-59-2.png


    The AO I've baked intentionally uses a low amount of rays (30). In this way the imperfections are more visible. You can see some ray spread differences, that's because I've probably used different values. If you look at the hi-res images, you will notice that xNormal's texture has banding while Total Baker's one doesn't (thanks to bilateral blur). Total Baker took about 150 seconds on my machine to bake this map while xNormal took only 74 seconds (CUDA power!), but with Total Baker I could do minor post-processing (bilateral blur, contrast, brightness) in no time and within the same baking window, which saves a lot of time!

    upload_2019-10-19_22-59-35.png


    And this is the final result:

    upload_2019-10-19_23-5-11.png


    As you can see, the quality is almost the same.

    Here, you can find the high-resolution textures: LINK
    And here you can download a unitypackage containing some models: LINK

    The model I used for this bake is called "baronesse". Drag in your scene the model "baronesse_low" and apply textures to it to see the differences by yourself.

    I hope this test is valuable for you. I'll try to make a test with Blender in the next days.

    Cheers,
    Francesco
     

    Attached Files:

  8. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    914
    Hi there!

    I've been following Total baker for quite a while now and it really packs some unique features!
    I know it's not an UV/Unwrapping tool, but would be cool to be able to do some basic UV projections right inside Unity (eg: planar, box, box+ local triplanar, sphere, cylinder). Which also would mean some way to save the generated UVs (FBX?) as well.

    Just a wish, that could easily be another tool :)

    I am curious to know:

    Code (CSharp):
    1. Supported maps:
    2.     Diffuse
    3.     Height
    4.     Normal (3 modes)
    5.     Metallic
    6.     Ambient Occlusion (2 modes)
    7.     Emissive
    8.  
    Is there any chance of Thickness and Curvature being added in the near feature? That would be really useful to use along SSS shaders. Baking a dirt map directly (using AO as a base and mixing some noise to make it feel a bit less regular), and a wear map on the edges (using curvature as a base and mixing some noise to simulate erosion) would be a boon!
    Eg: simulating rust, dirt, etc. to apply on specularity or metalness, or used as a mask to blend 2 materials - metal and rust, for instance.
    Contrast/Power/luminosity control on the extra noise maps would be also great to have :)

    Another much needed feature could be: fake bevel. That is, faking a bevel by using a Normal map.

    Just my 2 cents. I'm not a 3D artist but I'm seriously considering purchasing, as it would address some basic needs when going full indie :)
     
    fra3point likes this.
  9. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    Hello, thanks for you interest in Total Baker!

    Let's proceed step by step:
    As you said, this could (and should) be another tool. This isn't something I've ever planned to add to Total Baker, but it would make sense to have some basic unwrapper tool shipped with Total Baker. For the moment I can't work on this, but I'll put it on my R&D list.


    Curvature maps are currently in the to-do list but, like all the other currently non-supported maps, I can't add support for them in a near future because of 3 factors:

    1) My full-time job blows my time away like a damn turbocharger
    2) Non natively supported maps are harder to test in Unity. Taking curvature maps as an example, I should know if users want to use monochrome curvature or red/green curvature/convexity textures or both, and I would need some custom shaders to test the generated textures.
    3) Each map requires a lot of research, study and development efforts, so it will require a lot of time.

    Edit: it seems it's possible to easily extract curvature maps from tangent space normal maps, which can be already generated by Total Baker. So I guess that in order to create curvature maps I just have to add another shader-based computation after normal map generation.

    Same thing for the thickness maps.

    You're wondering about some non-standard maps and mixing techinques that require an ad-hoc use case analysis. Maybe I can add curvature and thickness maps support, but all the other mixing are a bit out-of-scope. I think you need a texture mixing tool, which is basically a custom shader that outputs its result onto a render texture to be later saved as a .png file. This wouldn't be hard to do for me, but it is something too custom. I hope you can understand.

    This could be one of the tools shipped with Total Baker. As of now, the only solution I know for Unity is this one: https://assetstore.unity.com/packages/tools/modeling/bevel-baker-100730.


    I hope I was clear enough. if you have other thoughts about Total Baker, feel free to share them!

    Francesco
     
    Last edited: Oct 20, 2019
    NeatWolf likes this.
  10. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    778
    Feedback time!

    - minor annoycance: instead of changing texture import settings (which can take forever and is undesirable for building), would be better to Blit into temporary textures and use those for baking if source is not readable.
    191104-123210.png

    - bug: TotalBaker does not take model transform into account
    I have two models that, when dragged directly into the scene, overlap perfectly (highpoly and lowpoly), but when dragging them into TotalBakers "lowpoly/highpoly" slots they get randomly transformed around and don't match anymore at all.
    upload_2019-11-4_12-47-35.png
    This is a real pain since now I have to actually change the models so TotalBaker likes them (as said, they already overlap perfectly if the transforms in the file are properly applied. The pivot of the lowpoly model was changed but the transforms in the file directly make the models match).
    upload_2019-11-4_12-50-21.png
    Note that this wouldn't be an issue if I was just able to directly choose two transforms from the scene.
    Also note that while wrapping both objects in empty transforms and creating Prefabs out of those fixes the position + scale issue, but now the cage is wrongly transform with respect to the models.
    upload_2019-11-4_13-5-26.png
    bug: It seems the cage is generated with correct scale from the submeshes of the lowpoly object, but not transformed into world space properly, and then positioned at the pivot of the highpoly mesh (?)

    - Crazy things happen when trying to work in the scene while the TotalBaker window is open (enabling scene content and then doing things such as creating Prefabs). Weird prefab bugs etc.. Closing TotalBaker window destroys changes that have happened since opening it (some), presumably because you try to somehow re-create state (?). I think it would be better if TotalBaker would operate on a "Prefab Stage" - e.g. create a prefab with the low- and highpoly model and then go into isolation mode, instead of messing with the scene.

    - minor annoyance: scene view camera position is reset whenever I press on "Update models in scene"

    - I couldn't test further since I wasn't able to quickly auto-generate a cage and the whole point of this workflow is to avoid manually creating one. So, unfortunately I didn't get to the point where I was able to bake.
     
    fra3point likes this.
  11. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    Hello, there! Thank you for this important feedbacks.

    This is a really good idea, I'll put in the to-do list.

    The objects placement in the scene re-positions the objects so that:

    1) the low-poly and the high-poly objects stand next to each other.
    2) the highpoly object lies into a 1x1x1 cube with origin in (0,0,0) - due to computation issues
    3) the cage envelops the high-poly object

    If the objects are modelled with same size, they should be placed correctly. Maybe we could talk about this privately after I test your files in order to better understand the problem and find a possible solution.

    This is almost the same problem described before.

    In order to create a clean "Preview scene", once opened Total Baker creates a game object in which it puts all the objects in scene, and disables it. Then, it creates all the TB_xxx instances. When you close the TB Window, the system restores the objects and destroys the created ones. Every change you make on the instantiated objects is temporary by design. I do understand this is not the best solution and the prefab mode would be better. I'll investigate this, thanks for the good idea!

    Correct.

    Sorry for that! I'll try to make things work for you ASAP. I'll test your files and I'll contact you in case I have questions. Thanks for your patience,

    Francesco
     
    danilonishimura likes this.
  12. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    Hello everyone!

    I'm working a lot to improve Total Baker in these days.
    Thanks to your feedbacks I've found that the current version has some issues with cage positioning, memory leaks and other minor things.

    A new version is coming soon, and it will contain a lot of changes and improvements. So if you're experiencing issues with the current version, they should disappear in the next release. You can expect the following changes:

    • Configurations are now ScriptableObjects (before they were just a json string). This allows to save direct references to input models without worrying about their path in the project. The Load/Save workflow will be very similar as the old one, but the main interface has changed a bit.

      upload_2019-12-8_19-42-25.png
    • The Baking Scene is now a dedicated temporary scene. When you open Total Baker, the system collects all the currently open scenes, opens the temporary scene and restores the originally opened scenes once you close the window. If one or more scenes are dirty when you open Total Baker, you get a dialog asking to save those scenes.

    • It's possible to bake a model's lit appearance to texture. For example, if you have an object with diffuse and normal map, and you put some lights around it, you can bake its surface colors into a texture to be used on the same model in an unlit context. This can be done by putting the same model in both lowpoly and highpoly slots and selecting "bake lights". The process is very similar to the classic Highpoly to Lowpoly baking, but in this case it's not necessary to have a highpoly model. Depending on your needs you can choose how to bake.

      upload_2019-11-27_18-32-51.png

      upload_2019-11-27_18-32-6.png

    • Added a "mesh binding" system. This will be very useful to avoid rays touching undesired regions of the model. Basically, if your cage and highpoly models have multiple meshes, you can select which highpoly meshes can be touched by rays coming out by each cage mesh. In the screenshot you can see the binding area which is located under the cage settings. Also, in the baking scene, the selected cage mesh will be highlighted in yellow and all the highpoly meshes bound to it will be highlighted in red.

      upload_2019-11-27_19-0-9.png
      Model by @fherbst
      Since I'm using this model to test and develop the mesh bindings feature, I only have this screenshot and that's why I posted it. I can remove this image if the author wants.

    • In addition to the mesh binding system, it's possible to add custom "blocker objects" in scene. Each intersection between a ray an object with the Default layer will be treated as a miss.

    • Better dilation control. Added "Opaque" and "Alpha Mask" modes. Opaque mode works as usual dilating pixels over transparent areas, while Alpha Mask will re-apply the original alpha channel so that only the RGB channels are dilated. This is useful when dealing with transparent textures.

    • Added channels (RGBA | RGB | R | G | B | A) toggles for the preview textures. These will be above the preview texture, while the map selectors will be on the bottom.


    • Added control for preview materials blend mode:

      upload_2019-12-8_22-43-14.png

    • Fixed some memory leaks which caused very high memory usage.

    • Full Undo/Redo support

    • When baking lights, you can now choose whether to use custom ambient color or the one in the Render Settings

    • Renamed normals detections mode from "Height Map", "Geometry", "Interpolation" to "Height Map", "Surface flat", "Surface smooth" (default)

    • "Unlocked" the 4096x4096 resolution. A minimum requirement for 4k baking is 8GB of RAM (actually less, but with 8GB you are safe).

    • Removed the "save auto-generated cage mesh" button. This is due to the fact that this function worked with single mesh cages only, but now the system supports multi-mesh cages. I'll restore the button in a future release.

    • Fixed wrong cage positioning when input models scales are different

    • Fixed smoothed normals detection when using rotated meshes in the highpoly object

    • Added max ray length control

    • Compatible with Unity 2019.3

    • Other minor fixes and performance improvements
    Francesco
     
    Last edited: Dec 12, 2019
    sjm-tech, ChinChiaYeh and fherbst like this.
  13. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,299
    it would be good to bake vertex colors to an id map, for substance painter.
     
    fra3point likes this.
  14. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    In the features requests I already have something similar: baking vertex colors onto the diffise map. As originally meant the vertex colors would be multiplied by diffuse color. In order to get the result you expect, they would completely overwrite the diffuse color. I immagine an operation selector (multiply|overwrite) in the diffuse map settings right after the "bake vertex colors" checkbox.

    Francesco
     
  15. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,299
    Very nice!
     
    fra3point likes this.
  16. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    UPDATE January, 13 2020

    Total Baker 1.10 has been released!

    Good morning y'all!

    There's a new Total Baker version available in the Asset Store!

    https://assetstore.unity.com/packages/tools/utilities/total-baker-118159

    This release contains A LOT of new features and fixes, so you are strongly recommended to switch to v1.10 if you are using older versions.

    • Configurations are now ScriptableObjects (before they were just a json string). This allows to save direct references to input models without worrying about their path in the project. The Load/Save workflow will be very similar as the old one, but the main interface has changed a bit.
    • The Baking Scene is now a dedicated temporary scene. When you open Total Baker, the system collects all the currently open scenes, opens the temporary scene and restores the originally opened scenes once you close the window. If one or more scenes are dirty when you open Total Baker, you get a dialog asking to save those scenes.
    • It's possible to bake a model's lit appearance to texture. For example, if you have an object with diffuse and normal map, and you put some lights around it, you can bake its surface colors into a texture to be used on the same model in an unlit context. This can be done by putting the same model in both lowpoly and highpoly slots and selecting "bake lights". The process is very similar to the classic Highpoly to Lowpoly baking, but in this case it's not necessary to have a highpoly model. Depending on your needs you can choose how to bake.
    • Added a "mesh binding" system. This will be very useful to avoid rays touching undesired regions of the model. Basically, if your cage and highpoly models have multiple meshes, you can select which highpoly meshes can be touched by rays coming out by each cage mesh. In the screenshot you can see the binding area which is located under the cage settings. Also, in the baking scene, the selected cage mesh will be highlighted in yellow and all the highpoly meshes bound to it will be highlighted in red.
    • In addition to the mesh binding system, it's possible to add custom "blocker objects" in scene. Each intersection between a ray an object with the Default layer will be treated as a miss.
    • Better dilation control. Added "Opaque" and "Alpha Mask" modes. Opaque mode works as usual dilating pixels over transparent areas, while Alpha Mask will re-apply the original alpha channel so that only the RGB channels are dilated. This is useful when dealing with transparent textures.
    • Added channels (RGBA | RGB | R | G | B | A) toggles for the preview textures. These will be above the preview texture, while the map selectors will be on the bottom.
    • Added control for preview materials blend mode.
    • Fixed some memory leaks which caused very high memory usage.
    • Full Undo/Redo support
    • When baking lights, you can now choose whether to use custom ambient color or the one in the Render Settings
    • Renamed normals detections mode from "Height Map", "Geometry", "Interpolation" to "Height Map", "Surface flat", "Surface smooth" (default)
    • "Unlocked" the 4096x4096 resolution. A minimum requirement for 4k baking is 8GB of RAM (actually less, but with 8GB you are safe).
    • Removed the "save auto-generated cage mesh" button. This is due to the fact that this function worked with single mesh cages only, but now the system supports multi-mesh cages. I'll restore the button in a future release.
    • Fixed wrong cage positioning when input models scales are different
    • Fixed smoothed normals detection when using rotated meshes in the highpoly object
    • Added max ray length control
    • Compatible with Unity 2019.3
    • Other minor fixes and performance improvements

    A new online documentation site is also available here:


    http://threepointsoft.altervista.org/dokuwiki/doku.php?id=get started
     
    Last edited: Jan 13, 2020
    TokyoWarfareProject and sjm-tech like this.
  17. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    Hello everyone!

    I'm selecting the features which will be included in the next major release.

    At the moment, I plan to add the following features:
    • Curvature (convexity) map support. Still unsure which is the best color configuration: grayscale, red/green or both.

      This kind of map will be very useful to create effects like dirt accumulation, rust edges, etc. in custom shaders.
    • Primitives support. This may seem obvious, but it isn't. Built-in primitives are special meshes which can't be manipulated. For this reason if you use such meshes as part of your highpoly prefabs (rare but possible), Total Baker will throw an error. My idea is to detect primitives usages and swap them with custom ones, all in a completely automatic way.
    • Vertex colors support. These colors will be blended with the Diffuse Map. To maximize flexibility, I'll add an operation selector (Overwrite | Multiply).
    • Re-integration of Gaussian blur filter. Switching from gaussian to bilateral blur was a good move, but completely removing gaussian blur wasn't. Actually, they are very different blurs. Let's say Bilateral blur is more a denoiser than a real blur. In the next release you will have two separated filters: denoise (bilateral) and blur (gaussian).
    • Dilation tool: will add channels selectors to enable per channel preview as in the main Total Baker window.
    • Center view button to reset scene camera in order to focus on the 3D models.
    Some of these features require some study so I can't estimate a release time. Just know I'm working on them!

    Francesco
     
    Last edited: Jan 26, 2020
  18. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    Good morning,

    for those who are experiencing missing icons in the main Total Baker window, please re-download the package from the Asset Store, I've just published a little fix for v1.10.

    Francesco
     
  19. Diego_Graphics

    Diego_Graphics

    Joined:
    Nov 3, 2014
    Posts:
    147
    Wow in combination with Pro Builder and amplify shader you could do great things with it.
    I would be happy if you could add a quick back button to pro builder.

    so you build a room or something with pro builder and then press the quick bake button and it immediately baked AO and Curvature for the selected object. if these would be immediately applied to a given texture channel on the material used ( e.g. _BakedAO, _BakedCurvature ) then you could use the whole thing to get great results when designing levels and texturing with dynamic materials
     
  20. vanLiere

    vanLiere

    Joined:
    Jul 11, 2017
    Posts:
    7
    Is it possible to bake lighting onto the diffuse texture without the need of highpoly mesh? (Like 3ds max vray render to texture)
     
  21. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    @Diego_Graphics in order to bake AO or Curvature (future feature) you will need a highpoly and a lowpoly model. Actually it could be possible to use the same model in both lowpoly and highpoly slots to get a kind of self-baking, but results aren't the same. This tool is not currently compatibile with other assets like ProBuilder.

    @vanLiere it is possible to bake lighting on a model without a highpoly model by using it in both lowpoly and highpoly slots. Please note the lighting system will bake lights and shades but not shadows. It is possible to bake lighting with an existing normal map, too.
     
    Last edited: Feb 29, 2020
  22. Pourya-MDP

    Pourya-MDP

    Joined:
    May 18, 2017
    Posts:
    121
    Hi there
    And thanks for the big tool
    One question befor get my hands dirty and buy this
    Does this tool provide custom shader support?
    I'll give a link



    Its from 28:00 (time)

    I want to know does this tool support baking this kind of things into one texture?
    Thanks for your time
     
    fra3point likes this.
  23. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    Hello!

    Thanks for asking this question, I'll use it to make a deep dive into Total Baker's implementation so that other users could know more about it.


    Short answer:

    Unfortunately, Total Baker doesn't support custom shaders.

    Long answer:

    Supporting custom shaders is a very hard task, probably the biggest challenge for me. Sincerely, I don't think I'll ever be able to do it.

    The reason behind this is that each shader has a different behaviour, and the system can't predict how users will implement their custom shaders. The currently supported Standard Shader has well known properties and maps, so I could write the core system based on them.
    Total Baker bakes textures using a raycast-based point-to-point surface analysis between a lowpoly model and a highpoly model, and retrieves information about each highpoly hit point (distance, vertex color, texture pixel, etc.). For each map type, property or fragment function, there's a specific function which retrieves the needed data from the hit point.

    Some examples:

    - Normal map -> surface normal vector on the hit point
    - Diffuse map -> surface's material color * hit point's texture pixel color
    - Height map -> distance between ray's source and hit point

    But what about a custom shader? Let's suppose your custom shader uses 2 textures, grass and snow and overlays the snow texture over the grass texture. To combine them in Total Baker in the desired way, I would create an overlay function like this:

    - Combined Diffuse -> Overlay(hit point's grass texture pixel color, hit point's snow texture pixel color)

    And what if your custom shaders overlays 3 textures (stones, grass, snow)? I would implement a different Overlay function which uses three textures instead of only 2.

    And what if the shader uses an alpha mask to create some fancy effects? Well, as you may have understood I would create another function which takes care of all the additional things.

    That's the real problem. I would have to write a function for each custom thing. And that is simply not possible. A solution could be creating a kind of node editor to let the users create their own custom baking functions, but this would require rewriting the entire core (very hard task!).



    I hope this clarifies why, 2 years after the first release, Total Baker still doesn't support custom shaders.


    Have a nice day,
    Francesco
     
    Last edited: Jun 19, 2020
  24. Pourya-MDP

    Pourya-MDP

    Joined:
    May 18, 2017
    Posts:
    121
    Hi and so much thanks for crystal clear answer
    And good luck on asset
    I hope one day you could do the node based editor
    Have a nice time sir
     
    fra3point likes this.
  25. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    Hello, I hope everyone is safe and healthy!

    While I am working on Total Baker v1.11, I'm also thinking on how to improve usability and compatibility.
    A lot of you sent me emails to ask for help during the first bake attempt. And this is great, because I could figure out the problems most users have when using Total Baker.

    The main goal I had in mind when I started the development of this tool was simplicity. I wanted to create a tool able to bake maps with just a few clicks, without the need to configure much things. And for me, as the most experienced user possible, this goal has been reached. But what about users that have never seen Total Baker before and want to do their first bake?

    Here's a list of the most common issues/difficulties (bugs are excluded from the list), and a comment for each one:

    1. Users which aren't experienced in 3D modeling and baking can find the workflow difficult.
    Magic doesn't exist. Every software, tool or framework in this world requires some base knowledge in order to be used. Total Baker doesn't make any difference, as a minimum knowledge of 3D modeling and baking is required to work with it. Even if the tool tries to make the input models compatible with baking, some of their features (size, pivot, vertex colors, uvs) must be created in the 3D modeling software. That's also why, in general, baking textures for random models downloaded from the internet is a bad idea.
    2. UV mapping isn't something everyone knows.
    As just mentioned in the previous point, it is important that models used for baking come with some specific features. The most important one is the UV Map. It is mandatory for the lowpoly model (and the cage if it is a custom mesh) and optional for the highpoly model. A good UV Map, without overlapping or stretched faces, can make the tool produce better textures. If you have never heard about UV Mapping, take a look at these useful links:
    https://www.creativebloq.com/features/uv-mapping-for-beginners
    https://en.wikipedia.org/wiki/UV_mapping
    3. A lot of users use custom shaders with custom maps and would like to bake them.
    The problem here is the way Total Baker bakes the textures. The main algorithm is raycast-based, so for each ray cast from the cage surface to the highpoly surface it has to determine which indormation to retrive and how to use it to write the output pixel.
    Let's make an example: metallic maps for the Standard Shader.
    Metallic maps encode the metallic value in the red channel and the smoothess value in the alpha channel. The Standard Shader uses these textures to compute the surface colors basing on lights, reflection probes, etc.
    By knowing this, I could write a specific function that, for each ray, retrieves the hit material and writes in the output pixel the metallic and smoothness values ofthat material in the R and A channels, respectively.
    But what about a custom shader? A custom shader can be literally anything. It could use different textures, compute their pixels in different ways, and output an infinite number of combinations. How can I write a function to support all of them? Simple: I can't.
    The only robust solution would be to create a sort of visual/node baking algorithm editor, with which users could create their own baking rules for custom maps and shaders. As you may imagine, such task would require a tremendous effort, and probably the result wouldn't worth it.​

    4. The highpoly/lowpoly/cage concept is hard to understand at the beginning.

    This concept is the core of texture baking.
    I suggest reading the section About texture baking of the user manual for a detailed explanation.​

    5. The user manual does not cover all the little secrets of the baking art.

    Believe me or not, writing the the user manual for Total Baker was one of the hardest challenges I had to face for this project. It may miss some minor topics, but I update it at every release, so I hope to add new stuff in the future. There are a lot of different baking techniques and it's very hard to cover all of them. This said, I still suggest new users to carefully read ALL the user manual, as it contains almost all the information needed to bake with success (pay attention to the red and yellow notes!).
    I plan to make some more tutorials in the future, as well as a detailed F.A.Q. section.​

    6. Texture baking is often confused with lightmapping, and Total Baker is often confused with a lightmapper.

    First, let me say that I'm aware that the name "Total Baker" could be misleading, but it's just a name!
    One of the most common questions is: "How can I bake shadows with Total Baker?".
    Unfortunately, the answer is and will be "You can't".
    With the version 1.4, which introduced lights baking, this misunderstanding has grown a lot.
    I can't do anything more than quoting the user manual: "Total Baker transfers details from highpoly to lowpoly models by creating texture maps. The light baking doesn’t make any difference, as its result is stored into the diffuse map. The idea is that a lowpoly model with an unlit material should look like an enlighten highpoly model with a (legacy) diffuse material. This is because Total Baker's lighting model is very similar to Unity's Legacy one. The lights baking system does not bake shadows, only lights and shades."
    7. Some want to bake at runtime, and get confused when they find that Total Baker works in editor only.
    There are multiple reasons why I decided to develop Total Baker as an Editor extension rather than a runtime API. First of all, I wanted to create a tool and not a tools generator, so that's a design choice. Then, to offer the best user experience possible, I took advantage of some editor features such as the EditorGUI controls, the ability to access the ModelImporter class of the models to change their smoothing angle, the AssetDatabase and other things unavailable outside the editor.


    I hope these comments will help new users to clarify some concepts. Please, let me know if you have other doubts and feel free to contact me at the support email for any information, feedback or issue.


    Have a nice weekend,
    Francesco
     
  26. drugges

    drugges

    Joined:
    Dec 28, 2018
    Posts:
    42
    Does it work with Universal Render Pipeline?
     
  27. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    Hello,

    The generated textures can be used in all render pipelines (they're just jpg or png files), but in order to bake them you need to use the standard render pipeline.
     
  28. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    Hello!

    A lot of you asked me if Total Baker can be used for HDRP and URP projects. The short answer is "No", but even if I can't make it work with these pipelines at the moment, I'm trying to make its outputs compatible with them.

    As of now, the generated textures work fine in URP since URP's Lit Shader uses the same maps as the Standard Shader.

    However, HDRP's Lit Shader uses a channel packed texture to manage metallic, smoothness and AO (called Mask Map) encoded in this way:

    upload_2020-6-20_0-20-7.png

    I'm adding support for this kind of map in the next release of Total Baker.
    Basically, if you will select "Mask Map" in the maps panel, the system will force the creation of Metallic Map and AO Map, and then will pack the Mask Map by mixing their channels:

    upload_2020-6-20_0-15-24.png


    I really hope this will help HDRP users!


    Francesco
     
    Last edited: Jun 23, 2020
  29. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    UPDATE June, 30 2020

    Total Baker 1.11 has been released!

    There's a new Total Baker version available in the Asset Store!

    https://assetstore.unity.com/packages/tools/utilities/total-baker-118159


    In this release I focused on the implementation of some of the most required features like curvature maps support, vertex colors and a first glimpse into HDRP compatibility (mask map support).

    • Curvature map support (single and dual channel modes)
    • Primitives support
    • Vertex colors support
    • Re-integrated Gaussian blur filter where needed
    • Added channel selectors to the Dilation tool
    • Center view button added
    • Save texture button added near each texture preview
    • Mask Map (for HDRP Lit Shader) support
    • Bug fixes
    • Improved stability
    • Added Model2Curvature tool
    • Unity 2019.4 LTS compatible
    • FAQ section added to the User Manual



    Francesco
     
  30. TokyoWarfareProject

    TokyoWarfareProject

    Joined:
    Jun 20, 2018
    Posts:
    767
    Hi, I purchased this some months ago, I was gonna bake my first building.... Its only gamma space?! moreover, after 6 years in gamma space I switched to linear few days ago XD.

    Can´t you make this work on linear?

    Switching to gamma requires reimport assets and that takes a lot in a big project (I'm a in a bulky one :\)
     
    fra3point likes this.
  31. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235

    Hello,

    thanks for using Total Baker!

    I'm sorry, but as of now only Gamma space is supported, though I have the Linear space support implementation in the roadmap with "Medium" priority. I suggest you not to use your production project for the bake, but another one in which you can import the baking models only. In this way, you will be able to configure the project to be compatible with the bake and you won't need to reimport everything in your production project.

    Let me know if you have other questions!

    Thanks,
    Francesco
     
    Last edited: Oct 17, 2020
  32. alerbuffon22

    alerbuffon22

    Joined:
    Apr 7, 2020
    Posts:
    7
    Hello great tool! I tried to bake single objects. all perfectly. I planned to use the tool to create proxy meshes for Lods, but unfortunately I will have to continue doing this in the 3d package. The fact is that if I start using models instead of high-poly, prefabs, with nested objects. then after the update all nested geometry breaks. If there is an opportunity to fix this, then I would be very grateful, it greatly simplifies the process of creating a proxy for me
     

    Attached Files:

  33. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    Hello,

    I think you are facing a known limitation with nested prefabs. But please, write an email to 3pointsoft@gmail.com including this comment and the source model(s) if you can. I'll check them to be sure about your issue.

    Thanks,
    Francesco
     
  34. TheRenalicious

    TheRenalicious

    Joined:
    Oct 22, 2014
    Posts:
    2
    Hello,

    First off I want to say that this looks like a great tool! I'm evaluating it right now as a way to reduce drawcalls on high material count LOD0 models, into low cost LOD1s, within Unity. And for the most part it achieves that!

    However, one thing I'm noticing is the inability to use crunch compression on textures during the baking process as Total Baker causes Unity to crash. Is this a known issue? Or something that can be fixed or worked around? I'm working on a project with hundreds of textures, all crunched down, so uncrunching them all back to DXT (or searching for specific textures used by the high poly model) is not ideal and slows down the work flow a lot.

    I've tested this on Unity 2013.4.3, 2019.4.9, and 2020.13. Any time I have a crunched texture on the high poly model Unity crashes.

    Thank you!
     
  35. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    Hello,

    thanks for using Total Baker!

    The issue you have reported is definitely a bug, and I'll investigate on it ASAP.

    Francesco

    EDIT:

    I've just found the issue! The problem is that the function GetPixel() only works with a few texture formats, and as you may imagine, the Crunched DXT format isn't supported.
    I'm working on a solution to "copy" all the crunched textures in some temporary textures with compatible format.

    This can be done in many ways, but for now I succeded with these 2 methods:

    This little hack should allow the system to bake your crunched textures without any problem.

    I'm planning to add this fix in the next release, but since that release will contain major core refactoring (read: "it may take a lot of time to be released"), I'll try to make a patch release with just this thing.

    Regards,
    Francesco
     
    Last edited: Sep 2, 2020
  36. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    UPDATE October, 6 2020

    Total Baker 1.12 has been released!

    There's a new Total Baker version available in the Asset Store!

    https://assetstore.unity.com/packages/tools/utilities/total-baker-118159


    This release adds crunch compressed textures support, which in some cases caused the Editor crash and in any case couldn't be read by the baking process.


    Francesco
     
  37. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    Hello, everyone!

    Just a little update on the development of Total Baker.

    Right now I'm working on a major code refactoring in order to make the system more stable and extensible. This process will also "unlock" the doors for some requested features like Linear color space support, URP/HDRP pipelines support, Thickness map & Bent normal maps baking, etc.

    The linear space support is almost done and currently under testing, all the rest is still in the to-do list.

    I'll probably release a last 1.x version with just linear color space support and refactored classes before moving on the 2.x cycle.

    I'll post a new update when I'll start the development of Total Baker 2.0 with some of the new features.


    Cheers,
    Francesco
     
    hippocoder, sjm-tech, salex1 and 2 others like this.
  38. TokyoWarfareProject

    TokyoWarfareProject

    Joined:
    Jun 20, 2018
    Posts:
    767
    tx for the linear support, I'll benefit from it
     
    fra3point likes this.
  39. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    28,008
    Hello!

    I love the look of this. I have some particular requirements though and I hope that you can help me out.

    1. I work with URP and custom pipelines. I will not be switching pipelines, even temporarily. I only need a high to low normal map bake with low poly model (classic stuff) no need for anything else. Will this work fine without me having to switch pipelines?

    2. I need to be able to fully initiate a bake from high to low poly with new normal map via my own code with my own progress bars, to fully streamline my processes. I already do exactly this with simplygon but it's wise to have a plan B. Can I call all your stuff from my editor scripts?

    3. I like the sound of your dilate functions. Currently I prepare many textures: normals, albedo, packed channels etc as part of my own custom texture painter. Can I use your dilate functions with my meshes and textures? Ideally for seam removal (the devil itself).

    4. Can I specify which parts of the model, perhaps by vertex colour or other, where I need to adjust more or less polygons, for example for deformation, it might be better to have 1.5x more polys around joints.

    5. Can I specify an exact triangle count? Such as 2000 for this, 500 for that. Because often it's not about lod but about budgets of final optimised objects, so a % or screen size won't fly.

    6. Do you do UV maps or do I calculate those myself?


    I can understand how strong that list is above, it's quite a lot to ask for from such a well priced asset! But it still would be great to know.

    Thanks!
     
    fra3point likes this.
  40. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    Hello, thanks for your interest in Total Baker.

    In brief, I don't think you will be able to integrate this tool in your workflow as of now.
    But let me answer to all your points in the list:

    1. URP (and probably HDRP) will be supported in the first release of v2.x, I'm still working on the last features that will close the v1.x cycle, so I wouldn't expect the URP support coming very soon. Fortunately, is one of the priorities for v2.0.

    2. Total Baker isn't meant to be used from code. It would require a complete rework and it would take years...

    3. The dilate function can be used alone without any problems. I also created a dedicated editor window with realtime preview which eases the dilation of textures.

    4. Total Baker doesn't simplify highpoly models. You have to create and then use them as input. Ther only auto-generated object can be the cage, which can be derived from the lowpoly model (by inflating it by a certain amount). I have such feature in my to-do list, and I'm looking for a way to integrate this system, but I'm not happy about the average result I obtained so far.

    5. Same as 4.

    6. Models must be UV mapped externally, so you have to do it by yourself.
     
    Last edited: Feb 11, 2021
    hippocoder likes this.
  41. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    900
    Cool Curvature ! just one thinks the hight poly must be imported in unity asset ?
     
    fra3point likes this.
  42. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    Thanks!

    Yes, Total Baker is an editor tool and all input models, including the highpoly one, have to be imported as assets (.fbx, .3ds, .obj, etc.)
    In the next version also mesh assets (.asset) will be supported.
     
    Last edited: Mar 5, 2021
  43. OneOfMany_07

    OneOfMany_07

    Joined:
    Feb 27, 2016
    Posts:
    15
  44. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    Hello,

    if the planets are generated using custom shaders it won't be possibile to bake them.
     
  45. OneOfMany_07

    OneOfMany_07

    Joined:
    Feb 27, 2016
    Posts:
    15
    Gotchya, thanks.
     
  46. Artini

    Artini

    Joined:
    Jan 29, 2016
    Posts:
    87
    Any news about supporting linear color space?
     
    hopeful likes this.
  47. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    223
    Hi, I just fixed the URP problem for me, it's a simple hack but if you are using URP it's helpful because you don't need to switch back to Builtin:
    In TotalBaker.cs replace them:

    Code (CSharp):
    1.         private static readonly int _BumpMap = Shader.PropertyToID("_BumpMap");
    2.         private static readonly int _ParallaxMap = Shader.PropertyToID("_ParallaxMap");
    3.         private static readonly int _EmissionMap = Shader.PropertyToID("_EmissionMap");
    4.         private static readonly int _OcclusionMap = Shader.PropertyToID("_OcclusionMap");
    5.         private static readonly int _MetallicGlossMap = Shader.PropertyToID("_MetallicGlossMap");
    6.         private static readonly int _SpecGlossMap = Shader.PropertyToID("_SpecGlossMap");
    7.         private static readonly int _EmissionColor = Shader.PropertyToID("_EmissionColor");
    8.         private static readonly int _FillColor = Shader.PropertyToID("_FillColor");
    9.         private static readonly int _LineColor = Shader.PropertyToID("_LineColor");
    10.         private static readonly int _WireThickness = Shader.PropertyToID("_WireThickness");
    11.         private static readonly int _Smoothness = Shader.PropertyToID("_Smoothness");
    12.         private static readonly int _Metallic = Shader.PropertyToID("_Metallic");
    13.         private static readonly int _SpecColor = Shader.PropertyToID("_SpecColor");
    14.         private static readonly int _Glossiness = Shader.PropertyToID("_Glossiness");
    15.         private static readonly int _GlossMapScale = Shader.PropertyToID("_GlossMapScale");
    16.         private static readonly int _LightsValidation = Shader.PropertyToID("_LightsValidation");
    17.         private static readonly int _LightsTypes = Shader.PropertyToID("_LightsTypes");
    18.         private static readonly int _LightsPositions = Shader.PropertyToID("_LightsPositions");
    19.         private static readonly int _LightsDirections = Shader.PropertyToID("_LightsDirections");
    20.         private static readonly int _LightsColors = Shader.PropertyToID("_LightsColors");
    21.         private static readonly int _LightsIntensities = Shader.PropertyToID("_LightsIntensities");
    22.         private static readonly int _LightsRanges = Shader.PropertyToID("_LightsRanges");
    23.         private static readonly int _LightsOuterCosAngles = Shader.PropertyToID("_LightsOuterCosAngles");
    24.         private static readonly int _LightsInnerCosAngles = Shader.PropertyToID("_LightsInnerCosAngles");
    25.         private static readonly int _LightsCount = Shader.PropertyToID("_LightsCount");
    26.         private static readonly int _AmbientColor = Shader.PropertyToID("_AmbientColor");
    27.         private static readonly int _High2LowWpos = Shader.PropertyToID("_High2LowWpos");
    28.         private static readonly int _High2LowNormal = Shader.PropertyToID("_High2LowNormal");
    29.         private static readonly int _WorldNormalMap = Shader.PropertyToID("_WorldNormalMap");
    30.         private static readonly int _Density = Shader.PropertyToID("_Density");
    31.         private static readonly int _Color1 = Shader.PropertyToID("_Color1");
    32.         private static readonly int _Color2 = Shader.PropertyToID("_Color2");
    33.         private static readonly int _LayerMask = Shader.PropertyToID("_LayerMask");
    34.         private static readonly int _Color = Shader.PropertyToID("_BaseColor");
    35.         private static readonly int _Cutoff = Shader.PropertyToID("_Cutoff");
    36.         private static readonly int _GlossyReflections = Shader.PropertyToID("_GlossyReflections");
    37.         private static readonly int _TangentNormalMap = Shader.PropertyToID("_TangentNormalMap");
    38.         private static readonly int _MainTex = Shader.PropertyToID("_BaseMap");
    39.  
    And in Filters.cs this:

    Code (CSharp):
    1.             shader_StandardMetallic = GetShaderIfExists("Universal Render Pipeline/Lit");
    2.  
    I now, this is just a silly hack but it works when you use "StandardMetallic" in the selection tab, I hope the dev will soon add the URP shader because it's very simple. But it looks like there are no more updates coming...?
     
  48. GameHourStudio

    GameHourStudio

    Joined:
    Apr 17, 2020
    Posts:
    109
    Hi, I have a forest scene. A big terrain with a lot of trees and grass drawn using terrain editor. Now when I use directional light with SHADOWS ON, the verts count go upto 2 Million. and when I Turn Shadows off, the verts count drops to 400k. So I want to get rid of directional lighting for shadows and litting environment. I want to bake shadows and lighting right into main texture. Even the shadows casted on terrain. I want this for all the static elements of my scene so that I can exclude the static objects from the lighting
     
  49. GameHourStudio

    GameHourStudio

    Joined:
    Apr 17, 2020
    Posts:
    109
    I just read on some other forum it would not be great idea to bake lighting directly into albedo textures because albedo textures are meant to be reused for many prefabs at many different places where lighting condition varies from position to position so it is not possible to reuse the baked albedo+lighting for many positions. Still I would like to know your opinion on such work arround where lighting and shadows are the culptiy for the environment.
     
  50. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    235
    Hello you all!

    I'm very sorry to answer this late, I had some urgent issues to solve that didn't allow me to actively work on Total Baker for a while.

    A new version (2.0) is almost ready. Here's what you will see in it:

    • URP Support
      Universal Render Pipeline is now supported along with the Standard Pipeline.
    • The config files have been replaced by a more robust system based on Unity scenes.
      Until this version, all the settings were stored in config files, and those files could be created, opened and saved from within the Total Baker window. This created some extensibility issues. Now, everything is much simpler: the baking configuration is stored into a component attached to a special object in the Unity scene called "TB_Scene". The Unity scene is itself the baking session which can be created, opened and saved as you are used to.

      upload_2021-9-19_19-38-11.png

    • The input models are no more references to assets in the project (models/prefabs).
      Now input models are references to objects in the scene. Just drag&drop scene objects in the input slots and you're ready to go.

    • Custom positioning
      Now it's possible to position models freely in the scene. The only obvious constraint is that the cage object should always encompass the highpoly object.

    • Input models validation system
      One of the biggest issues users have reported to me is that Total Baker (as many other baking systems) requires the input models to have some precise characteristics. Some examples are:
      • The input model must have a single material
      • The highpoly model must not contain meshes with submeshes (multiple materials on the same mesh)
      • Models must not have missing meshes in their renderers
      • Etc...
      These things created confusion because sometimes the bake failed and the system didn't tell why.
      In the new release I've implemented a validation system that will inform users of model compatibility issues and will prevent the start of the baking process until all the issues have been resolved.
      Basically, once you set a new input object you will have to validate it by clicking on the "validate" button.

      upload_2021-9-19_19-38-26.png

      Please, note that not all the cases will be signaled, but the most common and important ones. The reason is that some checks are too performance-killer to be implemented (i.e. check for overlapping triangles in UV map).
      For some of the supported compatibility issues I've implemented a "Fix" function that will automatically fix the issue, while for others a "To be fixed manually" label will be shown.

      upload_2021-9-19_19-38-40.png

    • Mesh assets (.asset) are now supported
      It's now possible to use input objects which contain .asset meshes.

    • Independent smoothing system
      Input models can now be smoothed on-the-fly without the need to reimport original model assets. This is quite faster.

    • New wireframe system
      Wireframe is no longer geometry shader-based, to extend platform compatibility (should work on Mac, but not tested). The new system is based on SetIndices() line topology.

    • Removed toolbox windows and lighting bake system.
      The new changes made these tools obsolete and hard to reintegrate. Moreover, users' feedback on such tools was quite negative.

    • Linear color space is now supported
      The system automatically detects the current color space and adjusts colors calculations.

    • Multithreaded raycasts
      Raycasts are now multithreaded (RaycastCommands) and should perform a little faster. This has a little memory cost.

    • More verbose progress bar
      Progress bar will give information about the current baking stage.

    • Added zoom and bilinear filtering toggle for texture preview
      Zooming on the preview texture area is a very useful thing to inspect the generated maps. The bilinear filtering toggle lets the user disable bilinear filtering and inspect zoomed pixels without interpolation.

    • Updated samples
      All the sample models will come with a baking scene ready to be used and tested. There will be both Standard and URP materials in the same package.

    I'll submit the new version for review as soon as I finish the tests, update the samples and the online user manual.

    Meanwhile, for those interested in beta-testing the new version, I can privately send a preview package. If you are interested, please DM me including your invoice number.



    Thanks for your patience,
    Francesco
     
    Bagazi, sjm-tech and hopeful like this.
unityunity