Advertisement

What are the advantages of creating normal maps the hard way?

Started by September 09, 2017 04:57 PM
6 comments, last by Hodgman 7 years, 5 months ago

I've built some simple normal maps out of meshes and a custom HLSL shader that writes their normals to the screen.  While I've only used this for creating tiling normal maps, where I control the orientation of the mesh used to generate normals, I don't see why I couldn't do this for a full-model normal map, placing the models in screen space based on their UV rather than world-space coords, writing the normals of the low-poly to one image, the high-poly to another, and the vector necessary to transform the normals of the first to the second onto a third image.  With the tiling normal maps I've made, I haven't seen any artifacts or weirdnesses.  All it takes is one or two models, a relatively simple shader, and a single frame of computer time.

But when I visit modelling sites, baking normals sounds like a major headache, involving the creation of a cage and a lengthy bake process.  It sounds like the modelling packages are using some kind of raycasting algorithm.

There must be a reason not to be doing things the way that I've been doing them.  Can anyone explain to me the problems with creating normal maps via shader?

I don't exactly understand the method you are using... but I am guessing is very constrained to your specific use case, like a plane as a low poly version on a more detailed displaced version of it in just one axis. In the general case, the low poly and high poly models don´t have the same topology, and thus, they don´t share the same uv space... in fact, many times the high poly version of a model isn´t even uv unwrapped.

Advertisement

I've done normal maps the way you describe, and it does have its uses. However, baking normal maps is a mapping process, mapping from high-detail geometry to low detail geometry. In the case of baking a tiling planar normal map, you are going from high-detail geometry arrayed on a plane, to a plane. It's a pretty easy mapping, 1 to 1 with the XY coordinates of a particular location on the plane. A given feature simply projects directly to the plane 'below' it. When baking an arbitrary mesh, however, then it's not so simple. In this case, you need to find the point on the high-detail poly mesh that most directly corresponds with a given point on the low-detail poly mesh. This involves projecting onto the surface of the high-poly, and this projection is NOT a simple projection onto a 2D plane. Once you advance to that level of complication, it's much easier to do the work in a 3D package. Not to say that it CAN'T be done in your own way, just that the math and logistics become a LOT more complex.

Thanks for your responses, I think I understand better now.

 

It sounds like it should be acceptable-- it's nice to know that some awful artifact isn't going to jump out at me-- and the real issue is matching UV coords, matching corresponding points/spaces.  There are certainly situations where this is easy via UV correspondence, like if your high poly is just a subdivided low poly, it seems like it would be trivial; what I was doing with planes was trivial.  But I can see now how there are situations where it wouldn't be trivial.

Yes, if the high poly is made by subdividing the low poly then it's not too difficult to bake yourself. You can build a workflow that ensures that. Some tools, however, allow dynamic subdivision while sculpting (see something like Sculptris, or Blender's dynamic subdiv). This allows more mesh detail in areas that need it, but can break the relationship between the high poly and low poly. If your workflow includes this, then the math becomes more difficult.

 

Additionally, I feel like you overstate the difficulty in using a 3d tool to bake normal maps. Tutorial videos make it seem more difficult than it really is. Once you understand the process, it can be a very quick thing. The actual baking setup and bake can take mere minutes.

 

Even for tiling textures, I now prefer Blender rather than my own older hand-tooled processes: 

 

Having access to all the other tools of a general purpose 3d tool makes all the difference.

Thanks, that's easy to believe, and useful to know.  I actually made my own shader to bake lighting/mats/etc to textures in-engine before I discovered that in reality, there was nearly no difficulty involved in Blender baking.  So I can imagine the same is true with normals too.  (But, it wasn't bad HLSL practice either, not a bad way to get more comfortable with the concepts, not something I regret doing.)  So much just seems to be about finding the time to learn it, when there's so much to be learned, and difficult to know beforehand what's going to be hard to learn and what's going to be easy.

Advertisement

You've implemented a baker ;)

You're using a 2D cage in texture space and require the artist to exactly map both meshes onto that cage.

Other methods change the workflow for the artist, such as not requiring UVs at all on the high poly 

This topic is closed to new replies.

Advertisement