Creating PBR materials: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Replaced content with "{{Delete|reason=moved}}")
Tag: Replaced
Line 1: Line 1:
{{Language subpage}}
{{Delete|reason=moved}}
[[Physically Based Rendering]] is an excellent shading technique that gives modders the ability to create amazing photorealistic maps. However, the creation process for PBR materials is much different from that of standard {{Source|4}} materials, and many modders new to the PBR workflow may not know how to create them. This article will review the process of creating a PBR material.
 
==Overview==
A PBR material consists of 3 main files:
*A [[$basetexture|Diffuse]] (base) texture
*A [[Bump map|Normal]] map (optionally with a [[Heightmap]] embedded in the Alpha channel
*A [[$mraotexture|MRAO]] map, containing information on the Metalness and Roughness data as well as Ambient Occlusion
While the Diffuse and Normal map textures may already be part of the standard Source texture workflow, the MRAO map may present some difficulty to create, as standard image editing programs do not have ways to create the textures needed to make an MRAO texture. Modeling programs, such as {{blender|4}}, and image-to-texture programs, such as {{materialize|4}} can create such materials.
{{Creating a MRAO map}}
 
==Embedding the Heightmap==
{{Confirm|What other games support heightmaps?}}
{{Strata|2}} games, mods with Thexa4's PBR shader, and {{bms|2}} support embedding a Height map into the alpha channel of the Normal map, which is used for [[Parallax mapping]], giving more depth to the material without the need for unnecessary brushwork or complicated models. This can be done through GIMP very easily. <br>
First, open both your Normal and Height maps as separate images. Next, click once on the height map and copy ({{key|Ctrl}}+{{key|c}}) the image. Next, go to your Normal map, find the layers box, and right-click on the active layer. Click "Add layer mask", then click OK (the type is not important). Finally, with the layer mask selected, paste ({{key|Ctrl}}+{{key|v}}) your Height map. Your Normal map should now appear transparent, this is intended. Export your image as a PNG (so the transparency persists) and convert it into a VTF. Next, add the following to your VMT file:
==={{Strata|3.1}}/Thexa4 games===
{{CodeBlock|style=1|1=<nowiki>//Parallax mapping
$parallax "1"
$parallaxcenter "0.5" //controls the height of the highest point on your heightmap. Higher values = Closer to the applied face. Make sure this is adjusted so the highest point is flush with the floor/wall!
$parallaxdepth "0.10" //controls the intensity of the heightmap. Higher values = more depth
</nowiki>}}
 
==={{bms|3.1}}===
{{CodeBlock|style=1|1=<nowiki>//Parallax mapping
"$pomscale" "0.07"    //controls scale of parallax mapping
"$pomminsamples" "0"  //controls min depth of parallax mapping.
"$pommaxsamples" "300" //controls max depth of parallax mapping.
</nowiki>}}
For full details on these parameters, see [[Parallax mapping#Parallax_occlusion_mapping_in_Black_Mesa|this page]]
===Adjusting the parameters===
You can adjust the parameters to your liking to get the effect you want. Remember, if you emphasize the effect too much, it can [[:File:PMax2 weapon headcrab .png|look ugly]].
 
If your game runs on Strata, you will be adjusting two main parameters. The first is [[$parallaxdepth]], which controls the depth of the ''lowest'' point of the material, or the strength of the Heightmap. This parameter does accept precision up to the hundredths place, on a scale of 0 (no depth) to 1 (maximum depth) so you can adjust this to the precision of your liking. This parameter will do most of the work of how your material will appear.
 
The second and most important parameter is [[$parallaxcenter]], which controls the depth of the ''highest'' point of the material. This parameter also accepts precision up to the hundredths place as well, on a scale of 0 (closest to face) to 1 (farthest away from face). This parameter needs to be adjusted until the highest point of your material is "touching" the face, otherwise it will appear to extend past the neighboring faces very unrealistically.
{{expand|title=Examples|startcollapsed=0|[[File:Parallax_ex1.png|450px|No Parallax|thumb]]
<br>[[File:Parallax_ex2.png|450px|Properly adjusted parallax|thumb]]
<br>[[File:Parallax_ex3.png|450px|Improper $parallaxcenter|thumb]]
<br>[[File:Parallax_ex4.png|450px|Improper $parallaxdepth|thumb]]
}}
 
{{Todo|BMS}}
 
===Conclusion===
If you followed all these steps correctly, parallax mapping should now be enabled on your material. Don't be afraid to experiment, and remember that if your material doesn't quite work with parallax mapping, you can always turn it off.

Revision as of 10:07, 16 November 2023

Warning icon.png
This article has been marked as a candidate for speedy deletion because it has moved, and no longer linked to.
If you object to this decision, then please discuss why here (If you make a discussion section also create this redirect page). If this page doesn't meet the criteria for speedy deletion, then please remove this notice, but do not remove it from pages that you have created yourself
Administrators / Moderators - Remember to check if anything links here and the page history before deleting.