PDA

View Full Version : Rendering normal and relief maps in LightWave



aphalien
01-16-2011, 06:11 PM
I know there are many awesome plugins designed for this purpose.
But this funny method allows you to render normal maps directly in LightWave without installing additional plugins or applications.
And i'm also quite sure that some of you have already been using similar technique. Anyway i find it amusing enough to make a thread.

First, get yourself a relatively flat geometry to render a normal map from.
(In his example i used a bunch of different objects) Load it up into Layout.

Create an orthographic camera (you may choose any type of camera you want, but i personally think that orthographic is the most suitable one)
Add three distant lights (for each of the three channels accordingly) and name them "red", "green" and "blue"
Locate these lights in relation to your active camera view as three conditional light directions of a typical normal map image X(R) Y(G) Z(B)
http://img810.imageshack.us/img810/6096/layoutc.png
Now for the very important step, shut ALL the lights down!!! Go to the light properties and enter the intensity value of "0%" for all your lights, and for the ambient light intensity as well.

Then go to the surface editor and do this network.
http://img828.imageshack.us/img828/5018/nodesz.png
Of course it wasn't necessary to create distant lights and the 'light info' nodes to provide a proper vector input for the incidence nodes, i simply found placing distant lights more 'visually clear' to myself.
Three important things here to pay attention to:
(!)-set the incidence range to 180
(!)-set the '128,128,128' RGB value for the gradient position of '0.5' to avoid wonky normals
(!)-set the luminosity value to 100%

Now turn the AA on and hit the F9 key.
You should see something like this:
http://img191.imageshack.us/img191/1265/normalmap.png
If you are about to create a relief map then simply save the depth buffer and use this image as an alpha channel.
http://img826.imageshack.us/img826/8421/depthm.png

!that's it!

funk
01-16-2011, 07:22 PM
This is really cool! Thanks for sharing

kyuzo
01-17-2011, 02:43 AM
Great idea, really simple, and should have been quite obvious!

One tweak - you set a key in the gradient at 128 / 128 / 128 and 50% to "avoid wonky normals" - would setting the gradient interpolation on the keys at 0% and 100% to 'linear' not do the same thing?

But I can definitely see me using this trick from time to time. Thanks for sharing.

Derek

aphalien
01-18-2011, 03:23 AM
You are welcome) Have fun)))


One tweak - you set a key in the gradient at 128 / 128 / 128 and 50% to "avoid wonky normals" - would setting the gradient interpolation on the keys at 0% and 100% to 'linear' not do the same thing?

O_O
oh dear) Yes, you are right! I wonder why didn't i pay attention to this gradient type. I'm sorry)

In fact i have even fUnNiEr method for creating normal maps.
But(!) it implies you to use photoshop (also with NO additional plugins installed, such as nvidia's normal map filter for instance)
And i'm just afraid that i will probably get banned if i post something like this here.

BTW, i forgot to ask you something -does LW10 have a native relief map node now???

Amurrell
01-18-2011, 06:47 PM
Banned why?

aphalien
01-19-2011, 12:21 PM
Banned why?
well, you know...posting any Adobe PhotoShop tricks here on NewTek Lightwave forums. Didn't sound like very a good idea to me)))

aphalien
01-19-2011, 12:45 PM
I assume its the layer technique.

check this:

http://www.cgted.com/

Not exactly) It may be not as advanced and geometrically accurate as the 'layer based' one, but it is definitely easier and -FunNiEr-.
I personally call it the "emboss per-channel method" (Please forgive me my clumsy english)))
In general it is more suitable for converting bump/height maps to normal maps.
http://img96.imageshack.us/img96/1295/ornamentaltile2normal.pnghttp://img833.imageshack.us/img833/650/seamudnormal.png

- All you need is a grayscale bump map like this http://img27.imageshack.us/img27/72/bumpo.pngfor example.
- Convert it to RGB
- Select the red channel first and go to 'Filter->Stylize->Emboss...Enter '180' degrees for the angle value. As for the rest of the filter parameters, in most cases i personally use the following settings: Height=2px, Amount=125%.
- Select the green channel now and do the same, but this time enter '90' for the angle value (or '-90' if you are going to use this map in LightWave only. In this case you won't need to enable the 'invert Y' check-box when setting the 'normal map' node in the node editor)
- Select the blue channel and go to 'Filter->Stylize->Find Edges' The result will appear to be too dark and contrast, and you should lighten it right away. Go to 'Levels' and simply change the shadow output level from '0' to something much greater like '192' or so)))

