approximate normal mapping...

Started by
4 comments, last by lauris71 11 years, 6 months ago
Hi all,

I need to unwrap the texture of my 3D mesh by constructing a kind of bump (or a normal) map.
I know the function mapping every surface point on the mesh on its u,v coordinates and I can estimate
the normal at each surface point as well.

Currently, I'm drawing a grayscale map -- by assigning each pixel an intensity proportional to the dot product between the normal at
the corresponding surface point, and the average between the normals in a well defined neighboring of that point.
However, the resolution of the map is quite poor in this way (the dot product is very near to 1 in most cases).

Is there any smarter way to achieve my goal?
Advertisement
hm, it sounds like you simply may need more vertices to get more normals that have greater difference
this is just me guessing though, but if your mesh data is optimized heavily so that each normal is at "big changes in terrain", then theres
also that chance that all the normals simply are 0.0 1.0 0.0 (for example)

don't create a lattice mesh using value noise or some sort of diamond-square algo, that is drag vertices up and down... that will create avg normals of 0.0 1.0 0.0 __all the time__
try moving your points in the xz direction as well, then you will start to see some detail appearing, and some detail disappearing :)

i dont think its a problem with your texture precision.. 8 bits per channel is tons to define a normal, and 8 bits for a dot product i would think is enough
bottom line: it's most likely a "too few vertices" problem.. you should be able to tell that from looking at the bitmap though :)

I need to unwrap the texture of my 3D mesh by constructing a kind of bump (or a normal) map.
I know the function mapping every surface point on the mesh on its u,v coordinates and I can estimate
the normal at each surface point as well.

Currently, I'm drawing a grayscale map -- by assigning each pixel an intensity proportional to the dot product between the normal at
the corresponding surface point, and the average between the normals in a well defined neighboring of that point.
However, the resolution of the map is quite poor in this way (the dot product is very near to 1 in most cases).

Is there any smarter way to achieve my goal?

I am not sure I understand your problem properly:

Normal map encodes the normals at each surface point, relative to tangent space.
Bump map encodes the elevation at each surface point, relative to mesh geometry.

Now you can iterate over your mesh surface and for each surface point you know the normal. To construct normal map you have to know tangent space at that point. To construct bump map you have to know the actual location of that surface point, location of that point in mesh geometry and normal at that point.

You description (finding dot product of normal and certain neighbourhood) seems to apply something like noise-detection or highpass filter to bump map.
Lauris Kaplinski

First technology demo of my game Shinya is out: http://lauris.kaplinski.com/shinya
Khayyam 3D - a freeware poser and scene builder application: http://khayyam.kaplinski.com/
@Kaptein: yeah, it is exactly a "too few vertices" problem. Unfortunately, the number of vertices I should consider may noticeably vary from a zone to another on the surface mesh (e.g., on the face I need less vertices than on the torso); further, considering a huge number of vertices is very time consuming.

@Lauris: sorry for my "newbie" question... Very shortly, how do you use the three values you mentioned (location of the surface point, location of the point in mesh geometry and normal at that point) in order to set a pixel value in the bump map? i
Do you try to bake a normal map or a hipoly model to a low-poly model ? If this is the case, have you considered to use the baking ability of i.e. blender or xnormal ?

@Lauris: sorry for my "newbie" question... Very shortly, how do you use the three values you mentioned (location of the surface point, location of the point in mesh geometry and normal at that point) in order to set a pixel value in the bump map? i

The value of bump map texture at given (UV) point should be the distance between true surface (full-detail model) and approximate geometry (actual model) surface along the normal of approximate model surface.
In other word - if you "apply" the bump map to low-poly model surface, the values of bump map texture pixels determine how much surface pixels have to be "moved" to get to their "true" positions.
Lauris Kaplinski

First technology demo of my game Shinya is out: http://lauris.kaplinski.com/shinya
Khayyam 3D - a freeware poser and scene builder application: http://khayyam.kaplinski.com/

This topic is closed to new replies.

Advertisement