Tempust85 Posted July 16, 2017 Share Posted July 16, 2017 About MTR Shaders An .MTR shader is a copy of the standard .SHADER. You only can use an .MTR shader IF there is a .SHADER shader of the same name already present, due to how it's loaded by the OpenGL 3 "rend2" renderer. This is to allow one shader (.SHADER) for the OpenGL 1 "vanilla" renderer, and a different shader (.MTR) for the OpenGL 3 "rend2" renderer. If you're only creating assets for OpenGL 3 "rend2" (which DF2 Mod only uses), then just use the .SHADER extension. Sun Shader Example ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // q3gl2_sun <red> <green> <blue> <intensity> <degrees> <elevation> <deviance> <shadow map scale> <ambient light scale> // // // red green blue : Color is described by three normalized RGB values. Color will be normalized to a 0.0 to // 1.0 range, so it doesn't matter what range you use. // // intensity : The brightness of the generated light. A value of 100 is a fairly bright sun. The intensity // of the light falls off with angle but not distance. // // degrees : The angle relative to the directions of the map file. A setting of 0 degrees equals east. // 90 is north, 180 is west and 270 is south. In the original version of Q3Map, non-axial values had a // tendency to produce jagged shadows. With Q3Map2, this problem is avoided with new options like lightmap // filtering, raytracing and penumbra effects. // // elevation : The distance, measured in degrees from the horizon (z value of zero in the map file). // An elevation of 0 is sunrise/sunset. An elevation of 90 is noon. // // deviance : The number of degrees for the half-shadow. General values up to 2 or 3 are acceptable. The real // sun has a solid angle of about half a degree. // // shadow map scale: range = 0.0-1.0. 0.0 = not visible, 1.0 = black shadows. // // ambient light scale: range = 0.0-1.0. // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // q3gl2_tonemap <toneMapMin> <toneMapAvg> <toneMapMax <autoExposureMin> <autoExposureMax> // // // toneMapMin: Default = -8.0. Determines minimum lighting. // // toneMapAvg: Default = -2.0. Determines average lighting. // // toneMapMax: Default = 0.0. Determines maximum lighting. // // autoExposureMin: Default = -2.0. Determines minimum auto exposure. // // autoExposureMax: Default = 2.0. Determines maximum auto exposure. // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// textures/skies/df2_katarn { qer_editorimage textures/skies/sky surfaceparm sky surfaceparm nomarks surfaceparm noimpact surfaceparm nolightmap q3gl2_sun 1.00 0.89 0.81 500 250 75 3 0.5 0.3 q3gl2_tonemap -8.0 -2.0 0.0 0.0 0.75 q3map_nolightmap skyParms textures/skies/sulon 512 - } ..Liquid Shader Example ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // liquid <color rgb > <fog color rgb> <height> <choppy> <speed> <frequency> <depth> // // // color: Set the waves color. // // fog color: Set the fog color. Use this to adjust the base color of the water. // // height: Set how intense the water's parallax effect is. // // choppy: Set how choppy the water is. // // speed: Set the speed of the water effects. // // frequency: Set the frequency of the water effects. // // depth: Range = 0.0 - 1.0. Set the fog density inside the water. 0.0 is not dense, 1.0 is dense. // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// textures/DF2_water/water { qer_editorimage textures/system/water qer_trans 0.8 // transparency in Radiant surfaceparm nonsolid // surface is non solid surfaceparm nonopaque // surface is transparent surfaceparm trans // surface is transparent 2 surfaceparm water // water characteristics surfaceparm nomarks // water characteristics q3map_material Water // water characteristics 2 //liquid <color rgb> <fog color rgb> <height> <choppy> <speed> <frequency> <depth> liquid .80 .90 .60 .10 .19 .22 0.9 1.5 60 6.56 .3 }..Texture Workflows There are two workflows for you to choose from: 1) Gloss - Uses diffuse map, + normal map + specular (RGB = specular, A = gloss)2) Roughness - Uses albedo map + normal map + RMO (R = roughness, G = metalness, B = ambient occlusion) Use one workflow per stage - you cannot combine them in the same stage. You can for example, use the Gloss Workflow for shader stage 1 and use the Roughness Workflow for shader stage 2 just fine though. Workflow Roughness Size restrictions: RMO & Albedo textures must be the same size. See example below. Yes - Albedo = 1024x1024, Normal = 1024x1024, RMO = 1024x1024No - Albedo = 1024x1024, Normal = 1024x1024, RMO = 512x512 Normal Map Setting: You can add a setting below your "normalMap" or "normalHeightMap" line to flip either the red or green channels of the normal map. You can also use this to increase the intensity of your normal map. Default setting is "normalScale 1 1". Examples: normalScale 1 -1 - this will invert the green channel, while leaving the red channel alone.normalScale 2 1 - this will increase the red channel's intensity, while leaving the green channel alone.normalScale -2 1 - this will invert the red channel and increase its intensity, while leaving the green channel alone. Glass Shader Example This shader will give you a transparent image, with cubemap reflections. This shader expects the use of TGA. You must use a "lightmap" in your shader, otherwise your glass will not display properly. Using the "roughness" workflow, the albedo texture's alpha channel contains the opacity: textures/DF2_glass/glass1 { qer_trans 0.5 { map textures/DF2_glass/glass1 blendFunc GL_ONE_MINUS_SRC_ALPHA GL_SRC_ALPHA normalMap textures/DF2_glass/glass1_N normalScale 1 -1 rmoMap textures/DF2_glass/glass1_RMO } { map $lightmap blendFunc GL_DST_COLOR GL_ZERO } } .Using the "gloss" workflow, the diffuse texture's alpha channel contains the opacity: textures/DF2_glass/glass1 { qer_trans 0.5 { map textures/DF2_glass/glass1 blendFunc GL_ONE_MINUS_SRC_ALPHA GL_SRC_ALPHA normalMap textures/DF2_glass/glass1_N normalScale 1 -1 specularMap textures/DF2_glass/glass1_SPEC } { map $lightmap blendFunc GL_DST_COLOR GL_ZERO } } ..Level & Model Texture Shader Examples: Normal (no height) Shader: Workflow Gloss: Diffuse, Normal, Specular, Lightmap. textures/DF2_cargo/wall_6 { { map textures/DF2_cargo/wall_6 normalMap textures/DF2_cargo/wall_6_n specularMap textures/DF2_cargo/wall_6_spec } { map $lightmap blendFunc GL_DST_COLOR GL_ZERO } }.Workflow Roughness: Albedo, Normal, RMO, Lightmap. textures/DF2_cargo/wall_6 { { map textures/DF2_cargo/wall_6 normalMap textures/DF2_cargo/wall_6_n rmoMap textures/DF2_cargo/wall_6_RMO } { map $lightmap blendFunc GL_DST_COLOR GL_ZERO } } ..Normal + Height Shader: Workflow Gloss: Diffuse, Normal + Height, Specular, Lightmap. textures/DF2_cargo/wall_6 { { map textures/DF2_cargo/wall_6 normalHeightMap textures/DF2_cargo/wall_6_nh specularMap textures/DF2_cargo/wall_6_spec } { map $lightmap blendFunc GL_DST_COLOR GL_ZERO } }.Workflow Roughness: Albedo, Normal + Height, RMO, Lightmap. textures/DF2_cargo/wall_6 { { map textures/DF2_cargo/wall_6 normalHeightMap textures/DF2_cargo/wall_6_nh rmoMap textures/DF2_cargo/wall_6_RMO } { map $lightmap blendFunc GL_DST_COLOR GL_ZERO } }..Model Shader: Workflow Gloss: Diffuse, Normal, Specular. models/players/kyle/torso { { map models/players/kyle/torso rgbGen lightingdiffuse normalMap models/players/kyle/torso_n specularMap models/players/kyle/torso_spec } }.Workflow Roughness: Albedo, Normal, RMO. models/players/kyle/torso { { map models/players/kyle/torso rgbGen lightingdiffuse normalMap models/players/kyle/torso_n rmoMap models/players/kyle/torso_RMO } } minilogoguy18, Sir Crusher, Psyk0Sith and 3 others like this Link to comment
Recommended Posts