Normal Maps?

Posted By: Dan Silverman

Normal Maps? - 06/28/04 23:29

Are normal maps a function of shaders and can they be done in A6 now? If so, can someone share a script demonstrating this as I would like to test it on a MDL or two.

Thank you for your help!
Posted By: ventilator

Re: Normal Maps? - 06/28/04 23:39

normal mapping = (dot3) bump mapping = per pixel lighting

it's all the same...
Posted By: Orange Brat

Re: Normal Maps? - 06/28/04 23:44

http://216.46.205.166/ubbthreads/showflat.php?Cat=&Number=396064&page=0&view=collapsed&sb=5&o=21&fpart=1#396064
Posted By: Phantom88

Re: Normal Maps? - 06/29/04 02:05

Quote:

normal mapping = (dot3) bump mapping = per pixel lighting

it's all the same...



Well acually normal mapping means that the normals are encoded in all 3 colors(RGB), but in DOT3 only the heights of the pixels are stored(That's the difference as i have understood it), so it yields more precise and faster results...

~Phantom88~
Posted By: ventilator

Re: Normal Maps? - 06/29/04 02:19

the name is dot3 bump mapping because <normal dot light> gets done per pixel. this requires a normal per pixel and these normals are encoded in a normal map!

you can generate the normal map from a height map or from a high poly model. with high poly models you have more control over it and the results probably will be more impressive...
Posted By: ChrispiZ

Re: Normal Maps? - 06/29/04 02:44

dO You have 2 generate normal maps, usin a normal map generator?
How do you generate it from a high poly model? Do i have to bake the textures?
Posted By: myrlyn68

Re: Normal Maps? - 06/29/04 02:54

No - you could probably make the normal maps by hand...it just wouldn't be too easy.

As for how, it varies depending on which program you are using (there are a dozen or so that I can think of right now).

In most case you create your low polygon model and then create another high polygon one - which other than the details is the same basic form. You then open up the low ploygon model in the Normal Mapping program and then import the High polygon model over top of that. Click whatever button it has to generate normal maps and wait.

Depending on how fast you computer is, how high poly the high poly model is and a few other factors - you will have your normal map in a few seconds to a few minutes.

Now most of them allow you to preview the model too. This is very important, since you will often have seams in the normal maps that you will want to get rid of. Sometimes you can do that by adjusting the UVs, other times you will need to touch up the normal map by hand (takes a bit of practice...but not too hard).
Posted By: Drew

Re: Normal Maps? - 06/29/04 03:23

a quick and easy way, yet still looks great.. is creating a normal map from a greyscale...
1. export your models skin#1
2. install ati's normal map plugin for photoshop (or is it nvidia?)
3. Desaturate it (take the color out)
4. open the normal map plug in and tweak usimng the preview..
You can also use the normal map translator, which takes an image and converts it to normal map, but you have no control...
Posted By: Dan Silverman

Re: Normal Maps? - 06/29/04 03:47

I have ZBrush 2 and it will allow me to import a low-poly model, create a super-high poly model (up to and over 2 million polygons ... and, yes, Z2 can display this in virtually real time even on my PC) and then export out a normal map for use in the low poly model. I am anxious to try this but I have no idea how to go about doing it.
Posted By: Nadester

Re: Normal Maps? - 06/29/04 04:20

Wouldn't what you are looking for be more allong the lines of a displacement mapping shader? Something like Crytek's "Polybump" - http://www.crytek.com/polybump/index.php?sx=polybump (free for non-commercial users/students). It is somewhat similar to a bumpmaping shader - like this one http://216.46.205.166/ubbthreads/showflat.php?Cat=&Number=335986&page=&view=&sb=5&o=&fpart=1&vc=1 . Oliver's doesn't use displacement mapping, but it is very close. The only major difference is that the bumps do not "overlap" like in this example, http://www.conitecserver.com/ubbthreads/showflat.php?Cat=&Number=335703&page=0&view=collapsed&sb=5&o=&fpart=1 . I think that with a bit of work a shader could be written for good displacement mapping, but it wouldn't be such an easy task. (You couldn't just "throw one together", that's for sure) Maybe if someone found a good dx8.1 example out there to convert.
Posted By: Dan Silverman

Re: Normal Maps? - 06/29/04 04:52

Well, I just need one for normals . This is similar (the same?) as what they are doing in DoomIII and Half-Life2.
Posted By: Nadester

Re: Normal Maps? - 06/29/04 05:01

Dan, I believe both games use displacement mapping.
Posted By: Alexander Esslinger

Re: Normal Maps? - 06/29/04 05:11

No, both use "normal" bumpmapping.
Posted By: myrlyn68

Re: Normal Maps? - 06/29/04 05:12

No...no games use real displacement mapping.

Displacement mapping displaces the mesh. It actually alters the geometry.



As you see here, the geometry is as low poly as the guard and wizard models in 3DGS (look at the outline of the model).
Posted By: Dan Silverman

Re: Normal Maps? - 06/29/04 05:22

Correct. The give-away is on the edges of the model. So I am not looking to actually displace the geometry. Why? Because low-poly geometry does not have enough geometry to displace . But normal maps give the appearance of high detail on low geometry. It is not just the "paint" on the skin that gives it the appearance of being detailed, but the normal map is also affected by dynamic lights.
Posted By: Drew

Re: Normal Maps? - 06/29/04 06:34

Dan- zbrush sounds awesome... I know folks using it for normal maps in the unreal3 engine just for this reason!
polybump is the only one so far that I can get to work in A6, as true normal mapping...(see my post in showcase, the head is true normalmapping...)
It actually imports my obj's (or were they 3ds?), with the right uvw info and creates a normal map that can easily imported into MED in sikn2 , and matches up perfectly. The poroblem with ATI's and nvidia;s melody (which is amazing), is that the uvw info doesnt carry over...thats important to me because I texture bake in max, and need those uvws! if anyone know a way please share, since polybump is just a demo and unusable... Melody gives simply amazing results in the viewer, now if i can get it out and keep my uvws...Doom3 quality easily. When I have a 130,00 poly head next to a 700 poly head in melody, IT LOOKS ALMOST EXACT...
i'll post an example image later, you can barely tell them apart.
Posted By: Dan Silverman

Re: Normal Maps? - 06/29/04 06:51

Drew,

You need to check out ZBrush 2 (Z2). It is awesome. That is why Weta Digital used it (along with Maya) to model for the Lord of the Rings movies. It fits in great with your workflow. You do a base model in your package of choice (I use Silo), bring the model into Z2 add details there and/or paint the UVW map. It rocks!
Posted By: qwerty823

Re: Normal Maps? - 06/29/04 07:19

Drew

I have Melody, and took a .3ds mesh from rendermonkey, pulled it into melody, reduced it from 63K polies down to 3k (probably could have gone lower, but that seemed like a good round number), and createed a normal map for it. I now have the normal map, skin, and mesh into MED, and a saved model. Can you share your script for how you get it to render. So far, no go for any i've tried in 3dgs. If I can get it working, Ill gladly tell all how i did it.

I must admit, in Melody, I could hardly tell the difference between the two models. I want to make a simple a6 demo that toggles between the default mesh, and the normal mapped one, so you can see the difference.
Posted By: Nadester

Re: Normal Maps? - 06/29/04 08:43

Ahhh sorry about that Dan.. I thought you meant something else. My bad
Posted By: Drew

Re: Normal Maps? - 06/29/04 08:56

qwerty-
when you say you brought a 3ds from rendermonkey, where did you dothe original texturing for the 3ds.
Thats my problem, getting the texture and uvw info from the model, made in max..into melody and back out to GS with the mapping stayiing intact, and when I import the normal map, it matches those same uvws....Check your PM, I elaborate on it more there...:(
Posted By: Anonymous

Re: Normal Maps? - 06/29/04 20:57

woah - this is going over my head.

Am I right in thinking that, if I generate normal maps for my model, in the ways previously suggested, I can then just import the model into A6 - and then it will have the normal maps? Or do I have to do something with it (assign a shader or something) once in A6?
Posted By: ello

Re: Normal Maps? - 06/29/04 21:25

of course you need a shader for this
Posted By: Dan Silverman

Re: Normal Maps? - 06/29/04 21:40

If you just bring in the model to A6 then that is all you get ... the low-poly mode. You then need to have a shader (or program a shader) for the normal map and then apply that to the model.
Posted By: Anonymous

Re: Normal Maps? - 06/29/04 23:49

Hmm - somehow I think I'll wait until I'm a bit more confortable with C-Script then.

Thanks for the advice though - as a beginner I find many of these concepts very interesting but way out of my reach.
Posted By: PHeMoX

Re: Normal Maps? - 06/29/04 23:51

Although it's far from the same, as for the quality of the effect, I've used a similar method to make my skins more realistic..

In other words, I've used a high poly model with a 'normal quality' skin, and made screenshots from that high-poly model from different angles.. Applied those 'screenshot skins' to my low poly model, and now it has got way more detail than it would have with the usual skinning method... Especially the shadow parts and depth parts are really a lot better, other detail also depends on your own skin's quality of course.. Only problem is that it is quite time consuming to make things perfect.

@Drew which engine do you mean with unreal3's engine?

Cheers
Posted By: LoneWolf

Re: Normal Maps? - 06/30/04 01:39

Im not at all good with shaders but this topic caught my eye and especially what Masked_Ouijaa said:


Quote:

woah - this is going over my head.

Am I right in thinking that, if I generate normal maps for my model, in the ways previously suggested, I can then just import the model into A6 - and then it will have the normal maps? Or do I have to do something with it (assign a shader or something) once in A6?




Would it be possible to enhance med and the mdl file format so that it can hold the normal mapped image. Then gamestudio checks the model has a normal map and automatically applys the shader?
Or if you give the entity the shader in your game then the shader could access the normal map straight out of the mdl file?

Just thinking out loud i guess
Posted By: Orange Brat

Re: Normal Maps? - 06/30/04 01:48

There are improvements mentioned in forecast:

Quote:

Model Improvements (priority: medium)
Models can consist of several meshes with different textures and materials. External image files can be used for textures. Material definitions and shaders can be directly stored in the model.




Posted By: qwerty823

Re: Normal Maps? - 06/30/04 01:53

Since you brought this up, and I have done something along those lines, I guess its time i posted this.

Using Melody to create a normal map, I took a 3ds model from RenderMonkey that was 63k polies, and reduced it to around 3k polies. I created a normal map from the 63k poly version and applied it to the 3k one. The skins for this model are a solid gray skin for skin 1, and the normal map for skin2. I then used a shader from this forum called mat_diffuseperpixel (not the best one for it, but a pretty good start).

Here is the screenshot of the model with no normal map:


and here it is with the normal map applied:


Now its far from perfect, but should give you some idea of whats capable. You cant really tell from the screenshots, but when the model rotates, you can see how the lighting is affected by the per pixel normals. There are still some issues to work out, but it just goes to show that the A6 engine is more then capable of doing this. Its just a matter of the shader experts to come up with the best way to make this happen.
Posted By: Matt_Aufderheide

Re: Normal Maps? - 06/30/04 11:03


Quote:


Would it be possible to enhance med and the mdl file format so that it can hold the normal mapped image. Then gamestudio checks the model has a normal map and automatically applys the shader?
Or if you give the entity the shader in your game then the shader could access the normal map straight out of the mdl file?





this is already possible. in MED just add more skins.. they can all be acessed by the shader using entSkin1-4. then you just apply the shader material like any other material to an entity. the shader will know what textures to use.. this is in fact the best way to do things
Posted By: ello

Re: Normal Maps? - 06/30/04 16:08

In Antwort auf:

Since you brought this up, and I have done something along those lines, I guess its time i posted this.

Using Melody to create a normal map, I took a 3ds model from RenderMonkey that was 63k polies, and reduced it to around 3k polies. I created a normal map from the 63k poly version and applied it to the 3k one. The skins for this model are a solid gray skin for skin 1, and the normal map for skin2. I then used a shader from this forum called mat_diffuseperpixel (not the best one for it, but a pretty good start).





hmm, could it be, that your normal map has to be inverted. seems that it uses the lightdirection mirrored , or that you need to change something in the shader.

what program are you talking about? i did a search on "melody" but got no usable results *you know why*

can you provide a link or something?
Posted By: qwerty823

Re: Normal Maps? - 06/30/04 22:41

Quote:

hmm, could it be, that your normal map has to be inverted. seems that it uses the lightdirection mirrored , or that you need to change something in the shader.




There are some options in Melody that control things like whether the Y axis or Z axis is up, which I haven't played with. I know in 3dgs the Z axis is up, but in DX coords, i believe that Y is up, and I think thats what I'm using, since I'm pretty sure shaders do all there stuff in DX space. There could be other settings that are wrong as well, and who knows, the shader I'm using probably isn's exactly meant for this either. While it might not work exactly, it does seem to offer a level of detail that the original model doesnt have, even if the lighting to it is wrong. I guess maybe its a bad example, but still better than nothing.

I'm all for you or someone else to "one up" me and make something better.

Quote:

what program are you talking about? i did a search on "melody" but got no usable results *you know why*

can you provide a link or something?




For you ello, absolutely!

http://developer.nvidia.com/object/melody_home.html
Posted By: ello

Re: Normal Maps? - 06/30/04 22:56

hey, thanx!

btw, does anybody know what happend to the nveffectbrowser? does anyone have it for download still?
Posted By: Anonymous

Re: Normal Maps? - 07/01/04 00:09

I'm extra happy now. I've searched arround - and I'm beginning to understand how to do this.

I've got NVidia's Melody, and so I'll be able to generate the normal maps from my high and low poly models (by using melody).

Then I'm right in thinking I take the low poly model into MED. I have the texture skin, and the normal map skin and, I found this on another thread, is this the code I need to use?? (as the thread was partly german I got a little confused - but I think I understood correctly that this is a correct version of normal mapping code?).

Code:


MATERIAL bumpmap

{

effect

"

matrix matWorldViewProj;

matrix matWorld;



texture entSkin1;

texture entSkin2;



vector vecLight;



technique dot3map

{

pass p0

{

Texture[0] = <entSkin2>;//2te Skin im Model ist die Normal Map

Texture[1] = <entSkin1>;//1te Skin im Model ist die Textur



COLOROP[0] = dotproduct3;

COLORARG1[0] = texture;

COLORARG2[0] = diffuse;



COLOROP[1] = modulate;

COLORARG1[1] = texture;

COLORARG2[1] = current;



VertexShaderConstant[0]=<matWorldViewProj>;

VertexShaderConstant[4]=<matWorld>;

VertexShaderConstant[18]={1f,1f,1f,1f};

VertexShaderConstant[19]={0.5f,0.5f,0.5f,0.5f};

VertexShaderConstant[20]= <vecLight>;

VertexShaderConstant[30]={0f,1f,0f,0f};

VertexShaderConstant[31]={1f,0f,0f,0f};

VertexShaderConstant[32]={0f,0f,1f,0f};

VertexShaderConstant[90]={1f,0f,0f,0f}; //damit oFog gefüllt ist



VertexShader =

decl

{

stream 0;

float v0[3]; //Position

float v3[3]; //Normal

float v7[2]; //Textur Koordinaten 0

}

asm

{

vs.1.0

m4x4 oPos, v0, c0

m4x4 r10,v0,c4

m3x3 r8,v3,c4

mov oT0, v7

mov oT1, v7

mov oT2, v7

mov oT3, v7



//calculate texture space matrix from normal and up

mul r0,c31,v3.zxyw //-1,0,0

mul r1,c32,v3.yzxw //0,0,-1

sub r0,r1,r0



dp3 r0.w,r0,r0

rsq r0.w,r0.w

mul r0,r0,r0.w //normalized right vector



mov r1, c30 //0,-1,0

mov r2, r8



sub r9,c20,r10



dp3 r9.w,r9,r9

rsq r9.w,r9.w

mul r9,r9,r9.w //normalized light vector



m3x3 r3,r9,r0

mov r3.w,c30.w //transform light to texture space



add r3,r3,c18 //bias

mul r3,r3,c19//scale

mov oD0,r3

mov oFog,c90

};

}

}

";

}




action Shader_bumpmap

{

my.material=bumpmap;

}




and I would give that action to the model correct?

OK, my only question is, there is reference to

"Texture[0] = <entSkin2>;//2te Skin im Model ist die Normal Map

Texture[1] = <entSkin1>;//1te Skin im Model ist die Textur"

entSkin2 and 1 being previously defined textures. How do I tell WED/A6/SED/C-Script/MED (whichever needs to know) which texture texture [0] is and which one texture [1] is?

Do I have to assign two skins in MED? the normal map into skin 2 and the actual texture into 1? Have I red this correctly - and if so, how do I do this?

That is the only part I'm stuck on - assigning the two textures to the model, I'm confused as to if I should do this in MED (and if so, how do I assign a second?) or if I have to do it through C-Script.

Thankyou for being patient with me all these times I ask (what to you must seem) basic questions.

Thanks.

Posted By: Drew

Re: Normal Maps? - 07/01/04 04:09

A problem im having with Melody,which is HUGE, is not having the ability to keep my UVW coords from max.
Since I texture bake my characters in max, they have very specific uvw info that actually exports to MDL perfectly.
Thing is, when I export my model as .3ds or .obj into melody , I cant seem to hang onto this info. Melody does a great job of creating new uvw coords for the normal map, so I can export it out to med no problem, model and/or normal map. I did try keeping on the skins mapping coords, but they are scrambled... so if anyne know a way to keep my max uvw info all the way into MED, while creating a normal map that can be imported into skin2 without killing skin1's uvw mapping. the person who can get this to work gets a gold star Im still trying... there is a way, just needs testing... BTW , I did get this to work from polybump, so I know it works great, just that polybump is a demo...
Posted By: myrlyn68

Re: Normal Maps? - 07/01/04 04:18

Are you doing your UVs by hand or just let Max auto-unwrap during the baking process?

If you are using Max to auto-unwrap...why not just have Melody go ahead and do its thing (with messing up your UVs and creating its own) then bring that model back into Max and bake (while disabling the auto-unwrap in Max's Texture Bake).

Just a thought...

I was going to try that out myself (and maybe see if I couldn't figure out the problem you were having specifically...as I don't recall it myself) but my Laptop doesn't support the needed shader version - and I haven't bothered to set my computers back up yet...maybe I'll play abit with it tonight.
Posted By: Drew

Re: Normal Maps? - 07/01/04 06:24

sounds like an awesome idea, thanks Ill try it tonight!

heres a shot I had lying around that shows off the difference in models with and without normal maps..heads on the right side are 700 polys (all the heads top to bottom on the right).. the left side head is 120,652!!


edit
Posted By: Anonymous

Re: Normal Maps? - 07/01/04 16:12

I'm finally getting this - but I don't know how to put 2 skins on a model in MED? Can anyone say how, I've never tried and don't know where to look.
Posted By: Drew

Re: Normal Maps? - 07/01/04 20:14

New shot using normal maps from Melody, IN A6 ...FUN


Posted By: Drew

Re: Normal Maps? - 07/02/04 18:31

I posted a simple playable demo here:

http://216.46.205.166/ubbthreads/showflat.php?Cat=&Number=399097&page=0&view=&sb=5&o=&fpart=1&vc=1&PHPSESSID=
Posted By: Julius

Re: Normal Maps? - 07/02/04 20:59

Like I said in the other post, "awesome!"

Very nice

Julian
Posted By: Anonymous

Re: Normal Maps? - 07/03/04 01:24

Still stuck with assigning 2 maps to a model in MED - I'm sure it's easy, but I can't find out how.

As for the problem with UVW Co-ords being changed when using Melody, there's an option in Melody that allows you to retain the UV coords from the UVMap used for textures - so if you chose that option, you shouldn't have a problem.
Posted By: Orange Brat

Re: Normal Maps? - 07/03/04 01:29

You add skins via the Skin Editor. View -> Skins

There's an option there.
Posted By: Anonymous

Re: Normal Maps? - 07/03/04 01:32

Thanks!

I cant actually try this out yet (though I am desperate to), until I upgrade my gfx card (my current has no pixel or vertex shader support).

However - as soon as I do I can't wait to try out all these cool things. I couldn't believe that this could be done in A6 - all these features present in the most advanced angines (HL2, Unreal) etc. - and yet also implimented in an engine that costs less than £200 - that's incredible - totally awesome!
Posted By: Drew

Re: Normal Maps? - 07/03/04 02:30

yeah it sounds like it should just use the utextures uvw info and work, but it doesn't. somehow it gets scrambled, theres something special about texture baked UVWs...I've found a workaround thats actually much better... using a 3dpaint parogram as an inbetween...
Posted By: Anonymous

Re: Normal Maps? - 07/03/04 02:47

Oh - I dread to think what mine are like - as I don't have a 3d paint proggie - oh well, I might be able to find another solution -unfortunately I can't work on them for at least 2months (which is really annoying) - due to lack of money needed to buy a gfx card.
Posted By: MaxF

Re: Normal Maps? - 07/03/04 02:48

How is Zbrush 2.00 they don't have a demo, I bet it's GREAT right?

NormalMap web page

NormalMap
Posted By: MaxF

Re: Normal Maps? - 07/03/04 03:02

Enter the "normal map". While a height map only contains 1 plane of information - the "Z" (height) plane, a normal map contains 3 vectors of information - "X" direction, "Y" direction and "Z" direction. Thus, each pixel in a normal map encodes which direction that particular point is facing - the "normal vector" of the surface. Each pixel in a normal map has meaningful information, so details can be rendered more crisply than with bump maps alone. This allows modern game engines (Doom III) to more realistically portray the lighting on a surface. A properly constructed normal map can fool the eye into perceiving much more complex 3D geometry on a simple surface. Theoretically, normal maps on a cube can make it appear spherical, at least in terms of shading properties (the outline remains unchanged).

Normal maps use three channels of information to encode their information. This can be conveniently mapped to a standard RGB image. The red channel is used to encode normal vectors in the X direction. 100% red indicates a vector facing right - an X normal direction of +1. 0% red indicates a vector facing left - an X normal direction of -1. A 50% value in the red channel indicates an X normal component of 0. Similarly, the green channel encodes normal vectors in the Y direction. 100% green indicates a vector facing up - a Y normal direction of +1. 0% green indicates a vector facing down - a Y normal direction of -1. 50% value in the green channel indicates a Y normal component of 0. The blue channel encodes normal vectors in the Z direction. 100% blue points straight out of the surface. 0% blue points straight behind the surface. A value of 50% in the blue channel indicates a Z normal component of 0. Normal maps don't contain values below 50% in the blue channel since these would be pointing behind the surface.
______________________
Hope this helps - just for information
Posted By: MaxF

Re: Normal Maps? - 07/03/04 03:09

From ZBrush Site:

-------------------------
Displacement Maps

ZBrush can compare your original mesh to the high frequency model in order to create a grayscale difference map. To do this, you simply import your original mesh back into the lowest subdivision level and then click the Create DispMap button. Alternatively, if the shape of the original low-res mesh needn't be preserved, press the Cage button to generate a base-level object ideal for the calculated map. This cage can then be exported along with the map.

___________________________

Normal Maps

These maps use colors to tell a rendering engine how to perturb the surface normal of an object. Although this does not change the object's silhouette, it does allow remarkably realistic depth effects that are superior to bump mapping.

ZBrush can use Tangent space or Normal space (local and global coordinates), and also has modifiers in the Preferences palette to match how your rendering engine uses the colors in the map
© 2024 lite-C Forums