Photoshop environment mapping

From Nexus Mods Wiki
Revision as of 18:16, 20 June 2011 by Leakingroof (talk | contribs) (Created page with "Environment Mapping in Fallout 3: with Ghogiel ==Overview== A basic tutorial that demonstrates how to create custom environment/reflection maps, setting them up on your models...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Environment Mapping in Fallout 3:

with Ghogiel

Overview

A basic tutorial that demonstrates how to create custom environment/reflection maps, setting them up on your models, masking, how they work in practical use, plus a few examples. I have writen this as it seems I am the only one who figured out how they properly work. As evidenced with all of the released mods I have inspected which attemped to use custom env maps.

Apps:

Photoshop

nvidia dds plugin

nifskope


To Create a Custom Environment Map

Firstly I am no expert, I am just documenting my experiments for others to benefit from. So go google cube mapping and Environment/reflection mapping, and you'll know more than me pretty quickly.

First thing you will need to do is make a document with the dimensions of, say 768x128. This is a decent size map, but shouldn't strain a medium system. If the need suits you, going smaller or larger is fine.

What is important, is it has to be ratio of 6x1. If you see a mod with a _e.dds and it isn't in this dimension , then it won't work, and the GECK and the game will not render it. (because to actually save a cube map it has to be 6x1)

Now get any old image, landscapes scenes are probably the most common image. CGtextures.com has a few good ones. In this example my first env map is actually a forest scene, and is 384x64.

Go and save it. you need to save it as a Cube Map. Or else the game ignores rendering the env map, citing a error that the texture doesn't have mipmaps. Save as a dds. To select "Cube Map", it's under the drop down that lists 2d texture. mipmaps ticked. leave everything as defaults.


Photoshop environment mapping image 1.jpg


Now you have created an environment map. They are usually marked by the extention of "_e.dds". It doesn't matter that it has that extension, but for anyone inspecting your files, it'll make it easier to understand what actually is what.(and probably yourself).


Setting Up Environment Maps and Environment Masks

In nifskope.

Open the mesh you want to add a environment map to.

Open the BSSaderPPLighting node, and select the BSShaderTextureSet

In Block details expand the list of texture.

This is a list of what nifskope improperly displays as what particular map corresponds to a particular slot. And Where I corrected it.


Photoshop environment mapping image 2.jpg



input your _e.dds into the second to last slot.

You must tick the shader flag for SF_MULTIPLE_TEXTURES or else your env mapping won't be rendered.

Save.

to get a preview of the mesh, check the model in GECK model viewer. right click the .nif >open with... >GECK.


Examples and Practical use

Here is the texture sheet for my example.



Photoshop environment mapping image 3.jpg


What it looks like rendered in the GECK.


Photoshop environment mapping image 4.jpg



You can very clearly see all of the maps at work. Notice how the diffuse map is in a way completely over ridden by the Env map. I can still pick up something from it, but it looks more like a really strong reflection map and not like my diffuse map does. This is because of the completely white env mask (_em.dds)texture.

Here are several tests.


Photoshop environment mapping image 5.jpg



As you can see by simply changing blank white or blank black _em.dds, I get startling results. And if I change the _e.dds, I can get a really nice chromed effect.

Now we have talked about the environment maps. I want to mention environment masks. As you can see from my test picture, the base of the mask is 128RGB. This means that a flat grey 128RGB _em texture on a mesh with a env map, will look exactly the same as if it has no mask at all. So you can overdrive the Env map effect by going over that threshold. You start to get a really chromed look the closer to white you go. Now going the opposite way you remove the reflective effect.

The environment mask can be used as a mask(duh). To mask parts of the texture/mesh, thus making it appear to have several different materials on one model. Simply put, black = zero reflections, midgrey = normal reflections, White = super chrome

Important- It appears that when a _em.dds map is not present. The engine automatically defaults to using the specular map to mask the env map. in the example above, if you look at my spec map, the visor area is really bright. It's that bright strip at the bottom. And looking at the examples that have no _em map on them, you can see that the visor looks nearly identical to the examples with the white _em map.

Also might be worth noting- The cube map Fallout 3 uses, is simply 6 square images in a row. 1 each belonging to a side of the cube. The first 4 are wrapped around the sides of the mesh, and the last 2 images are displayed on the top and bottom. Making a proper cube map will ensure that sky(faux) reflections do not appear on the bottom of the mesh, and ground reflections do not render on the top.

This is where Fallout 3 displays each side of the cube map.


Photoshop environment mapping image 6.jpg



I am not going to cover how cube maps are rendered in game or making true cube maps in this tutorial. Here is the tutorial/experiment I wrote to cover that.

Link

Oblivion had a few env maps hard coded, changing one, in effect changed all items which used it. But Fallout supports Custom environment maps which allows for a great deal of creative usage.

Links and Resources:

Example cube maps.

Ati Cube Mapping Tool