Page 1 of 1

REQ: S3O normal-maps

Posted: 06 Jan 2009, 23:32
by Kloot
I recently added the necessary C++ infrastructure to calculate vertex tangents
Tangents.png
(427 KiB) Downloaded 118 times
for non-empty S3O model pieces (if defined as triangles or tristrips, quaddies get left in the cold) to Spring. That means you'll be able to easily try out techniques such as normal-mapping and friends via Lua-side shaders (or at least those of you familiar with GPU programming will ;)) on any new and existing models after the next engine release. I've also prepared an example shader widget, so if you provide me with some normal-maps (and the S3O's to which they should be applied if those aren't readily up for grabs) I'll slip you a sneak peak. (The maps are required to be in tangent-space and should follow the UV layout of your diffuse textures, ie. they should look like this rather than like this or like this.) Nvidia's PS plugin is probably one of the quickest ways to generate them if you can live with the results.

Re: REQ: normal maps

Posted: 07 Jan 2009, 08:29
by thesleepless
awesome, i'd like to try this out, normal maps are pretty easy to generate

Re: REQ: normal maps

Posted: 07 Jan 2009, 10:55
by Hoi
Making a hipoly model and then generating it is better then the plugin though.

Re: REQ: normal maps

Posted: 07 Jan 2009, 18:48
by Argh
Yay!

Re: REQ: normal maps

Posted: 07 Jan 2009, 19:08
by Hoi
while we're talking about normal maps anyway, what are the diffrences between
Image
and
Image?

Re: REQ: normal maps

Posted: 07 Jan 2009, 19:20
by Argh
@Hoi: The first example appears using non-tangental vectors, so far as I can see from a glance.

Re: REQ: normal maps

Posted: 07 Jan 2009, 19:35
by Hoi
So, what does that mean? the wikipedia article on normal mapping doesn't have the information I need, what are the pros and cons of the 2?

Re: REQ: normal maps

Posted: 07 Jan 2009, 19:45
by Pxtl
Hoi wrote:So, what does that mean? the wikipedia article on normal mapping doesn't have the information I need, what are the pros and cons of the 2?
Okay, in one case the normal map is relative to the whole model, in the other the normal map is relative to the polygon that the map is stuck to.

Notice how, while the shape of the model is unwrapped, the shading of the normal map in the face doesn't really looked "unwrapped" - the stuff on the left is shaded to face the left, the stuff on the right is shaded to face the right. In the other case, it just looks embossed - the shading of normal map looks like it is generally facing outwards with some details. Don't know the pros and cons - I imagine animating the latter works much better, since the normals will move with the individual polys.

Re: REQ: normal maps

Posted: 07 Jan 2009, 19:51
by Argh
Well, basically, you want all of your bumps to face "out" from the triangles of the surface, insofar as that's possible. Normal maps don't perform correctly, if you feed them garbage data about your vectors in relation to the vertexes of your object.

