Skip to content

Tracks – Miscellaneous options

Ilja Jusupov edited this page Dec 5, 2023 · 4 revisions

A bunch of small things that might be interesting to configure.

Spectator flashes

CSP update 0.1.77 adds camera flashes for track spectators triggered automatically in areas with spectators when something interesting is happening close to them. To activate them, use something like:

[CONDITION_...]
NAME = CROWD_FLICKERING_NEW
INPUT = SUN
LUT = (|0=0|85=0|85=1|180=1)

[SPECTATORS]
FLASH_INTENSITY = CROWD_FLICKERING_NEW

Or just set a fixed value instead of condition, like 1. Or set it to 0 if flashes are inappropriate on your track (or don’t, it’s the default value).

Distant geometry

Simply use [Material_DistantGeometry] from “materials_track.ini” to make a mesh visible no matter how far it is. However, if it’s too far, some Z-fighting issues might start to appear. In such case you can simply draw those meshes first (by arranging draw order accordingly) in the correct order with depth testing set to LESSEQUAL.

Colorful refracting glass

Just look for [Material_Glass] in “materials_glass.ini”. MaskPass can make glass colorful (multiplying colors behing it), and Refraction parameter adds refraction. Also, RefractionBias can be used to blur things behing the glass for some sort of frosted glass effect. Only works with meshes with transparent flag.

Light pollution at nights

You can raise the overall ambient base brightness at night around some given radius by a defined density. Only one such section per track config is supported atm.

[LIGHT_POLLUTION]
RELATIVE_POSITION = 0, 0, 0  ; all values in KM except density/color of course
RADIUS_KM = 0.5
DENSITY = 0.35               ; percent/100
COLOR = 0.95, 0.8, 0.7       ; r,g,b

Aligning trees with underlying surface

If your track has a lot of hills with vegetation on them, it might look out of place if trees and bushes would be evenly lit on both sunny and shadowy side of a hill. Use this to connect lighting of vegetation with lighting of a surface below it:

[ALIGN_TREES_...]
SURFACE_MATERIALS = terrain_01
TREE_MATERIALS = shader:ksTree

It would slightly increase initial loading time, but after that the computed data would be cached.

Fix for tree triangles aligning with view direction

While new trees are still in development, here is a cheap and easy fix hiding tree triangles aligned with camera view and looking as thin lines because of that:

[SHADER_REPLACEMENT_...]
MATERIALS = shader:ksTree?
MATERIAL_FLAG_0 = 1

Double-biased shadows

If you see shadows on your track getting detached from objects that cast them, an easy way to fix the issue would be to use double-sided biased shadows:

[SHADER_REPLACEMENT_...]
MATERIALS = building?, box?
DOUBLE_FACE_SHADOW_BIASED = 1

You can just use “?” for materials to apply it to everything, but it might work out better to only apply it to objects that need it and avoid setting it for large horizontal surfaces or objects containing of two planes back to back with no space between them (shadows for those might look worse with that option).

Tiling fix

Tired of textures with obvious tiling? Here is a fix that’s been in CSP since very first builds (that’s why it’s so unconventionally looking):

[SHADER_REPLACEMENT_...]
MATERIALS = grass-shad
PROP_... = ksAlphaRef, -193

Works for:

  • ksMultilayer;
  • ksMultilayer_fresnel_nm;
  • ksPerPixelMultiMap_NMDetail;
  • ksPerPixelMultiMap_AT_NMDetail;
  • nePerPixelMultiMap_parallax;
  • nePerPixelMultiMap_tessellation.

Also, ksMultilayer_fresnel_nm4 and ksMultilayer_objsp_nm4 have a separate option for it. And if you’re just using ksPerPixel and want to fix tiling, just switch it to a shader with a fix:

[SHADER_REPLACEMENT_...]
MATERIALS = my_material
SHADER = ksPerPixel_tilingfix

Per-pixel fog for large low-poly meshes

Currently by default most of shaders calculate fog in vertex shader, resulting in fog looking weird if meshes are too lowpoly. Usually those lowpoly meshes use ksPerPixel shader, so you can simply switch to a shader with per-pixel fog:

[SHADER_REPLACEMENT_...]
MATERIALS = my_material
SHADER = ksPerPixel_ppfog

Other shaders using per-pixel fog:

  • ksPerPixel_horizon (used by [Material_Horizon], material meant for those tube-like meshes encircling tracks);
  • ksPerPixel_tilingfix;
  • smWaterSurface.

Spotlights

If you have a simple light emitter mesh used for spotlight, there is an option to boost its emissiveness if camera is right in front of it:

[SHADER_REPLACEMENT_...]
MATERIALS = spotlight_emissive
PROP_... = ksAlphaRef, -193

Available for:

  • ksPerPixel;
  • ksPerPixelAlpha;
  • ksPerPixelAT.

Flammable materials

Some materials can be set on fire:

20220202-173215.mp4

To activate, add to your [SHADER_REPLACEMENT_...]:

ATTRIBUTE_0 = ParticlesFX.Flammable, 1

Or simply use [Material_Bale] from “materials_track.ini”. Currently only hay material gets darker as it burns, let me know if any other shaders need that behavior. And preferably consider keeping flammable meshes relatively simply, it does a bit of raycasting for flames spreading and what not.

General Information

Car Physics

Track Physics

Car & Track Configs

Car Configs

Instruments
Miscellaneous

Track Configs

Post-processing Filters

Python Apps

Lua Apps

Server Configs

Other Things

Unrelated to Custom Shaders Patch

Clone this wiki locally