Announcement

Collapse
No announcement yet.

Blender - Mapping and Baking - Primer

Collapse
X
Collapse
First Prev Next Last
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Blender - Mapping and Baking - Primer

    Hi Folks,

    It seems we have a few new modelers using Blender - I would think mapping and baking might be some of the harder steps to come to terms with for someone new to Blender. While I started with Blender about two years ago - I've only been actively modeling for about a year. I have a fairly long history of modeling with 3DC before Blender.

    This is intended as a primer - not a tutorial - so I'll be addressing the concepts at play that need to be considered for Mapping and Baking operations in Blender.

    First - set yourself up for success. Blender is an application that heavily relies on addons - there are thousands of them - I'll only be discussing (3) that I find essential for our task at hand - and are free. I've tried others - another modeler might prefer a different set of addons. Only the last three on my list pertain to mapping and baking operations.


    Blender - Enabled Addons




    I'm using Blender 4.3 and since Blender 4.2 many of the external addons are now available in the [Get Extensions] option under [Preferences]. [Texil Density Checker] is available via [Get Extensions]. [UV Layout] is an official Blender addon available via [Add-ons] option. The last one - [TexTools] is available from GitHub and needs to be installed from file.
    • [Texil Density Checker] - shows up the [N Side Menu] when in the [UV Mapping] window. It allows you to get the texel density of an Island - or - set the texel density of an island. For the best-looking models - you want a consistent texel density - and this makes is extremely easy to set on each island as you map it.
    • [UV Layout] - adds mapping functions to the [Top Menu] in the [UV Mapping] window. Some of the most important features are the ability to export your [UV Map] to a texture file so you can load it into your paint program - and - the [Pack Islands] function to efficiently pack your islands in the most efficient manner possible.
    • [TexTools] - shows up the [N Side Menu] when in the [UV Mapping] window. This adds a host of operations for manipulating your [UV Map] and single click [Baking]. If you've tried the default Blender [Baking] operation - this makes your life infinitely easier.

    TexTools Download:


    TexTools Operational Overview (YouTube):
    A quick look at the Text Tools Addon. Visit my website for links to my assets, addons, the discord, and other useful resources.https://www.pzthree.com/



    Applicable Terms
    • [Texel Density] - refers to the number of texture pixels (texels) per unit of 3D surface area. It's an important concept for ensuring that textures appear consistent and detailed across different parts of a model. Maintaining a consistent texel density is crucial for achieving a uniform look, especially when combining multiple objects in a scene.​
    • [Seams] - are the edges where a 3D model is "cut" or "split" during the unwrapping process. These cuts allow the 3D surface to be laid out flat in 2D space with minimal distortion. [Seams] only work under the following [Unwrap] operations: [Angle Based], [Conformal], and [Minimal Stretch]. [Minimal Stretch] I believe was added in Blender 4.3.
    • [UV Mapping] or [Unwrapping] - is the process of projecting a 2D image texture onto a 3D model's surface. It involves unwrapping the 3D model into a flat 2D plane, much like peeling an orange and laying its skin flat. This allows textures, such as images or patterns, to be precisely applied to the model, ensuring that each part of the texture aligns correctly with the corresponding part of the model's surface.
    • [UV Vertex] or [UV] - is a point in the 2D space of a UV map that corresponds to a vertex on a 3D model. These UV vertices are used to define the position of the texture coordinates, determining how a 2D texture is applied to the surface of the 3D model. Essentially, they serve as the anchors for mapping the texture accurately onto the model's surface, ensuring that the details of the texture align correctly with the geometry of the model.
    • [UV Island] - is a contiguous group of UV vertices and edges that form a separate, unbroken piece of the UV map. It represents a section of the 3D model's surface that has been unwrapped and flattened for texturing purposes. Each [UV Island] typically corresponds to a distinct part of the 3D model, making it easier to apply detailed textures accurately.
    • [Pack Islands] - in [UV mapping] is the process of organizing and arranging [UV Islands] efficiently within the UV space to maximize the use of texture space. You can do this with entire texture sheets or any subset therein. You can define a Margin to set how much space is kept between Islands.
    • [Tiling Texture] - is a small, seamless image or pattern that is repeated, or "tiled," across a surface to create a continuous, uniform appearance. This technique is particularly useful for covering large areas without visible seams or repetitions, like walls, floors, or any large surfaces in 3D environments. By seamlessly repeating the texture, it allows for efficient use of memory and resources, as a single small texture can cover extensive areas without noticeable patterns or disruptions.
    • [Swatches] - I don't think this is an official name - just what I call it. It's using small little swatches of material - that won't have any detail or baking applied - used on small parts, edges, or parts that aren't seen often.
    • [Baking] - refers to the process of capturing detailed lighting, shading, and other surface information, such as ambient occlusion and reflections, and storing it in a texture map. These affects are created with Ray Tracing and add a great deal of "pop" to any model.
    • [Ray Tracing] - is a rendering technique used in computer graphics to simulate the way light interacts with objects in a scene to produce highly realistic images.
    • [Material] - defines how a 3D object's surface interacts with light and gives it its color, texture, and reflective properties. If you change the specular shine on two different objects mapped to a single texture - that will require two [Materials].
    • [Draw Calls] - for our purposes - it's every time we need to load a texture sheet to the video card - which is a resource intensive process - [Draw Calls] significantly impact performance - so you want to minimize them. Each [Material] you use - will - at a minimum - be a single [Draw Call].
    • [Ambient Occlusion] or [AO] - is a shading and rendering technique used to calculate how exposed each point in a scene is to ambient lighting. It simulates the soft shadows and subtle shading that occur in corners, creases, and near intersections of objects, where light is less likely to reach. This effect adds a sense of depth and realism to the scene by enhancing the perception of surface details and contact points between objects.​


    Considerations
    • Keep a uniform texel density - I usually use one texel density for the large parts - body of the model - and a higher texel density for the smaller parts.
    • Unique texture real estate - if you want to apply details or baked textures - you need to ensure no UV Island overlaps another.

    To be continued...

    Regards,
    Scott



    Last edited by scottb613; 12-01-2024, 21:01.
    <a href=https://www.trainsim.com/forums/filedata/fetch?filedataid=80663&type=full title=thumb_80663.png >thumb_80663.png</a>​ My Blender Models

    #2
    I have already learned a few things. This should be a good discussion.

    Comment


      #3
      Originally posted by wacampbell View Post
      I have already learned a few things. This should be a good discussion.
      Hi Wayne,

      Thank you - Sensei...


      Hah - none of this would be possible without your efforts - on every level - many of the people here today never saw your very first release of ORTS.

      Been a while since I did my last tutorial.

      Regards,
      Scott
      <a href=https://www.trainsim.com/forums/filedata/fetch?filedataid=80663&type=full title=thumb_80663.png >thumb_80663.png</a>​ My Blender Models

      Comment


        #4
        I should add this to the Notebook. It's a weak area in my content.
        http://www.railsimstuff.com
        Just Blender now, 3DCrafter only when I have to.
        formerly The Keystone Works (All Permissions Granted)
        https://github.com/pwillard/MSTS-replacement
        sigpic

        Comment


          #5
          Originally posted by pwillard View Post
          I should add this to the Notebook. It's a weak area in my content.
          Hi Pete,

          Feel free - I plan on updating the first post with new information - as I go through more detailed steps - in subsequent posts.

          It's an open discussion - so everyone's insights welcome.

          Regards,
          Scott
          <a href=https://www.trainsim.com/forums/filedata/fetch?filedataid=80663&type=full title=thumb_80663.png >thumb_80663.png</a>​ My Blender Models

          Comment


            #6
            Post 2 (SEAMS UNWRAP):

            I'll be using my RS3 as a reference model. I typically start out with two fairly large texture sheets - one for parts that have a Specular Shine and another for Flat or no shine parts. Typically - the upper painted metal body gets shine - the lower body does not. Some parts don't look good with shine - like handrails - so experiment and see what works best for you. I'll be focusing on the main body of the model for our discussion - as the trucks/bogies are a child - forcing a [Draw Call] - so it makes sense to have a separate texture just for them.

            On the following texture images - a couple things to note:
            • The first two images are of the same flat texture - one with [Ambient Occlusion] and one without. It clearly shows how much you gain by taking the time to [Bake] [AO] into your textures. It's practically required.
            • On the first two images - you can see the [Swatches] I use on various parts of the model - the hinges are probably the most identifiable. Multiple parts overlay each other in these little squares so the [AO] makes a mess of this - if it's included in the [Bake]. In your paint program this is easily addressed by simply placing the [Swatch] layer above your [AO] layer.


            Prime Flat (2048)



            Prime Flat - with Ambient Occlusion (2048)
            Click image for larger version  Name:	Prime-Flat.jpg Views:	4 Size:	71.8 KB ID:	2315868


            Prime Specular Shine (2048)



            SEAMS

            To create a seam - you must be in edit mode - select the desired edges - then [Edge] [Mark Seam].

            Applicable Commands
            • [L] - Select all parts by Texture or Seam - [Edit Mode].
            • [Shft L] Select all parts using same [Material] - [Object Mode].

            Seams Supported Unwraps
            • [Angle Based]
            • [Conformal]
            • [Minimal Stretch]


            Purpose of Seams
            • Unwrapping the Model: Seams allow you to "cut" your 3D model so it can be laid out flat in 2D space, similar to how you might cut and unfold a cardboard box. This process is known as unwrapping.
            • Reducing Distortion: By strategically placing seams, you can reduce the amount of distortion that occurs when the 3D model is flattened. This helps to ensure that textures are applied accurately and without stretching.
            • Isolating UV Islands: Seams help define UV islands, which are separate, contiguous areas of the UV map. These islands can be textured more precisely, making it easier to apply detailed textures to specific parts of the model.
            • Texture Alignment: Well-placed seams help align textures correctly, minimizing visible mismatches and ensuring a seamless appearance on the final model.


            How to Place Seams
            • Strategic Placement: Place seams in less visible areas of the model, such as along edges or in natural creases, to minimize their appearance in the final texture.
            • Testing Unwraps: Experiment with different seam placements and unwraps to find the best configuration that minimizes distortion and maximizes texture quality.
            • Consistency: Ensure that the seams create manageable UV islands that make texturing easier and more efficient.

            Marked Seams in Red



            Select Desired Faces by Seam - Pressing [L] - Faces Must Be Fully Enclosed by Seams for Selection to Work



            Conformal Unwrap



            Results in (3) Perfectly Unwrapped Islands


            Same Conformal Unwrap Without the Use of Seams - Completely Unusable
            Click image for larger version  Name:	Seams5.jpg Views:	0 Size:	116.0 KB ID:	2315854


            Once you have your [UV Islands] - you can set their [Texel Density] using [Texel Density Checker] - make sure you set your texture size appropriately on the top of the [Texel Density Checker] tool panel. Then just move them to where you want them placed on your texture.

            You can save your [UV Map] to a texture file in the [UV Mapping] window by selecting [UV] [Export UV Map]. I would suggest setting the [Fill Opacity] to 1 for best results. It basically gives you a page out of a coloring book to apply your textures to.

            One other important tip in the [UV Mapping] window - on the top left toolbar - there's a tiny little icon that has two arrows - one up the other down - at a 45. This synchronizes the [UV Map] to your mesh. Where this comes in handy - you can select a [UV Island] and you may not know what it's mapped to - then move your mouse over to the [3D Viewport] and press [.] - it focuses and zooms in on the object that is mapped to your [UV Island]. Extremely helpful.

            So easy a caveman could do it.
            😉


            UVmap Export
            Click image for larger version  Name:	Prime-Flat-UV.jpg Views:	3 Size:	105.0 KB ID:	2315866


            To be continued...

            Regards,
            Scott
            Last edited by scottb613; 12-01-2024, 18:44.
            <a href=https://www.trainsim.com/forums/filedata/fetch?filedataid=80663&type=full title=thumb_80663.png >thumb_80663.png</a>​ My Blender Models

            Comment


              #7
              You can "count me in" as a reader of this informative tutorial. If work ever lets up a bit more, I will certainly use what you have provided here. If it can be slipped into a PDF...better still. I have been intimidated with the "new" interface since 3.0 and I fall back to older versions that seem very "straightforward" by comparison. The AO results for the newer versions of Blender are superior in my tests. I have also been wanting to experiment with the manipulation of "normals" to skew the even application of material types for MSTS. I have hated how hi-lo shine are implemented in ORTS from day one, so I have hoped that manipulating the "normals" would reduce the the 1980s type specular shine. I saw a demo of the "normals" manipulation in Blender a few years back. Alas, too many fingers in too many pies have kept me from looking into it any further.

              Thanks a heap,
              Steve

              Comment


                #8
                Originally posted by EldoradoRailroad View Post
                You can "count me in" as a reader of this informative tutorial. If work ever lets up a bit more, I will certainly use what you have provided here. If it can be slipped into a PDF...better still. I have been intimidated with the "new" interface since 3.0 and I fall back to older versions that seem very "straightforward" by comparison. The AO results for the newer versions of Blender are superior in my tests. I have also been wanting to experiment with the manipulation of "normals" to skew the even application of material types for MSTS. I have hated how hi-lo shine are implemented in ORTS from day one, so I have hoped that manipulating the "normals" would reduce the the 1980s type specular shine. I saw a demo of the "normals" manipulation in Blender a few years back. Alas, too many fingers in too many pies have kept me from looking into it any further.

                Thanks a heap,
                Steve
                Hi Steve,

                Thanks.

                Yeah - I’ve had so much help over the years with my modeling efforts - I just try to pay it forward. You never know when someone gets inspired to try something new.

                For the longest time I wouldn’t use Specular Shine - in MSTS I thought it was awful - it does seem to look a bit better now. Thinking about it - it might not look good on my handrails because I use a four sided shape - smoothed. I also worked in Flight Sim using LM P3D when they moved to PBR textures - OMG - what a complete game changer - like night and day. PBR make models look absolutely beautiful - hopefully we get there some day - but - that will necessitate all ORTS modelers become intimately familiar with baking - to produce the additional textures required.

                Regards,
                Scott

                <a href=https://www.trainsim.com/forums/filedata/fetch?filedataid=80663&type=full title=thumb_80663.png >thumb_80663.png</a>​ My Blender Models

                Comment


                  #9
                  ...hopefully we get there someday...
                  As do I.

                  Future support for GLTF (Graphics Library Transmission Format ) in OpemRails seems plausible, and we might get PBR textures with it since that format supports them.

                  Likely, though, OpenRails Devs might need to come up with a new final format and use GLTF as an import-only format to help avoid a tendency of some to plagiarize.

                  I am not holding my breath, though...

                  NOTE: Updates added to the notebook... https://github.com/pwillard/ebook-ORTSBCCN
                  Last edited by pwillard; 12-01-2024, 15:53.
                  http://www.railsimstuff.com
                  Just Blender now, 3DCrafter only when I have to.
                  formerly The Keystone Works (All Permissions Granted)
                  https://github.com/pwillard/MSTS-replacement
                  sigpic

                  Comment


                    #10
                    Hi Pete,

                    Yeah - I've done GLTF exports - just haven't taken the time to create the additional textures yet. Makes the Specular Shine textures look like glass bubbles.

                    Honestly - there are so few of us actually modeling - copy protections are nonexistent on my list of priorities. Allen Norton posted dozens of locomotives source code - and they've been barely touched over the years.

                    I'll have to check out your book - thanks for all the work - took a quick look on GitHub - WOW.


                    Regards,
                    Scott
                    <a href=https://www.trainsim.com/forums/filedata/fetch?filedataid=80663&type=full title=thumb_80663.png >thumb_80663.png</a>​ My Blender Models

                    Comment


                      #11
                      Post 3 (PACK ISLANDS):

                      [Pack Islands] - in [UV mapping] is the process of organizing and arranging [UV Islands] efficiently within the UV space to maximize the use of texture space. You can do this with entire texture sheets or any subset therein. You can define a Margin to set how much space is kept between Islands.

                      In practical use - you're probably going to be unwrapping far more faces than I did in my example above. You probably want to group them by texture used and perhaps proximity to each other. Instead of manually trying to juggle your [UV Islands] - Blender has included a great tool called [Pack Islands].


                      A More Realistic Use of an Unwrap - Spanning Multiple Objects
                      Click image for larger version  Name:	Pack1.jpg Views:	0 Size:	153.0 KB ID:	2315872


                      Set Your Texel Density as Required
                      Click image for larger version  Name:	Pack2.jpg Views:	0 Size:	134.2 KB ID:	2315873


                      Pack Islands - [UV] [Pack Islands] - Uncheck Scale - Set Your Margin
                      Click image for larger version  Name:	Pack3.jpg Views:	0 Size:	122.6 KB ID:	2315874


                      Result - An Efficiently Packed Group of [UV Islands]
                      Click image for larger version  Name:	Pack4.jpg Views:	0 Size:	126.0 KB ID:	2315875


                      The packed group of UV Islands - is ready to be moved where desired on your texture sheet.


                      To be continued...

                      Regards,
                      Scott
                      Last edited by scottb613; 12-02-2024, 01:45.
                      <a href=https://www.trainsim.com/forums/filedata/fetch?filedataid=80663&type=full title=thumb_80663.png >thumb_80663.png</a>​ My Blender Models

                      Comment


                        #12
                        Excellent pointers... People like you and I have had to figure this out ourselves. It's good that some others might benefit (i.e., save time) by having this information handy.
                        http://www.railsimstuff.com
                        Just Blender now, 3DCrafter only when I have to.
                        formerly The Keystone Works (All Permissions Granted)
                        https://github.com/pwillard/MSTS-replacement
                        sigpic

                        Comment


                          #13
                          Originally posted by pwillard View Post
                          Excellent pointers... People like you and I have had to figure this out ourselves. It's good that some others might benefit (i.e., save time) by having this information handy.
                          Hi Pete,

                          Thanks - hah yeah - we've come a long way since 3DC - where mapping was basically a one-shot deal - the UV Map was pretty much untouchable - and getting an export of the UV Map was nearly impossible.

                          Soooo much better in Blender.

                          Regards,
                          Scott
                          <a href=https://www.trainsim.com/forums/filedata/fetch?filedataid=80663&type=full title=thumb_80663.png >thumb_80663.png</a>​ My Blender Models

                          Comment


                            #14
                            Yeah, the UV MAPPING probably sealed the deal with me on Blender. I hated that part of 3D Canvas due to its gross inaccuracy and low level of control. And honestly... I stayed with 3D Canvas 7.120 because anything after that was either weird, unreliable or didn't work the way my 'muscle memory' worked. Version 10 was just wrong.

                            While not everything needs to be UV mapped using "seams," it sure does help with complex shapes if you select your seams carefully. Some things actually do work quite well with "project from view." Provided you are careful with 1) VIEW and 2) keeping your distance constant so you don't have huge UV ISLAND size variations. (You CAN fix that after the fact; it is just more work)
                            http://www.railsimstuff.com
                            Just Blender now, 3DCrafter only when I have to.
                            formerly The Keystone Works (All Permissions Granted)
                            https://github.com/pwillard/MSTS-replacement
                            sigpic

                            Comment


                              #15
                              Great topic Scott. I've been on 3.6 till I saw your screen shots, so I downloaded 4.3.0 this evening and been having a play.

                              Note that glTF has been removed from the unstable version and I have a suspicion it is not going to make the Open Rails 1.6 release.

                              Looking forward to your further posts.

                              Comment

                              Working...
                              X