Normal Mapping (again)

Blitz3D Forums/Blitz3D Programming/Normal Mapping (again)

.rIKmAN.(Posted 2004) [#1]
Just starting to get to grips with a nice art pipeline for normal maps in Blitz, and now I have hit a prob.
I have multitexturing working with a normal map, a base texture and a decal graffitti style texture, and am looking at taking this technique into a full walk around level.

Now, the few examples I have seen of Normal Mapping all seem to use a light that rotates around using sin/cos routines....obviously you wouldn`t have this in a game.

I do notice however that the rgb value for EntityColor is also derived from this calculation, but I don`t see how it fits together.

Can`t I just use a normal CreateLight() and walk around having it light my level with the Normal Maps?
Do I need to do some additional calculations each loop to update the normals on the surfaces with them applied?

Cheers


jfk EO-11110(Posted 2004) [#2]
Unfortunately yes, because this dot 3 (formerly known as blitz easter egg) does support only static blending. But there is a new demo around that is using a multi layer method to dynamicly fake-update the dot3 map etc. well, to be honest, I didn't get it fully by now :) wait a minute, the url is:
http://www.blitzbasic.com/Community/posts.php?topic=39353


.rIKmAN.(Posted 2004) [#3]
Thanks jfk. I saw that a few days ago and though it all sounds good, the normal map isn`t really that pronounced.

Plus I didn`t really take it all in as I had no intention of Normal Mapping animated objects, but will go have another read - cheers :)


.rIKmAN.(Posted 2004) [#4]
Is there already a walk around normal map demo anywhere?
I have created the level and applied the normal maps, but now when using the same lighting method as in other demos (EntityColor mesh,r,g,b) it just makes my mesh all black.

Weird :S


MSW(Posted 2004) [#5]

have created the level and applied the normal maps, but now when using the same lighting method as in other demos (EntityColor mesh,r,g,b) it just makes my mesh all black.



Each ploygon of the level should be treated seperately...polygons where the light is hitting it strait on would be colored 127,127,255...this equates to a normal value of 0,0,1...when the normal map is DOT3 applied, the videocard performs a dot product operation between the polygon and normal map...the result is a greyscale value from black to white.

About the easiest way to get the proper normal colors for the level would be to create a pivot...move it to each polygon verticy...point the pivot at each light source visable to the polygon...record the pivot normal...point it to the next lightsource...record the pivot normal...repeat until no more lightsources strike the polygon the verticy is attached to...then average the recorded pivot normals...convert that averaged normal into a RGB color (average normal X axis * 127 + 127 = red...average normal Y Axis * 127 + 127 = Blue, etc..) and give that particular verticy that color...move the pivot to the next verticy and repeat...once all the verticy colors have been calculated, save the level mesh.

Then in your game engine just render it with the fullbrite and verticy color flags...DOT3 the normal maps onto that, followed by the regular textures and lightmap....note: this is only static precalculated lighting...additionaly the calculated verticy colors arn't the actual verticy normals, rather they are the normals (or vector) pointing in the direction of the light as it strikes the surface.


Sledge(Posted 2004) [#6]

About the easiest way to get the proper normal colors for the level would be to create a pivot...move it to each polygon verticy...point the pivot at each light source visable to the polygon...record the pivot normal...point it to the next lightsource...record the pivot normal...repeat until no more lightsources strike the polygon the verticy is attached to...then average the recorded pivot normals...convert that averaged normal into a RGB color (average normal X axis * 127 + 127 = red...average normal Y Axis * 127 + 127 = Blue, etc..) and give that particular verticy that color...move the pivot to the next verticy and repeat...once all the verticy colors have been calculated, save the level mesh.



Right. I vote Mark integrates all that into Maplet so that I never have to contemplate any of what you just wrote ever again.