Welcome, Guest. Please login or register.
Did you miss your activation email?
March 20, 2019, 05:34:45 am

Login with username, password and session length
Search:     Advanced search
Savage: XR is a new patch for Savage, created by the Newerth.com staff. The XR1.1 Client is out now! Download it now!
189653 Posts in 10987 Topics by 18241 Members
Latest Member: Abigaiper
* Home Forum Wiki Help Search Login Register
+  Newerth Forums
|-+  Archive
| |-+  Modding Forum
| | |-+  INFO: XR Modding Guide #3: Create Normal Maps
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: INFO: XR Modding Guide #3: Create Normal Maps  (Read 10962 times)
Mohican
Order of the Stick
Former XR Dev
Legendary Member
*****
Posts: 2647



View Profile
« on: November 03, 2008, 06:23:47 pm »

This is a tutorial originally written by Case on how to create normalmaps for XR.
So if you want to do some texturing we hope this helps.

What we are going for:
 2 different tools, 2 differents heightmaps, same parallax paramaters -> different result:



Part 1: Whats a normalmap

Quick and easy: A normalmap is nothing more than an image, thats doesnt store color information, but slopes,
where each channel (RGB) represents a dimension (XYZ).
Want to learn more?

Part 2: Get the Tools

1st of all you need some tools to create normalmaps out of a heightmap:

I usually use either the NVidia Plugin for Photoshop:
http://developer.nvidia.com/object/photoshop_dds_plugins.html

or Crazybump
http://www.crazybump.com/


Part 3: Lets get started with terrain

Lately I have implemented terrain shading. Now thats very experimental and ... slow ... because Silverback doesnt give me much options to clip terrain chunks...but thats another story.
So I have decided to work with one of the most ugly textures in Savage.
The infamous nm_stoneroad.tga from the tiledgrassroads set:



which appears in game as:


WTH, its too bright! yeah...another vid_realbright issue...

anyway, so I decided to darken the the texture a bit, so it looks okay with vid_realbright:



which appears in game as:


So after done this small cosmetics lets create a heightmap out of the texture.
Simple desaturate and paint the grass all white, because I just want the cobblestones to be normalmapped.

Heightmap1 and a stronger Heightmap2:

The heightmap will be extremly important for the parallax effects Smiley It is a good idea to save the heightmap, as we will need it later.

Part 3.1: NVidia Normalmap Filter
using the nvidia normalmap filter:



I received these result:


Note:
!!!!!!!!!! this is extremely important !!!!!!!!!!!!!!

As you can see the normalmap appears to be lit
RED from the LEFT and GREEN from the TOP

you can invert the channels to make it fit that way.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Part 3.2: Save the normalmap
So you have saved the heightmap right?
Because now we gonna push it in the alpha channel.




 and the safe it as nm_ng_stoneroad_normalmap.tga.
As we have an alpha channel, we need to save it as 32bit. You can turn on compression if you want.



Part 4: Crazy Bump

Crazy Bump is my favourite tool, not just because its pretty but also because the developer was so kind to implement the storage of the displacement map (heightmap) in the alpha channel after some requests.
Its easy to use, produces nice results and you dont have to have Photoshop!

It looks like this:



Its pretty streightforward:
  • start up Crazy Bump
  • load the Heightmap
  • set some parameters (you gotta experiment with this)
  • render the displacement- map
  • goto to preferences and check 'Save normalmap with displacement in alpha channel'
  • save normalmap

These were my results:



The normalmap must appears as if lit
RED from the LEFT and GREEN from the TOP
once again.  Afro

Now there is one problem with Crazybump and Silverback.
TGAs, saved in Crazybump will appear UPSIDE DOWN in Silverback!
So you have to resave it in e.g. Photoshop! just like in 3.2.

Part 5: Using normalmaps in Silverback

So we have created our neat normalmap! Lets put it into silverback.  Smiley

There are 3 ways to do so:
  • naming it with a _normalmap suffix
  • using the .mat files
  • using the ingame command matSet nm [pic ID] (see 5.1)

