   Precomputed normal maps
  I started to make an attempt at a per pixel lighting shader after reading a link in another post.I was merrily moving along, until I had to actually implement the part where the author wanted me to fetch a normal. The text in the article is very clear, but requires I provide a precomputed normal map or a height map in order to make the shader work.I am at a loss as to creating the normal map.I might be able to parse my model data by writing another tool and create a height map...maybe. I am unsure how the height map ranges should work though:When do I assign a 0 and when do I assign a 255? Do I map the lowest Z in my model to 0 and the highest to 255? Do I even use Z? Maybe I use X or Y? I mean, which way is "high" anyway?Anyone have suggestions on getting started on generating normal maps?The only tools I have available to me are Maya 6.0.1, Photoshop CS2, Visual Studio, and my wits :)I was really excited to try per pixel lighting, but this is a roadblock.   
  The typical normal format has the X, Y, and Z components stored in the texture such that 0 is -1, and 255 is 1.  So in your shader you would do this to convert:float3 normal = normalMapValue * 2.0f - 1.0f;There are many other ways to store a normal map, this is just the simplest/most common.  For instance you could only store X and Y, and then reconstruct Z from those two (since Z will always be positive).There are various ways to generate a normal map...certain content production tools can take a high-poly mesh and generate a low-poly version along with a normal map.  There are also standalone tools that will generate normal maps from a height map or even from a diffuse map.  ATI has a tool, and Nvidia has a photoshop plugin.  I use Crazybump personally, but that is not free.BTW height maps are not typically used directly for normal mapping, since it's easier to process them offline into a normal map.  Height maps are instead used for techniques like parallax mapping or displacement mapping.  In these cases the shader will usually have some "scale" parameter that is multiplied with the [0, 1] value you get from the heightmap texture.   ;Quote:Original post by MJPThe typical normal format has the X, Y, and Z components stored in the texture such that 0 is -1, and 255 is 1.  So in your shader you would do this to convert:float3 normal = normalMapValue * 2.0f - 1.0f;There are many other ways to store a normal map, this is just the simplest/most common.  For instance you could only store X and Y, and then reconstruct Z from those two (since Z will always be positive).Yea, I can handle the normal map once I have it, the article explains that well. My problem is in creating one to use. Ends up, they did exactly what you just described.Quote:Original post by MJPThere are various ways to generate a normal map...certain content production tools can take a high-poly mesh and generate a low-poly version along with a normal map.  There are also standalone tools that will generate normal maps from a height map or even from a diffuse map.  ATI has a tool, and Nvidia has a photoshop plugin.  I use Crazybump personally, but that is not free.That is what I need. I could for instance try the photoshop plug-in, but it still requires a height map to start from. So, I was wondering how to get a height map. I could perhaps make one myself with the Maya SDK, but I don't know what is considered "high" when creating one. I've got three axis to choose from and a range that I am unsure of. The height map goes from 0 to 255 greyscale, but what do I map to 0 and what do I map to 255?Quote:Original post by MJPBTW height maps are not typically used directly for normal mapping, since it's easier to process them offline into a normal map.  Height maps are instead used for techniques like parallax mapping or displacement mapping.  In these cases the shader will usually have some "scale" parameter that is multiplied with the [0, 1] value you get from the heightmap texture.Yea, that is what I meant. I'd have to create a height map in order to create a normal map offline. Or find some software that will just create the normal map for me.I guess I need to dig around in some Maya forums, but was hoping there was some easier way, if I have access to vertices already, like just writing a "create heightmap" or "create normal map" tool that I can feed my high-res model vertices too.;  I'm not aware of any tools that directly convert a high poly mesh to a low poly mesh with a height/normal map, but I almost certain that one exists.  In the original presentation on parallax occlusion mapping that Natalya Tatarchuk presented, she showed the difference between direct rendering of a high poly model and a low poly model with POM applied.There is probably a plugin for Maya out there somewhere, but I don't know where to find it...   ;Quote:Original post by Jason ZI'm not aware of any tools that directly convert a high poly mesh to a low poly mesh with a height/normal map, but I almost certain that one exists.  In the original presentation on parallax occlusion mapping that Natalya Tatarchuk presented, she showed the difference between direct rendering of a high poly model and a low poly model with POM applied.There is probably a plugin for Maya out there somewhere, but I don't know where to find it...The only tool I'm familiar with is Ultimapper, which comes with XSI.  I would think that Max and Maya have equivalents, but unfortunately I'm not familiar with them because I don't own them (too damn expensive!).  I believe ZBrush can generate height maps, too.;  Ok, thanks guys. I'll direct my search to the Maya forums. I think I might have found something, at least a phrase "surface sampler" to look for.I agree they are too damn expensive! I am still using my 2004 student version. I would love to upgrade to some more recent software, but sheesh dropping 4k every couple of years makes this hobby too expensive even with a developer's salary.;  Someone pointed out ZBrush.  Look into MudBox as well.The poor man's version would be to paint greyscale textures directly on the mesh.  Start with 128 grey, and color whiter for bumps, and blacker for dents.  Run this map through nVidia's plugin to make a normal map.  Certainly not as good a solution as MudBox, but it would work, much cheaper.   