Skip to content

Doc_Halo1_ShaderExtension

Noah Sherwin edited this page Aug 28, 2020 · 7 revisions

Shader Extension

Object Shader Extensions

Specular Map

The specular map allows you to change the colour of the models specular reflection at the pixel level.

Specular Map

Field Type Usage
specular color map tag reference The specular colour map.
specular color coefficient real The specular map colour is multiplied by this value. 0 defaults to 1.
specular color exponent real The specular map colour is raise to this power. 0 defaults to 1.
flags word flags Sets whether to use the alpha channel as an exponent mask.

Normal Maps

Normal maps allow you to add per pixel details to a model. They are typically created by baking the surface normals of a high resolution model into a bitmap using the texture coordinates of a low poly model. Normal maps must be in tangent space.

Detail normal maps can be used to add further close up details. The alpha channel of the base normal map controls how the detail normal maps are blended.

Alpha range Usage
0/0.000 ===> 85/0.333 No detail normals to detail normal 1.
85/ 0.333 ===> 170/0.666 Detail normal 1 to detail normal 2.
255/1.000 ===> 255/1.000 Detail normal 2 to no detail normals.

Normal Maps

Field Type Usage
base normal map tag reference The base normal map.
base normal coefficient real The strength of the base normal map.
detail normal 1 map tag reference The first detail normal map.
detail normal 1 coefficient real The strength of the normal map. 0 defaults to 1.
detail normal 1 scale real The texture coordinate scaling of the normal map. 0 defaults to 1.
detail normal 1 v-scale real The additional V-texture coordinate scaling of the normal map. 0 defaults to 1.
detail normal 2 map tag reference The second detail normal map.
detail normal 2 coefficient real The strength of the normal map. 0 defaults to 1.
detail normal 2 scale real The texture coordinate scaling of the normal map. 0 defaults to 1.
detail normal 2 v-scale real The additional V-texture coordinate scaling of the normal map. 0 defaults to 1.

Specular Tint Override

The specular tint override replaces the matching values in the base tag, since you may want different values to compliment the specular colour map.

Specular Tint

Field Type Usage
perpendicular brightness real fraction The brightness of the perpendicular specular reflection.
perpendicular tint color real argb colour The tint colour of the perpendicular specular reflection.
parallel brightness real fraction The brightness of the parallel specular reflection.
parallel tint color real argb colour The tint colour of the parallel specular reflection.

Diffuse Lighting

This section only applies when using the shader on BSP.

Diffuse Lighting

Field Type Usage
flags word flags Controls whether directional lightmaps should be used with this shader.

Specular Lighting

The OS shader model shaders allow you to have specular reflections on your models.

Specular Lighting

Field Type Usage
specular lighting exponent real The specular reflection is raise to this power, which controls the size of the highlight.
specular lighting coefficient real The specular reflection is multiplied by this coefficient, which controls the brightness of the highlight.

Environment Shader Extensions

Directional Lightmaps

OpenSauce adds directional lightmaps to the engine (As used in Valve's source engine) which allows you to have normal mapped static lighting on BSP. The shader uses the shader environments normal map.

Directional lightmaps are created in 3DS Max using the provided lightmap rendering script, or in Maya using it's built in DLM renderer (used to be called Turtle). The rendered lightmaps are added to the scenario tag as part of the BSP modifier system.

Directional Lightmaps

Field Type Usage
flags word flags Controls whether directional lightmaps should be used with this shader.
bump amount real Controls the strength of the shader's normal map.

Specular Directional Lightmaps

With access to directional lightmap data it has been possible to add a type of static specular lightmapping to the engine. The shader uses a reflected eye vector to sample the diffuse lightmap to get the light accumulated from the specular direction. Specular DLM's are reliant on diffuse DLM's, so they will also be disabled if diffuse DLM's are disabled.

Specular DLM colour map

The specular map allows you to change the colour of the specular reflection at the pixel level.

Specular Map

Field Type Usage
specular color map tag reference The specular colour map.
specular color coefficient real The specular map colour is multiplied by this value. 0 defaults to 1.
specular color exponent real The specular map colour is raise to this power. 0 defaults to 1.
flags word flags Sets whether to use the alpha channel as an exponent mask.

Specular DLM tint and brightness

The specular tint and brightness values control the colour of the specular reflection at direct and glancing angles.

Specular Tint

Field Type Usage
perpendicular brightness real fraction The brightness of the perpendicular specular reflection.
perpendicular tint color real argb colour The tint colour of the perpendicular specular reflection.
parallel brightness real fraction The brightness of the parallel specular reflection.
parallel tint color real argb colour The tint colour of the parallel specular reflection.

Specular DLM intensity

These values are not the same as those in the shader model tag. Lightmaps are pre-calculated colours values baked into a bitmap, and as such the data required to calculate the specular attenuation correctly is not available. So to get the specular attenuation, the shader uses the luminosity of the diffuse lightmap to which the following values are then applied. You will need to try it out and choose values that are best for you. This isn't a realistic lighting algorithm by any means but it can produces reasonable results.

Specular Lighting

Field Type Usage
specular lighting exponent real The specular reflection is raise to this power, which controls the size of the highlight.
specular lighting coefficient real The specular reflection is multiplied by this coefficient, which controls the brightness of the highlight.

Effect Shader Extensions

The effect shader is a transparent shader used in particle systems. As such, you will find extension values available in the contrail, particle, particle_system and weather_particle_system tags.

Depth Fade

Effect depth fading allows you to soften the edges of your effects when close to opaque meshes, and when close to the camera. Depth fading relies upon the depth buffer in the GBuffer. If the GBuffer is disabled or unavailable, depth fading will not be used.

Depth Fade

Field Type Usage
depth fade distance real The fade out start distance when close to an opaque surface.
camera fade distance real The fade out start distance when close to the camera.
Clone this wiki locally