Advanced TDM Visuals Tweaking
The scope of this article is to explain the new visual features of TDM 1.03, specifically the Enhanced Interaction Shader and the HDR-Lite Post-Processing, in a little more detail and to point out how they can be tweaked to the user's desires.
Important note: Designers of all sorts (e.g. textureartists, mappers, modellers) should always work with a default setup, to make sure that common users can enjoy a FM the way it's intended.
Altering the Enhanced Interaction Shader
The new interaction shader is responsible for the edge amplification effect of objects and normalmaps, or in lameness terms "the edge detection", how it's more commonly called around the forums. There are no cvars to tweak this effect, instead you will have to edit the actual shader. This can be done as follows:
- Go to your darkmod directory
- Create a folder called glprogs
- Open the file tdm_base01.pk4 in the darkmod directory (To those who don't know: pk4 is simply a renamed zip, so you can open it with pretty much any archiving program of your choice)
- Inside the archive, browse the glprogs-folder and grab a file called test.vfp
- Extract the file to the previously created glprogs-folder inside the darkmod directory
- Open the extracted file with a simple text-editor (e.g. notepad, vim)
- Search for the term "lightParms"
You should see the following now:
#--------------------------------------------------------- # Pramaeters are, respectively: ambient rim scale, diffuse rim scale, min. spec exp, max spec exp; #--------------------------------------------------------- PARAM lightParms = { .7, 1.8, 10.0, 30.0 }; ## rim 4.4, 0.8
The values of interest are of course those inside the curly brackets, which are from left to right as the comment in the above lines suggests: The ambient rim scale, the diffuse rim scale and the general minimum and maximum specularity of surfaces. The latter two parameters are not that interesting, but the rim scale parameters are those responsible for the edge amplification. The first one defines the strength of this effect due to ambient lighting and the diffuse rim scale is used for highlights induced by direct lighting. Raise those values in order to amplify edges more, but please note, that the ambient rim scale is only accounted for when the default ambient rendering method is used and raising that value too high will lead to low contrast images and awkward highlights in almost darkness.
You can apply the changes you made to the shader while playing TDM and directly see the effect:
- Load up the FM of your choice in windowed mode (so that you can switch between TDM and the test.vfp file)
- Make your alterations to the shader and save the file
- Finally issue the command reloadARBprograms to the console or even better, bind this command to a key, e.g. bind backspace reloadARBprograms
Note to Designers: If you want to have a tweaked version of the interaction shader just for playing (and if you don't have a separate install of TDM for working), you'll have to make sure the custom version of the file is not used while working. You could simply rename the file or the folder then.
Tweaking HDR-Lite Post-Processing
The term "Post-Processing" describes the alteration of rendered images and those techniques are for that reason independent of the complexity of a scene. With TDM 1.03 some tone-mapping operators and a new implementation of bloom has been introduced to the community that will be explained now. If you type "r_postprocess" in the console and press tab, you'll receive a list of all the post-processing cvars and if you enter a cvar without assigning a new value, you will receive a description of it in the console.
Bloom
List of cvars and their explanations:
"r_postprocess_bloomKernelSize" is:"1" default:"2" Sets Bloom's Kernel size. Smaller is faster, takes less memory. Also, smaller kernel means larger bloom spread. 1. Large (2x smaller than current resolution) 2. Small (4x smaller than current resolution)
"r_postprocess_bloomIntensity" is:"0.977778" default:"0" Adjusts the Bloom intensity. 0.0 disables the bloom but other postprocessing effects remain unaffected.
"r_postprocess_brightPassThreshold" is:"0.2" default:"0.2" Intensities of this value are subtracted from scene render to extract bloom image
"r_postprocess_brightPassOffset" is:"2" default:"2" Bloom image receives smooth fade along a curve from bright to very bright are as based on this variable's value
Point Operators: Tone-Mapping and Lightness Correction
Tone-Mapping / Color alteration
List of cvars and their explanations:
"r_postprocess_desaturation" is:"0.05" default:"0.05" Desaturates the scene
"r_postprocess_colorCurveBias" is:"0.8" default:"0.8" Applies Exponential Color Curve to final pass (range 0 to 1), 1 = color curve fully applied , 0= No color curve
"r_postprocess_colorCorrection" is:"5" default:"5" Applies an exponential color correction function to final scene
"r_postprocess_colorCorrectBias" is:"0.1" default:"0.1" Applies an exponential color correction function to final scene with this bias. E.g. value ranges between 0-1. A blend is performed between scene render and color corrected image based on this value
Linear and Gamma Lightness Correction
List of cvars and their explanations:
"r_postprocess_sceneExposure" is:"0.9" default:"0.9" Scene render is linearly scaled up. Try values lower or greater than 1.0
"r_postprocess_sceneGamma" is:"0.82" default:"0.82" Gamma Correction.
So why is it called "HDR-Lite" anyway?
During development the team of developers ran into several problems with the original HDR implementation, including performance issues and some visual artifacts, that were hard to circumvent given the fact that the the source of idTech 4 is still closed. It was then decided not to work on the basis of an actual "High Dynamic Range", but to still maintain most of the resulting effects. The HDR implementation was altered and split up into the new Enhanced Interaction Shader and the HDR-Lite Post-Processing.