$mraotexture

From Valve Developer Community
Jump to: navigation, search

Stub

This article or section is a stub. You can help by adding to it.

An example of an MRAO map
A roadmap of a standard PBR texture (With a heightmap embedded into the Normal map) [click to enlarge]

$mraotexture is a material shader parameter available in the following Source Source games or engine branches:
Strata Source Strata SourceTf-16px.png Titanfall engine branch and Hunt Down the Freeman Hunt Down the Freeman. It is available exclusively for the PBR shader to define the MRAO map to use for the Physically Based Rendering effects.

Note.pngNote:This parameter is also available in Thexa4's PBR shader.

Additional Parameters

Frame to use if $maraotexture is animated
Scale the RGB channels of the texture by this amount.
Confirm:Apparently nonfunctional?

Physically Based Rendering

Physically Based Rendering is a photorealistic shading technique that takes lighting information about the metalness, roughness, and ambient occlusion of a texture and then renders lighting in a realistic manner. Most modern game engines utilize PBR for most of their textures, and unfortunately due to the Source Source engine's age, it is not supported by all the official Valve branches. However, some third party games and engine branches support this shader.

What is an MRAO map?

An MRAO (M etalness, R oughness, Ambiemt Occlusion) map is a texture that contains lighting information on the metalness, shininess, and self-shadowing of the diffuse (a.k.a base, albedo) texture through the intensity of the RGB channels. This reduces the amount of texture maps needed for one PBR material from 5 to 3, reducing file space and memory cost. However, image editing programs often do not have an easy way to make these textures. Thankfully, there are a couple of methods to create these textures that work.

Creating an MRAO texture

Note.pngNote:If the program you are using utilizes "smoothness" or "glossiness" maps, make sure to invert the colors of the smoothness/glossiness map before proceeding

There are a couple of methods used to port PBR textures to an MRAO texture. Here are two methods known to work for Strata Source Strata Source based games and also with Thexa4's PBR shader.

Confirm:Do these methods work for other PBR-supported games?

GIMP

First, create a new image with the same resolution as your PBR maps. Next, open your PBR maps with the "Open as Layers..." button. This will open your PBR maps as layers to the current image, and not as separate image files.

Note.pngNote:
Click to enlarge
The images you import must be grayscale. Even if they are visibly grayscale, GIMP may still read them as RGB images. If you are unsure if your images are using the grayscale format, navigate to Image→Mode and make sure that the Grayscale option is checked.

Next, navigate to Colors→Components→Compose and set the Red, Green, and Blue channels to the Metalness, Roughness, and AO layers respectively. Once you are done, export the image to a PNG or TGA file, convert it to a VTF, and then place it in the same folder as your diffuse and normalmap textures.

Next, create a blank VMT file. Copy-Paste the following text:

"PBR"

{ $basetexture "<insert path to diffuse texture>" $bumpmap "<insert path to normal map>" $mraotexture "<insert path to MRAO map>"

$envmap "env_cubemap" $normalmapalphaenvmapmask 1

}

Change the parameters to your specified filepaths, and you are done!

PBR-2-Source

Main article:  PBR-2-Source

Open the program and select "PBR(<desired use>)" in the dropdown on the right. Open each texture in their respective box on the left, select which reflections you want and click "Export".

Icon-Important.pngImportant:You must know what normal map style your material creation program used and set the "Flip Normal Y" box appropriately. If the program you use uses the 3DS Max style, uncheck the box. Otherwise, keep it checked.

Substance Painter

If you have made your textures in Substance Painter, you can export an MRAO texture using a custom Output Template.

Create a new template by pressing the '+' next to Presets in the 'Output Presets' tab of the 'Export Textures' window and create a new 'R+G+B' output map.

Drag the Metallic input map to the R slot, the Roughness input map to the G slot, and the Ambient Occlusion Mesh Map to the B slot. When exported, this will automatically create an MRAO map.

While in this window, you may also add 2 more Output maps, one 'RGB' map for 'Normal DirectX' and one 'RGB+A' map for 'Base Color' and 'Opacity'. This way, you can export all the basic maps you'll need to make a PBR texture in one export window.

SubstancePBRExport.png


See also

External links