approximate normal mapping...
#1 Members - Reputation: 163
Posted 09 October 2012 - 01:54 AM
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?
#2 Members - Reputation: 637
Posted 09 October 2012 - 05:01 AM
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
#3 Members - Reputation: 841
Posted 09 October 2012 - 05:25 AM
I am not sure I understand your problem properly: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?
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.
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/
#4 Members - Reputation: 163
Posted 09 October 2012 - 05:46 AM
@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
#5 Members - Reputation: 4605
Posted 09 October 2012 - 06:41 AM
My game: Gnoblins
Developer journal about Gnoblins
Small goodies: Simple alpha transparency in deferred shader
#6 Members - Reputation: 841
Posted 09 October 2012 - 07:21 AM
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.@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
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.
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/