IOW... the easy way to do normal maps, for mechanical crap, is to just do a grayscale, with somewhere around 128,128,128 as the "neutral" value, everything above / below it lighter / darker, then use the nVidia DDS plugin (or ATi's Compressionator, or any number of other tools) to transform this into a normal map, for a simple (and admittedly simplistic) bumpmap effect.

For really sophisticated stuff, like volumes on high-detail organics, etc, I think that it's just plain impossible to do, without a complex high-poly model and Blender or another modeling / rendering environment that can render normalmaps.

BTW, Wings can be used as a subdivision surface modeler, or export tool for export to such an environment, and you can, IIRC, force all facets to quads, which might be an extremely light / cheap way to get them into certain applications used for 3D painting and have them work well.

Just build your model as usual... set up the uvmap (very important, must do this part BEFORE), save the model... export to Wings (or just make new file with a copy of the original, or whatever) convert all triangles back to facets, then to quads, then export to Deep Paint 3D or whatever. Should work, in theory.

Re: REQ: normal maps

Posted: 07 Jan 2009, 20:50
by thesleepless
the way i do it,

for mechanical things, i'll make my model then make a duplicate, add details to its mesh, once the low poly model has UV maps you can then bake the tangent normals onto the texture.

i'll try and make a tutorial for it soon

Re: REQ: normal maps

Posted: 07 Jan 2009, 23:36
by rattle
Argh wrote:@Hoi: The first example appears using non-tangental vectors, so far as I can see from a glance.
The first one looks traced while the others look generated...

red: left to right
green: up to down
blue: height (bumpmap)

Re: REQ: normal maps

Posted: 07 Jan 2009, 23:56
by Argh
BTW, if you want to mess around with generating normalmaps using a high-detail mesh, here's a tool to help get you started:

http://developer.nvidia.com/object/melody_home.html

Re: REQ: S3O normal-maps

Posted: 08 Jan 2009, 18:14
by krychle
Best Blender tutorials for baking textures...

Normal maps:

http://wiki.blender.org/index.php/Manua ... ormal_Maps

http://blenderartists.org/forum/showthread.php?t=138194

Ambient occlusion for nice shading:

http://www.katsbits.com/htm/tutorials/b ... errain.htm

Re: REQ: S3O normal-maps

Posted: 09 Jan 2009, 00:42
by rattle
I've baked a normal map in Blender before, it's part of the noob to pro wikibook. So you may want to look at that.

I've also done several AO bakes in Blender and I have to say, unless you use Blender for modeling as well, I'd try to use a different tool, because setting the model up for baking can be rather painful and time consuming. The same applies to baking normals.

Re: REQ: S3O normal-maps

Posted: 11 Jan 2009, 20:57
by Wolf-In-Exile
Kloot, here's a roughly done model with normal mapping, 2116 tri model, normal map generated from 32k hi-poly.
Didn't separate the parts cause I figured its only for testing and the polycount's too high anyway.

If you want it lemme know where to send it.

The normal mapped details aren't very deep, but the rounder edges translated quite well although I didn't bother cleaning up the normal map much.

Image

Re: REQ: S3O normal-maps

Posted: 11 Jan 2009, 21:42
by trepan
I don't know what format yall are going to use for your heightmaps,
but I suggest you standardize on a format the also contains the
normalized depth component, example:

channels:
R(0) Nx (Normal X component)
G(1) Ny (Normal Y component)
B(2) Nz (Normal Z component)
A(3) Dp (normalized depth)

You can also use a theta/phi system for the normal (score an
extra channel for something else), but that means that there's
going to be more GPU calcs.

The normalized depth component can be used for such shader
techniques as relief mapping (self-shadowing. It's also handy
for the simpler parallax shading technique, which is standard
normal mapping, but with a texture offset based on the depth
component and view vector. You can also use the depth
component for displacement mapping.

I've recently added lua client-side scripting to the BZFlag game.
Yall might benefit from the shaders and material management
scripts that are being used there (join the test server, save the
world). Here's a screenshot of plain relief mapping (haven't added
lua rendered shadow mapping, yet):

Image

P.S. the primary texture format that I use for opaque materials is RGBS(specular)

Re: REQ: S3O normal-maps

Posted: 11 Jan 2009, 22:17
by Hoi
Trepan that is win and it would even more win if it'd be in the next spring version :wink:

Re: REQ: S3O normal-maps

Posted: 11 Jan 2009, 22:22
by trepan
It's already in Spring, you just need to write the lua and shaders
(or copy it from the work that I'm doing for BZFlag).

P.S. One thing that BZFlag does better than Spring (imo), is that
they use X/Y for the ground plane. That might affect how some
of the code would work. The other adjustment I made to the lua
GL API for BZFlag is that all GL resources are done with lua
userdata objects (including dlists, textures, and shaders).

Re: REQ: S3O normal-maps

Posted: 13 Jan 2009, 00:39
by Keithus
Woot, normal maps. ^^ Introduce bones for organic rigs and spring will be an engine to be feared.... or used.