Normal Map Generator (from diffuse maps)

Started by
18 comments, last by maxest 8 years, 3 months ago

To be honest, I'm still not sure what you mean by "sourcing different images". Let's say I have a bricks diffuse map and want a normal map for it. How do you recommend sorting that out?

Advertisement

I would take the diffuse, block out the "lines" parts in black, the other parts in white. Potentially do a guassian blur depending on how smooth I want the edges of the block pieces. This will be my height map for a normal map. Generate the normal map

This could work as is but if you want micro detail normals, we can then go and find maybe a plain looking photo of some concrete and create a normal map from it that has those tiny details and overlay/merge them together with the previous normal map.

Then for specular I would go find another concrete texture, convert to black and white, play with the contrast/brightness and try it out. Sometimes you may actually want parts of the diffuse in the specular, sometimes you don't.

Now with your method, if you have a brick texture, you can't change the height of the bricks. You will only get a 1 pixel differential when creating the normal map from the brick part to the "lines" part. The algorithm will simply say thats a red pixel thats a white one, ok done.

Again with any other concrete textures that are say white concrete with some dirty parts. The dirty parts will get normal mapped. That doesn't make sense and doesn't look good. The contrasting grime will generate different normals even though the surface hasn't changed just because of some dirt or leaking rust etc. So again just source a completely different concrete texture and generate a normal map from it. Using 1 image for all 3, you just get normals among the contrast in the diffuse, and it just never looks quite eye-popping.

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

Okay so you suggested solution for a brick texture. What about dozens of other, non-brick textures :)?

What do you mean by "lines parts"?

I mean take your brick texture and manually create a height map like this so the line parts have no height and the other parts have height:
https://sp.yimg.com/ib/th?id=JN.8iXUTR9kjYe%2fJ34S4V5DBA&pid=15.1&P=0

The other ones do whatever you want. Again If you have a concrete diffuse, take a separate concrete texture and generate a normal map. This way you have normal map data that doesn't correlate to where there is already contrasted diffuse data.

A good example of how NOT to do it:

http://2.bp.blogspot.com/-KiNQLkLbEeo/U6RCfzP0iLI/AAAAAAAAEQc/7BeHbNXSNeU/s1600/MAPS+THUMBS.jpg

See those dark dirty lines? If you just grayscale that image for a height map and then normal map, it thinks that those dirt parts are actually height differentials and then makes contrasted normals around those areas. The result: all those darkened dirty lines just get darker and when lit, it won't really look like it is lit because it's already dark and contrasted along all those pixels.

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

Okay so that's solution for the brick texture. But I have dozens of other textures as well and really no time to be that careful about generating their normals maps, given that 99% of players won't notice any difference at all ;)

Thanks for sharing your code.

However, I do share the sentiment of the others that this is can be a bad idea. While it is true that 99% of all players, artists, and programmers won't be able to tell that the normalmaps are broken, they will be able to tell that it looks bad, or at least not "right". Trust me, I've been there, done that. Also on a commercial project.

The real problem comes later though. Once a significant amount of all materials have broken normalmaps, the spec/gloss maps are adapted to it to somehow counteract the effect. Then the lighting. All of a sudden you can no longer change individual assets to "good" normalmaps because it would break the entire setup. And before you know it, "bad looking" becomes your new art style that every new asset has to adhere to, because otherwise the game would not look coherent.

If you don't have the time or ressources to make actual normalmaps, then not using normalmaps or using funky normalmaps might be the right choice. There are very good looking games out there that aren't photo realistic. But it should be a conscious choice.

Note that the technique of using a normal map derived directly from the diffuse has, in fact, been use in commercial games. See Path of Exile. In that description, the author discusses painting over areas of the texture with highlights to allow CrazyBump to differentiate the high areas a little better. Like all artistic endeavors, it depends much on the guy/girl doing the creation.

A normal map encodes slope for individual texels, which may then be used to determine whether light is shining directly at a texel, at an angle to it, or even behind it.

This information is just not even there to begin with in a diffuse map. Even worse, many old-school diffuse maps will already have light and shading baked-in, and so will look absolutely wrong if you add a normal map. A proper diffuse map intended for use with a normal map is just flat regions of colour. You would be effectively mixing two wrongs in the hope that they make a right: diffuse maps intended for use without normal maps, and normal maps generated the wrong way.

You might be happy with your current approach, but I'd encourage you to cross-check it with other people, particularly since you say this is a commercial game. Things that look acceptable enough to one person can easily drive another barmy with rage, so be very careful about statements like "99% of players won't notice any difference at all". Unless you have the research to back that up, you should assume that it's false.

I get that you're happy and enthusiastic about the result you've gotten, I really do. But you're taking a huge risk and you've got money to lose here, so don't let that rush of enthusiasm affect your judgement.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

Note that the technique of using a normal map derived directly from the diffuse has, in fact, been use in commercial games. See Path of Exile. In that description, the author discusses painting over areas of the texture with highlights to allow CrazyBump to differentiate the high areas a little better. Like all artistic endeavors, it depends much on the guy/girl doing the creation.

R+ for this, drawing on areas of diffuse/grayscale where dark diffuse does not donate to height shift is actualy a great production technique of proper amazing normal maps.

Also there are photometric/lights-using methods on observing normals from a picture.

But that does not justify diffuse-to-grayscale method :)

Just if anyone's curious I went with the initial approach (the one I posted code for in the opening post of this thread) for my game and the game's on Steam so you can check out yourself how this turned out http://store.steampowered.com/app/347820/

This topic is closed to new replies.

Advertisement