"_normalmap" suffix
Lets say we have a zomg.tga base texture.
Simply name your normalmap picture: zomg_normalmap.tga and place it in the same folder as the base texture.

".mat" file
Open or create a file named zomg.mat.
Add the line set mat_normalmap [location_of_normalmap], where location is relative to the 'game' folder.
e.g.:

in nm_stoneroad.mat
add:
set mat_normalmap textures/terrain/tiledgrassroads/nm_stoneroad_normalmap.tga

In heavy_512.mat
add:
set mat_normalmap human/units/legionnaire/heavy_512_normalmap.tga

then in heavy_512_team2.mat
also add:
set mat_normalmap human/units/legionnaire/heavy_512_normalmap.tga

Here you can see how you can reuse normalmaps.  Smiley We dont need an extra normalmap for team2 skins.

Quote
Huh


Q: What happens if there are both e.g:
zomg_normalmap.tga
AND in the zomg.mat file:
set mat_normalmap another_normalmap.tga?


Afro

Well, '.mat' files have priority, so silverback will use another_normalmap.



Part 5.1: Selecting and Editing materials in game
Part 5.2: Lighting parameters: Shininess and Specular
Part 5.2: Parallax parameters: Scale and Bias
Part 6: Glossmaps

.... no yet done ....

« Last Edit: November 07, 2008, 12:19:39 am by SKOPE » Logged

Mohican
Order of the Stick
Former XR Dev
Legendary Member
*****
Posts: 2647



View Profile
« Reply #1 on: November 03, 2008, 06:26:07 pm »

Skope, could you please fill in the details on the Material files?
I think you are the only one left who understands how they work.
Logged

Epoks
Sr. Member
****
Posts: 408



View Profile
« Reply #2 on: November 04, 2008, 01:23:56 am »

This is actually how to make normalmaps in general Tongue Its not XR specific.
I'll fill in the extra details when i get time in a few weeks.
Logged

Django
Administrator
Legendary Member
*****
Posts: 2559



View Profile
« Reply #3 on: November 06, 2008, 04:17:44 pm »

This is actually how to make normalmaps in general Tongue Its not XR specific.
I'll fill in the extra details when i get time in a few weeks.

Great Smiley
Logged
darkbread
Newerth Council
Super Hero Member
*
Posts: 1278


a lump of bread, that is of a dark color...


View Profile
« Reply #4 on: November 06, 2008, 04:51:42 pm »

Added something short about glossmaps
Logged

slaid
Newbie
*
Posts: 31


View Profile
« Reply #5 on: November 06, 2008, 05:32:21 pm »

err, no offense darkbread... but that's the reflection map and not the glossmap.  If I'm not mistaken XR uses phong shading so the attributes you can edit are the cosine power and specular color.  The specular color is what you're actually plugging the _gm textures into.  So it controls the intensity and color of your specular highlight.  Whereas the cosine value, which is controlled in the .mat file by the mat_shininess setting, would control how much your specular highlight spreads out over the surface.

Does XR support reflections someplace that I don't know about?  Environment reflection cubemaps would be cool but seem like an overkill. 
Logged
Epoks
Sr. Member
****
Posts: 408



View Profile
« Reply #6 on: November 07, 2008, 12:15:44 am »

gloss maps aren't specular maps. Specular maps set the amount of brightness a certain area can have when light is shone upon it, where as gloss maps set the concentration of intensity... hard to word this Cheesy
Think of glossiness like on a car, you can have your matte plain car paint which doesn't reflect anything (low glossiness, a dark Grey), and then you can have the glossy, shiney one that has sharp reflections of light along its body (a white or light Grey).
Logged

darkbread
Newerth Council
Super Hero Member
*
Posts: 1278


a lump of bread, that is of a dark color...


View Profile
« Reply #7 on: November 07, 2008, 02:09:36 pm »

errr ok  Tongue
Logged

Pages: [1] Go Up Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2006-2007, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.03 seconds with 19 queries.