That is it, You're done with the basic part now.
!!!BUT!!!
You will notice that your normal map is too 'flat' and too boring, and it is not as bumpy-lumpy as you probably expected it to be.
All you need to do now is to blur it in a special manner:
Go to the channels tab and select first two channels, red and green.
Now go to 'Filter->Blur->Gaussian Blur' Enter the radius value you find more suitable for your current image size and detail, and fade it using the 'overlay' blending mode ('Edit->Fade')
http://img151.imageshack.us/img151/8594/psscreen.png
I would also recommend you to make several blur passes with different radius values and different fade opacity percentage in order to achieve more 'suitable' result (but remember not to change the blending mode to something else when fading)

Thanks for reading this delirium:)

http://img602.imageshack.us/img602/4976/wreckedplatforms.png

wyattharris
01-19-2011, 01:15 PM
Ha, clever. I like it. Don't know why I didn't think of that before.

CharlieL
01-19-2011, 01:30 PM
Thanks aphalien!
Great idea. I can easily see some nights pass here, without sleep.

Very interesting.

Aquarian
01-20-2011, 12:14 PM
Great thanks! I have been looking for a good way to get some nice normal maps from lightwave geometry to use with game textures, I'm none too bright so I couldn't figure this out on my own. :D :thumbsup:

Matelot13
01-21-2011, 12:45 AM
Thanks for the info.

To create normal maps in Photoshop, best option (and free) is to use nDo (http://www.philipk.net/ndo.html). Great plugin.

Sensei
01-21-2011, 01:32 AM
Holly molly.. How could you complicate so trivial task.. :D

- using Luminosity 100% and Color input, and setting up all lights to 0% have exactly the same effect as just plugging color to Diffuse Shading..

- there is no need to make three lights at all.. You can replace these Light Info, by Constant > Vector 1,0,0, 2nd one 0,1,0 and 3rd 0,0,1 or negative.. You're interested in just directions (vectors), not whole light item in scene..

- setting up gradient is completely not necessary - you're converting 0.0 to white and 1.0 to black, and then plugging color to Make Color (so go back from color to scalar, loosing GB components) - so it'll have exactly the same effect as using Math > Scalar > Subtract, and subtracting 1.0-input (0 -> 1, and 1-> 0 )

- why to convert from 0->1 and 1->0 in the first place, when Incidence has trigger Invert in its GUI.. Reversing directions (writing -1,0,0 instead of 1,0,0) has also the same effect.

not to mention that the whole network can be replaced by using Spot Info, connecting Normal output to Math > Vector > Add -1,-1,-1, then to Divide -2,-2,-2 and output to Diffuse Shading (or without minuses, to reverse)

zarti
01-21-2011, 02:32 AM
Holly molly.. How could you complicate so trivial task.. :D


...

there is an easier way than yours too ...

> post the .srf file here



:caffeine:

aphalien
01-21-2011, 02:41 AM
Holly molly.. How could you complicate so trivial task.. :D

- using Luminosity 100% and Color input, and setting up all lights to 0% have exactly the same effect as just plugging color to Diffuse Shading..

- there is no need to make three lights at all.. You can replace these Light Info, by Constant > Vector 1,0,0, 2nd one 0,1,0 and 3rd 0,0,1 or negative.. You're interested in just directions (vectors), not whole light item in scene..

- setting up gradient is completely not necessary - you're converting 0.0 to white and 1.0 to black, and then plugging color to Make Color (so go back from color to scalar, loosing GB components) - so it'll have exactly the same effect as using Math > Scalar > Subtract, and subtracting 1.0-input (0 -> 1, and 1-> 0 )

- why to convert from 0->1 and 1->0 in the first place, when Incidence has trigger Invert in its GUI.. Reversing directions (writing -1,0,0 instead of 1,0,0) has also the same effect.

not to mention that the whole network can be replaced by using Spot Info, connecting Normal output to Math > Vector > Add -1,-1,-1, then to Divide -2,-2,-2 and output to Diffuse Shading (or without minuses, to reverse)

wow!Thanks a lot!
I knew about not having to place lights, as i wrote above. And i had in mind exactly the same solution to use vector constants.
But i didn't even think about the rest of the nodes here...I wonder now how easier and logically clear can this network be without all the unnecessary stuff i did!

Again, thanks for a lot for pointing that out. You are a truly Sensei!

Excuse me now, I think i need to go back to my printed manuals for a while)))