Search Unity

Assets [RELEASED] Total Baker - Texture Baking System

Discussion in 'Works In Progress - Archive' started by fra3point, Apr 19, 2017.

  1. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    269
    Last edited: Aug 25, 2018
  2. scrivvysolutions

    scrivvysolutions

    Joined:
    Oct 14, 2014
    Posts:
    17
    Although this is possible in other apps I really like your integration and it gives the opportunity to really optimise scenes rather than hop back and forth between modelling packages / bakers and Unity. It's simple and looks easy to use. I'm going to keep an eye on this and depending on what you price it at I could be interested in buying - keep up the good work!

    Are the height maps 16 bit?

    Trev
     
  3. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    269
    Hi Trev,

    First, thanks for your feedback! I'm working on this tool to make artists' lives easier, avoiding the use of external softwares!

    For the 16bit (per channel?) height maps, I'm still investigating:

    1) As of now I just encode the generated maps to 8bpc PNG with the built-in function Texture2D.Encode2PNG() before saving them as asset files.
    Once the textures are created I change the import format to RGBA Half (16 bpc). This make the colors quite dark, I think because of the lack of color information of the original encoding (8bpc).
    I made a test with a .exr (16bpc) image, and importing that texture with RGBA Float the colors are good.
    The problem is that I'm using Unity 5.5 and I cannot encode textures to the EXR format.
    It seems that Unity 5.6 has the function Texture2D.EncodeToEXR(), so I should give a try.


    2) The system generates the maps one pixel at a time, and it does this creating arrays of colors to be applied to the textures with the SetPixels() function. This function works only on RGBA32, ARGB32, RGB24 and Alpha8 texture formats, which are 8bpc formats. I'm not sure if the preliminar conversion into these formats lowers the final color precision.

    Any workaround is welcome...
     
  4. scrivvysolutions

    scrivvysolutions

    Joined:
    Oct 14, 2014
    Posts:
    17
    Good to hear - yes, per channel - I've found with 8bpc images you get a nasty stepping / terraced effect. Not sure how you would make the changes to your code to achieve that but it will improve things if you do.

    Trev
     
  5. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    269
    Yeah, that's the terrible color banding. I will do my best to bring 16bpc support to Total Baker, but I can't guarantee!

    Have a nice evening,
    Francesco
     
    scrivvysolutions likes this.
  6. Pode

    Pode

    Joined:
    Nov 13, 2013
    Posts:
    145
    @fra3point : if you can't use the EXR format in your build of Unity, you can still use an image file format that support 16 bit, like TIFF for example. A compatible lib would be that, for example : https://bitmiracle.com/libtiff/
     
    fra3point likes this.
  7. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    269
    I've been able to save textures in the 16 bpc .exr file format with Unity 5.6, so I have one working solution. Anyway, I'll try LibTiff because
    • Some image editors (like GIMP) cannot open .exr files
    • I want to make this system compatible with at least all the 5.x releases
    Thanks for the good suggestion!
     
  8. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    OK, may be this is the kind of operation I would think of doing in 3dmax but your tool loosk rrrrreally cool and funny enough yesterday I was looking at too hi poly buildings XD. May be you should try with not so planar elements such a cube or so, would it work? I mean, bake a full building.
     
    fra3point likes this.
  9. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    269
    Of course it will work also on different kind of models, not only with the "single axis-extruded" ones. Anyway, for buildings with different shapes for each side I would use multiple textures to not loose hi-res details.
    Here's one of my tests on a complex shape. The left model has baked normal+AO maps on it. :D

    upload_2017-5-5_17-47-0.png
     
    Last edited: May 5, 2017
    TooManySugar likes this.
  10. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    269

    UPDATE - MAY 8 2017

    What's new:
    • Ambient occlusion map support
    • Now normal maps can be created in two ways:
      • Surface analysis
      • Conversion from height map
    • Now height maps can be saved in two formats:
      • .png (8 bits per channel)
      • .exr (16 bits per channel)
    • Real time model preview in scene
    • Dilation filter to avoid UV seams issues
    • Improved GUI

    Video (better in fullscreen HD):




     
  11. betalulu

    betalulu

    Joined:
    Apr 9, 2014
    Posts:
    11
    This will be a great tool for making LOD meshes!
    Please add a function to bake final lighting result of the source(realtime or light mapped), so we can use unlit shaders on low poly meshes for better performance.
     
    fra3point likes this.
  12. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    269
    Thanks for the great suggestion! I'll give a try as soon as possible. As of now Total Baker doesn't support light baking and probably the first release won't contain it, but I'll work on this for future releases.

    Cheers,
    Francesco
     
  13. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    269

    UPDATE - SEPTEMBER 10 2017
    Hi! In the past days I've been so busy and after a long break I have some news! :)

    What's new:

    • Improved normals blending for large and small details
    • Added some post processing options for better conversion from height to Normal Map
    • Automatically fix unreadable textures (warning + fix button) on the high-poly model
    • Save Normal Maps with "Mark as Normal Map" option checked.
    • Started working on a texture map toolbox that will contain individually:
      • Advanced Height2Normal converter - DONE
      • Normal Maps combiner - DONE
      • Height Map to Fake AO converter (very fast alternative to baked AO)
      • Blur filter
      • Contrast/Saturation filter
      • Dilation filter
    • Started writing the User Manual
    • Improved GUI

    The Advanced Height2Normal converter allows you to create sharp and clear Normal Maps by post processing the original Height Map before converting it into Tangent Space.

    upload_2017-9-10_23-46-17.png



    With the Normal Map combiner you can merge two Normal Maps without loss of directional information.

    upload_2017-9-10_23-53-17.png



    And, just for fun, here's a 16 polygons facade with Standard Shader maps generated by Total Baker. The textures are 2048 pixels wide:

    upload_2017-9-11_0-11-20.png



     
    Last edited: Sep 11, 2017
    Teila and UnityLighting like this.
  14. Pode

    Pode

    Joined:
    Nov 13, 2013
    Posts:
    145
    @fra3point : your last screenshots are very promissing !
     
    fra3point likes this.
  15. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    269
    Thanks, man!

    In the previous post I forgot to write some performance tables. These are the times that Total Baker and xNormal took to generate almost the same Normal Maps.

    IONIC COLUMN:
    • High-poly's triangles count: 45162
    • Low-poly's triangles count: 430
    • Normal Map resolution: 2048x2048 pixels
    upload_2017-9-11_12-30-45.png


    BUILDING FACADE:

    • High-poly's triangles count: 16517
    • Low-poly's triangles count: 16
    • Normal Map resolution: 2048x2048 pixels
    upload_2017-9-11_12-34-5.png


    In both cases Total Baker was 88% faster than xNormal!
    And please, consider that all these tests ran on a 9 yo machine. I'll do other performance tests at my University with a modern computer as soon as they let me use it. :D
     
    UnityLighting likes this.
  16. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Great work
    even most great work for unity
     
    fra3point likes this.
  17. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    269
    Thanks!
    The system is currently in an optimization state, and the core functionalities are all implemented. I'll release it as soon as it becomes stable enough. :)
     
    TooManySugar and UnityLighting like this.
  18. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Instant Mesh is a software that creates a low poly, clean topology of your hi res model, could be the perfect low poly base to use with this asset.
     
    fra3point likes this.
  19. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    269
    Tanks, I'll give it a try! Have you ever used it?
     
  20. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Not yet, I discovered recently :D
     
    fra3point likes this.
  21. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    269
    UPDATE - 11 DECEMBER 2017

    What's new:
    • Until now the only method Total Baker used to automatically create the cage mesh was a simple translation of each face of the lowpoly's mesh along its normal. Now I added a new method with which is possible to "expand" the whole mesh while keeping the vertices welded. Here's an example of both:
    upload_2017-12-11_15-25-10.png
    • There's a new fast and high-quality AO algorhitm based on a SSAO technique and it will probably replace the old algorhitm, which used 3D physic occlusion computation. I think I'll let the users choose the AO method in the first release.
    • Having a good lowpoly model is very important in order to get good results. The wonderful tool Instant Meshes did a great job even with complex shapes. Thanks to @TooManySugar for the suggestion!
    upload_2017-12-11_15-37-36.png


    • And here's an example of what Total Baker could do with a model generated with Instant Meshes. This is the best result I've ever achieved with a mesh decimation tool in less than 2 minutes.


    upload_2017-12-12_22-38-31.png
     
    Last edited: Dec 13, 2017
  22. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Would love to see some examples that go from maybe 10k to 3k or something like that, which is much more useful for gaming models. I looked all over the internet but could find the tool only on very high polys, like millions, then down to fewer millions....or at least 10s of thousands.

    I love the idea of a fast way to retopologize and it looks very useful. But it is useful for low to medium poly stuff or just very high? We do this by hand with clothing items and go from 50k to 4k. (baking the hi poly normal after of course). That is what I would like to see.
     
    fra3point likes this.
  23. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Oh boy, I was confused...looking at Instant Meshes, not your asset. lol

    Okay, yours looks fabulous and a definite purchase from us. Instant Meshes is not yet impressing me. lol Although, with your tool, maybe it would. :)

    Sorry about that.
     
    Last edited: Dec 12, 2017
    fra3point likes this.
  24. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    269
    Thanks, @Teila ! :D

    Actually, my last example shows a statue I retopo'd with Instant Meshes. The original model has 50k polys and I got good results reducing its polygon count to 700, so it's definitely possible to reduce a 50k model into a 4k one.
     
  25. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    It is possible, but the results will need to be tweaked. My artist is a fast retopologizer and gets good results so I will probably use her instead.

    However, yours will be great for my city. So will be watching. :)
     
    fra3point likes this.
  26. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    269
    TooManySugar likes this.
  27. FelixApplus

    FelixApplus

    Joined:
    Jul 19, 2019
    Posts:
    2
    Hey man super cool baker! How do you sample the color values of each pixel, with a camera or dose one need to use a specific shader for it to work?
     
    fra3point likes this.
  28. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    269
    Hello, thank you!!

    Total Baker has a very complex hybrid CPU-GPU algorithm. The system handles everything automatically for you
    The CPU part is based on surface comparison and this is done by casting one ray per pixel from surface A to surface B. Then, the GPU part speeds up the pixel color retrievement. At the end, a GetPixel on the computed pixel makes sure the system writes the right color in the output texture.

    P. S. This thread is closed, please refer to the official one.

    Francesco
     
    Last edited: Sep 17, 2019