User:3d4dd

From Bo3b's School for Shaderhackers
Jump to: navigation, search

Lesson 0

TheBall02 50.jpg

Thank You for the lesson!

I've got the full version of The Ball so I don't know if there are also levels in the demo that contain water surfaces like these. I hope that we will learn how to fix this common issue in UR3 games, too ;)


Lesson 1

//
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
// Parameters:
//
//   float4 AmbientColorAndSkyFactor;
//   float4 MinZ_MaxZRatio;
//   sampler2D Texture2D_0;
//   sampler2D Texture2D_1;
//   sampler2D Texture2D_2;
//   sampler2D Texture2D_3;
//   sampler2D Texture2D_4;
//   sampler2D Texture2D_5;
//   sampler2D Texture2D_6;
//   sampler2D Texture2D_7;
//   sampler2D Texture2D_8;
//   float UniformPixelScalar_23;
//   float UniformPixelScalar_24;
//   float UniformPixelScalar_5;
//   float UniformPixelScalar_6;
//   float4 UniformPixelVector_0;
//   float4 UniformPixelVector_1;
//   float4 UniformPixelVector_10;
//   float4 UniformPixelVector_11;
//   float4 UniformPixelVector_12;
//   float4 UniformPixelVector_13;
//   float4 UniformPixelVector_14;
//   float4 UniformPixelVector_15;
//   float4 UniformPixelVector_16;
//   float4 UniformPixelVector_17;
//   float4 UniformPixelVector_18;
//   float4 UniformPixelVector_2;
//   float4 UniformPixelVector_3;
//   float4 UniformPixelVector_4;
//   float4 UniformPixelVector_5;
//   float4 UniformPixelVector_6;
//   float4 UniformPixelVector_7;
//   float4 UniformPixelVector_8;
//   float4 UniformPixelVector_9;
//
//
// Registers:
//
//   Name                     Reg   Size
//   ------------------------ ----- ----
//   UniformPixelVector_0     c0       1
//   MinZ_MaxZRatio           c2       1
//   UniformPixelVector_1     c4       1
//   UniformPixelVector_2     c5       1
//   UniformPixelVector_3     c6       1
//   UniformPixelVector_4     c7       1
//   UniformPixelVector_5     c8       1
//   UniformPixelVector_6     c9       1
//   UniformPixelVector_7     c10      1
//   UniformPixelVector_8     c11      1
//   UniformPixelVector_9     c12      1
//   UniformPixelVector_10    c13      1
//   UniformPixelVector_11    c14      1
//   UniformPixelVector_12    c15      1
//   UniformPixelVector_13    c16      1
//   UniformPixelVector_14    c17      1
//   UniformPixelVector_15    c18      1
//   UniformPixelVector_16    c19      1
//   UniformPixelVector_17    c20      1
//   UniformPixelVector_18    c21      1
//   UniformPixelScalar_5     c22      1
//   UniformPixelScalar_6     c23      1
//   UniformPixelScalar_23    c24      1
//   UniformPixelScalar_24    c25      1
//   AmbientColorAndSkyFactor c26      1
//   Texture2D_0              s0       1
//   Texture2D_1              s1       1
//   Texture2D_2              s2       1
//   Texture2D_3              s3       1
//   Texture2D_4              s4       1
//   Texture2D_5              s5       1
//   Texture2D_6              s6       1
//   Texture2D_7              s7       1
//   Texture2D_8              s8       1
//

    ps_3_0
    def c1, 0.75, -9.99999997e-007, 6, -0.333299994
    def c3, 0.666700006, 1.5, 0.0250000004, 4
    def c27, 5, 0.5, 6.28318548, -3.14159274
    def c28, 0.200000003, 0.100000001, 10, 0.800000012
    def c29, 0.300000012, 0.589999974, 0.109999999, 0.600000024
    def c30, 1.5, 0.649999976, 0, 0
    def c31, 0.5, -0.5, 8, 17
    def c32, 2, -1, -0.5, 0
    def c33, 1.25, 1, 0, 0
    def c34, 9, 0.5, 0.200000003, 0.100000001
    def c35, 0.450000018, 100, 90, 0.100000001
    def c36, 0.816496611, 0.577350259, 0, 0
    def c37, -0.707106769, -0.408248305, 0.577350259, 0.707106769
    dcl_texcoord2_pp v0.xyz
    dcl_texcoord3_pp v1.xyz
    dcl_texcoord5 v2.w
    dcl_texcoord6 v3.xyz
    dcl_color v4.xyz
    dcl_color1 v5
    dcl_texcoord v6
    dcl_2d s0
    dcl_2d s1
    dcl_2d s2
    dcl_2d s3
    dcl_2d s4
    dcl_2d s5
    dcl_2d s6
    dcl_2d s7
    dcl_2d s8
    mul r0.xy, c1.x, v6
    texld r0, r0, s8
    add r0.y, r0_abs.x, c1.y
    pow r1.x, r0_abs.x, c25.x
    cmp r0.y, r0.y, r1.x, c32.w
    lrp r1.x, c24.x, r0.y, r0.x
    mul r0.x, r1.x, c24.x
    mul_sat r0.x, r0.x, c1.z
    add r0.x, r0.x, c1.w
    mov r1, c32
    add r0.y, r1.y, c24.x
    cmp r0, r0.y, c3.x, r0.x
    texkill r0
    mov r0.y, c3.y
    mad r0.xy, v6, r0.y, c11
    texld r0, r0, s2
    mad r0.xz, v6.xyyw, r1.x, c12.xyyw
    texld r2, r0.xzzw, s2
    mul r0.x, r2.y, c3.z
    mad r0.x, r0.y, r2.y, r0.x
    add r0.yz, c9.xxyw, v6.xxyw
    texld r2, r0.yzzw, s2
    mad r0.yz, v6.xxyw, -r1.z, c10.xxyw
    texld r3, r0.yzzw, s2
    mul r0.y, r2.x, r3.x
    mad r0.x, r0.y, c3.w, r0.x
    mul r0.xyz, r0.x, c8
    mov r1.x, c23.x
    mul r0.w, r1.x, c13.x
    mad r0.w, r0.w, c27.x, c27.y
    frc r0.w, r0.w
    mad r0.w, r0.w, c27.z, c27.w
    sincos r2.y, r0.w
    mul r2.xyz, r0, r2.y
    mad r0.xyz, r2, c32.z, r0
    nrm_pp r2.xyz, v4
    nrm_pp r3.xyz, v5
    mul_pp r4.xyz, r2.yzxw, r3.zxyw
    mad_pp r4.xyz, r3.yzxw, r2.zxyw, -r4
    mul r4.xyz, r4, v5.w
    mov r5.y, r4.z
    dp3 r4.y, r4, c19
    mov_pp r5.x, r2.z
    dp3 r4.x, r2, c19
    mov_pp r5.z, r3.z
    dp3 r0.w, r5, r5
    rsq r0.w, r0.w
    mul r0.w, r0.w, r5.z
    dp3 r4.z, r3, c19
    mad r0.w, r0.w, c29.w, c29.w
    mul r1.x, r0_abs.w, r0_abs.w
    add r0.w, r0_abs.w, c1.y
    mul r1.x, r1.x, r1.x
    mul r1.x, r1.x, r1.x
    mul r1.x, r1.x, c3.w
    cmp r0.w, r0.w, r1.x, c32.w
    min r1.x, r0.w, c28.w
    dp3 r0.w, r4, r4
    rsq r0.w, r0.w
    mul r0.w, r0.w, r4.z
    mad r0.w, r0.w, c31.y, c31.x
    add r2.x, r0_abs.w, c1.y
    mul r0.w, r0_abs.w, r0_abs.w
    mul r0.w, r0.w, r0.w
    mul r0.w, r0.w, r0.w
    mul r0.w, r0.w, c3.w
    cmp r0.w, r2.x, r0.w, c32.w
    min r2.x, r0.w, c28.w
    add r0.w, -r2.x, -c32.y
    mad r0.w, c20.x, r0.w, r2.x
    mad r2.xy, v6.wzzw, c31.x, c31.y
    dp2add r3.x, c17, r2, r1.w
    dp2add r3.y, c18, r2, r1.w
    add r2.xy, r3, -c32.z
    texld r2, r2, s6
    add r2.xyz, r2, c30
    mov r3.yzw, c32_abs.xyxw
    texld r4, v6, s3
    dp3 r2.w, r4, c29
    mul r3.x, r2.w, c28.z
    mul r2.xyz, r2, r3.xyxw
    mul r2.xyz, r2, r3.zxww
    mul r2.xyz, r0.w, r2
    add r3.xy, v6, v6
    nrm r5.xyz, v3
    mad r3.xy, r5, c35.x, r3
    texld r3, r3, s4
    mul r3.xyz, r3.y, c35.yzzw
    max r6.xyz, r4_abs, -c1.y
    log r7.x, r6.x
    log r7.y, r6.y
    log r7.z, r6.z
    mul r6.xyz, r7, c3.y
    exp r7.x, r6.x
    exp r7.y, r6.y
    exp r7.z, r6.z
    mad r3.xyz, r3, r7, r4
    texld r6, v6, s5
    mul r3.xyz, r3, r6.x
    mul r7.xyz, r4, c28.xyyw
    mad r3.xyz, r3, c35.w, r7
    mad r3.xyz, r6.z, c15, r3
    mad r2.xyz, c16.x, r2, r3
    mul r3.xyz, r4, c32_abs
    mad r2.xyz, r1.x, r3, r2
    mul r0.w, r4.w, c21.x
    mad r2.xyz, r0.w, c32_abs.xzww, r2
    mad r0.xyz, c14.x, r0, r2
    add_pp r0.xyz, r0, c0
    mad r0.w, r5.z, -c33.x, c33.y
    cmp r0.w, r5.z, r0.w, -c32.y
    mul r1.x, r0_abs.w, r0_abs.w
    mul r1.x, r1.x, r1.x
    mul r1.x, r0_abs.w, r1.x
    add r0.w, r0_abs.w, c1.y
    mad r2.xyz, r4, c34.x, c34.yzww
    mul r2.xyz, r1.x, r2
    cmp r2.xyz, r0.w, r2, c32.w
    add r2.xyz, r2, r4
    add r3.xyz, -r1.y, -c0
    mul_pp r2.xyz, r2, r3
    mul_pp r3.xyz, r2, v0
    mad r1.xy, c22.x, v6, r1.z
    dp2add r4.x, c5, r1, r1.w
    dp2add r4.y, c6, r1, r1.w
    add r1.xy, r4, -c32.z
    texld r1, r1, s1
    mad r1.xyz, r1, c32.x, c32.y
    mul r1.xyz, r1, c7
    texld r4, v6, s0
    mad r4.xyz, r4, c32.x, c32.y
    mad_pp r1.xyz, r4, c4, r1
    nrm_pp r4.xyz, r1
    dp3 r0.w, r4, r5
    mul r1.xyz, r0.w, r4
    mad r1.xyz, r1, c32.x, -r5
    dp2add_sat_pp r5.x, r1.yzzw, c36, c36.z
    dp3_sat_pp r5.y, r1, c37
    dp3_sat_pp r5.z, r1.yzxw, c37.yzww
    max r1.xyz, r5, -c1.y
    log r5.x, r1.x
    log r5.y, r1.y
    log r5.z, r1.z
    mad_pp r0.w, r6.x, c31.z, c31.w
    mul r1.xyz, r6.y, c32_abs.xzww
    mul r5.xyz, r5, r0.w
    exp_pp r6.x, r5.x
    exp_pp r6.y, r5.y
    exp_pp r6.z, r5.z
    dp3_pp r0.w, v1, r6
    texld r5, v6, s7
    mad_pp r1.xyz, r5, c3.w, r1
    mul_pp r1.xyz, r1, v0
    mul_pp r1.xyz, r0.w, r1
    dp2add_sat_pp r5.x, r4.yzzw, c36, c36.z
    dp3_sat_pp r5.y, r4, c37
    dp3_sat_pp r5.z, r4.yzxw, c37.yzww
    mul_pp r4.xyz, r5, r5
    max_pp r5.xyz, r4, -c1.y
    dp3_pp r0.w, v1, r5
    mad_pp r1.xyz, r3, r0.w, r1
    add_pp r0.xyz, r0, r1
    mad_pp oC0.xyz, r2, c26, r0
    rcp r0.x, v2.w
    mad_pp oC0.w, c2.x, r0.x, c2.y

// approximately 188 instruction slots used (12 texture, 176 arithmetic)

Seems to work ;)

Lesson 2

Before:

TheBall ori.jpg

After:

TheBall fixed.jpg


Finger exercise: making the menu transparent

PS C7F15869:

    ps_3_0
    def c1, -1, 9.99999997e-007, 0, 0
// define constant with 0.1	
    def c2, 0.1, 0, 0, 0	
    dcl_texcoord v0.xy
    dcl_texcoord1 v1
    dcl_2d s0
    texld r0, v0, s0
    dp4 r0.w, r0, c0
    mul r0, r0, v1
    mov_sat r1.xyz, r0
    max r2.xyz, r1, c1.y
    log r1.x, r2.x
    log r1.y, r2.y
    log r1.z, r2.z
    mul r1.xyz, r1, c4.x
    exp r2.x, r1.x
    exp r2.y, r1.y
    exp r2.z, r1.z
    mov r1.x, c4.x
    add r1.x, r1.x, c1.x
    cmp oC0.xyz, -r1_abs.x, r0, r2
// multiply alpha with 0.1 for more transparency
    mul r0.w, r0.w, c2.x	
    mov oC0.w, r0.w

Lesson 3

Example for (partly) disabling light shafts in Mind: Path to Thalamus, addendum to the fix from eqzitara on http://helixmod.blogspot.de/2014/08/mind-path-to-thalamus.html

Code in [game folder]\Binaries\Win32\shaderoverride\pixelshaders\DX9Settings.ini (declaration of v key (key 1, values for 220.x) and b key (key 2, values for 220.y)):

[General]
UseEndScene = false
SkipSetScissorRect = true
// addendum
DefVSConst1 = 220  		
DefPSConst1 = 220
PresetsKeysList = 1;2;

[VS5CF48237]
CheckTexCRC = true
ValForDefined = 0
ValNotDefined = 1
TexCounterReg = 251
UseDefinedOnly = false
DefinedTexturesVS = 568A095C;

// addendum
[KEY1]
Key = 86
Presets = 1;2;
Type = 1

[PRES1]
Const1 = 0x3f800000
[PRES2]
Const1 = 0x00000000

[KEY2]
Key = 66
Presets = 3;4;
Type = 1

[PRES3]
Const2 = 0x3f800000
[PRES4]
Const2 = 0x00000000

Code in [game folder]\Binaries\Win32\shaderoverride\pixelshaders\B845A430.txt

// Light shafts
    ps_3_0
	//def c220, Const1, Const2, Const3, Const4
	def c200, 0, 1, 0.0625, 0.5	// x=0 for comparison to Const1 and Const2
	
    def c1, 4, 0, 0, 0
    def c2, 0.5, 1.5, 0, 1
    def c3, 0.300000012, 0.589999974, 0.109999999, -3
    dcl_texcoord v0.xy
    dcl_texcoord1 v1.xy
    dcl_2d s0
    dcl_2d s1
    mov r0.zw, c7
    mad r0.xy, v0, -r0.zwzw, c0
    dp2add r0.x, r0, r0, c2.z
    rsq r0.x, r0.x
    rcp r0.x, r0.x
    mul_sat r0.x, r0.x, c2.x
    mov r1.xy, c2
    mad r0.y, c8.w, -r1.x, r1.y
    texld_pp r1, v0, s1
    mul_pp r0.z, r1.w, r1.w
    mul_pp r1.xyz, r1, c9
    lrp r1.w, r0.z, r0.y, c8.w
    lrp r2.x, r0.x, c2.w, r1.w
    add r0.x, -r2.x, c2.w
    mul r0.y, c10.x, c10.x
    mul r0.y, r0.y, c10.x
    mad_pp oC0.w, r0.y, r0.x, r2.x
    texld_pp r0, v1, s0
    dp3_pp r0.x, r0, c3
    mul_pp r0.x, r0.x, c3.w
    exp_pp r0.x, r0.x
    mul_sat_pp r0.x, r0.x, c11.x
    mul r0.xyz, r0.x, r1
    mul_pp oC0.xyz, r0, c1.x
    // v-key: if Const1 = 1 change color to black (=invisible), else leave it on
    mov r30.x, c220.x
    if_eq r30.x, c200.y
	mov oC0.xyz, c200.xxx	   
    endif
    // b-key: if Const2 = 1 change alpha to 1, else leave it on
	mov r30.y, c220.y
    if_eq r30.y, c200.y
	mov oC0.w, c200.y   
    endif

Before (bright sun: "hard" (color) light shafts cause issues):

Mind sun original.jpg

v-Key: "hard" (color) light shafts disabled, "soft" (alpha) light shafts still enabled

Mind sun color.jpg

v-Key snd b-key: light shafts completely disabled

Mind sun aplha color.jpg

Before (low sun: "soft" (alpha) light shafts cause issues):

Mind sun before.jpg

b-Key: "soft" (alpha) light shafts disabled, "hard" (color) light shafts still enabled

Mind sun alpha1.jpg

Update: Thanks to DarkStarSword the shader could be fixed ;)

Lesson 4

Used 2 hotkeys to toggle bloom effect on the ball (v) independent from the more mild fog (b)

DX9Settings.ini:

[General]

// UseRenderedShaders=true is nearly always useful, because it trims the 
// list of shaders seen while hunting down to just those active in the 
// current scene.  Disable this only if you get crashes during hunting.
UseRenderedShaders=true

// DumpAll will generate ASM text files for every shader seen by the game.
// This is usually worth doing once, but not useful for every run.
DumpAll=false

// Constant registers that will arrive in Vertex and Pixel Shaders, as
// c220.  The constants below will be assigned, based on the key preset.
DefVSConst1 = 220  		
DefPSConst1 = 220

// The PresetKeysList specifies which KEYs will be used.
// Multiple keys lists are supported.
PresetsKeysList = 1;2;

// KEY1 = v toggles Presets = 1 and 2 for c220.x 
// KEY2 = b toggles Presets = 1 and 2 for c220.y 
// that v should act as a toggle. And toggle
// Type=1 is toggle, Type=2 is momentary.
[KEY1]
Key = 86
Presets = 1;2;
Type = 1
[KEY2]
Key = 66
Presets = 3;4;
Type = 1

// Constants that will be sent to every shader through constant register c220.
// The Const1 tells us that we'll need to use c220.x to compare against these
// values.  Const2 will be seen as c220.y.
// 0x3f800000 is 1.0 in floating point hex, 0x00000000 is 0.0 in hex
[PRES1]
Const1 = 0x3f800000
[PRES2]
Const1 = 0x00000000
[PRES3]
Const2 = 0x3f800000
[PRES4]
Const2 = 0x00000000

Code in one of the fog shaders, e.g. F894AEE4.txt

// Fog in start menu
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
// Parameters:
//
//   float4 MinZ_MaxZRatio;
//   sampler2D SceneColorTexture;
//   float4 ScreenPositionScaleBias;
//   sampler2D Texture2D_0;
//   sampler2D Texture2D_1;
//   sampler2D Texture2D_2;
//   sampler2D Texture2D_3;
//   float UniformPixelScalar_17;
//   float UniformPixelScalar_18;
//   float UniformPixelScalar_20;
//   float UniformPixelScalar_21;
//   float4 UniformPixelVector_0;
//   float4 UniformPixelVector_1;
//   float4 UniformPixelVector_2;
//   float4 UniformPixelVector_3;
//   float4 UniformPixelVector_4;
//
//
// Registers:
//
//   Name                    Reg   Size
//   ----------------------- ----- ----
//   UniformPixelVector_0    c0       1
//   ScreenPositionScaleBias c1       1
//   MinZ_MaxZRatio          c2       1
//   UniformPixelVector_1    c4       1
//   UniformPixelVector_2    c5       1
//   UniformPixelVector_3    c6       1
//   UniformPixelVector_4    c7       1
//   UniformPixelScalar_17   c8       1
//   UniformPixelScalar_18   c9       1
//   UniformPixelScalar_20   c10      1
//   UniformPixelScalar_21   c11      1
//   SceneColorTexture       s0       1
//   Texture2D_0             s1       1
//   Texture2D_1             s2       1
//   Texture2D_2             s3       1
//   Texture2D_3             s4       1
//

    ps_3_0
	//def c220, Const1, Const2, Const3, Const4
	def c200, 0, 1, 0.0625, 0	// x=0 for comparison to Const2	
    def c3, 1.5, 1, 0.5, -1
    def c12, 0, 2, 0.100000001, 1
    def c13, 8, 0.800000012, 65503, 512
    def c14, 512, -0.00100000005, 1000, 0
    dcl_texcoord4 v0
    dcl_texcoord5 v1.xyw
    dcl_texcoord6 v2.xyz
    dcl_texcoord v3.xy
    dcl_2d s0
    dcl_2d s1
    dcl_2d s2
    dcl_2d s3
    dcl_2d s4
    nrm r0.xyz, v2
    mad r0.xyz, r0.z, c12.xxyw, -r0
    add r0.z, r0.z, c13.x
    mul r0.z, r0.z, c13.y
    rsq r0.z, r0.z
    mad r1.x, r0.x, r0.z, c3.z
    mad r0.xy, r0, r0.z, c3.z
    texld r0, r0, s4
    mov r1.y, v3.y
    texld r1, r1, s3
    mul r0.x, r0.x, r1.x
    mov r1.xy, c4
    mad r0.yz, v3.xxyw, r1.xxyw, c5.xxyw
    texld r1, r0.yzzw, s1
    mov r2.xy, c6
    mad r0.yz, v3.xxyw, r2.xxyw, c7.xxyw
    texld r2, r0.yzzw, s2
    mad r0.y, r1.y, r2.y, c12.z
    mad r0.y, r0.y, c3.x, c3.w
    mov r0.w, c12.w
    mad r0.y, c8.x, r0.y, r0.w
    mul r0.x, r0.x, r0.y
    mul r0.x, r0.x, c9.x
    mul r0.y, c10.x, v1.w
    min r1.x, r0.y, c12.w
    mul r0.x, r0.x, r1.x
    rcp r0.y, v1.w
    mul r0.yz, r0.y, v1.xxyw
    mad r0.yz, r0, c1.xxyw, c1.xwzw
    texld_pp r1, r0.yzzw, s0
    min_pp r0.y, r1.w, c13.z
    mad r0.y, r0.y, c2.z, -c2.w
    rcp_pp r0.y, r0.y
    add r0.y, r0.y, -v1.w
    add r0.z, r0.w, -c11.x
    mul r0.w, r0.z, c13.w
    mad r0.z, r0.z, c14.x, c14.y
    rcp r0.w, r0.w
    cmp r0.z, r0.z, r0.w, c14.z
    mul_sat r0.y, r0.z, r0.y
    mul_pp oC0.w, r0.y, r0.x
    mov r0.xyz, c3
    add_pp r0.xyz, r0, c0
    mad_pp oC0.xyz, r0, v0.w, v0
	// if Const2 = 0 disable effect, else leave it on
	mov r30.x, c220.y
	if_eq r30.x, c200.x
	   mov oC0.xyzw, c200.wwww
	endif	

// approximately 46 instruction slots used (5 texture, 41 arithmetic)

Lesson 5

As I just had a look at The Sims 4 I've decided to use this game to make some experiments with the shaders. There is a strange "gap" at the edge of the lots. The ground is at correct depth but near the edge of the lot the texture is only rendered for one eye depending on the stereo settings and the distance:

TS402 50.jpg

I discovered that this issue appears as soons as You paint a ground texture (soil, cobblestone, etc.) on the lot. Without this painted textures and only the common ground grass texture present everything works fine:

TS401 50.jpg

I identified the PS (68D76126) used for some of the lots:

    //lot painted, issue
    // Generated by shader LotTerrain.fx
    //
    // Parameters:
    //
    // float4 CascadeShadowParams[6];
    // float4 ExteriorLightData[4];
    // float4 ShaderDayNightParameters;
    // float3 SunCubeBasis[2];
    // float4 g_lot_terrain_paint_ps_params;
    // float4 g_lot_terrain_spec_paint_ps_params;
    // float4 g_ssao_ps_apply_params[4];
    // sampler2D samplerLightMap;
    // sampler2D samplerPaintTexture;
    // sampler2D samplerShadowMainMap;
    // sampler2D samplerSpecPaintTexture;
    // samplerCUBE samplerTerrainCubeMap;
    // sampler2D samplerblendMap;
    // sampler2D samplercolorMap;
    // sampler2D samplercolorMap2;
    // sampler2D samplercolorMap3;
    // sampler2D samplercolorMap4;
    // sampler2D samplerg_SsaoBuffer;
    // sampler2D samplerspecMap;
    // sampler2D samplerspecMap2;
    // sampler2D samplerspecMap3;
    // sampler2D samplerspecMap4;
    // float4 shadowTextureData;
    // float4 specScales;
    //
    //
    // Registers:
    //
    // Name Reg Size
    // ---------------------------------- ----- ----
    // ExteriorLightData c6 4
    // CascadeShadowParams c12 6
    // g_ssao_ps_apply_params c18 2
    // SunCubeBasis c20 2
    // shadowTextureData c22 1
    // ShaderDayNightParameters c23 1
    // g_lot_terrain_paint_ps_params c24 1
    // g_lot_terrain_spec_paint_ps_params c25 1
    // specScales c26 1
    // samplerg_SsaoBuffer s0 1
    // samplerLightMap s1 1
    // samplerPaintTexture s2 1
    // samplerSpecPaintTexture s3 1
    // samplercolorMap s4 1
    // samplerShadowMainMap s5 1
    // samplercolorMap2 s6 1
    // samplercolorMap3 s7 1
    // samplercolorMap4 s8 1
    // samplerspecMap s9 1
    // samplerspecMap2 s10 1
    // samplerspecMap3 s11 1
    // samplerspecMap4 s12 1
    // samplerTerrainCubeMap s13 1
    // samplerblendMap s14 1
    //
    //
    // Default values:
    //
    // ExteriorLightData
    // c6 = { 0, 0, 0, 0 };
    // c7 = { 0, 0, 0, 0 };
    // c8 = { 0, 0, 0, 0 };
    // c9 = { 0, 0, 0, 0 };
    //
    // CascadeShadowParams
    // c12 = { 0, 0, 0, 0 };
    // c13 = { 0, 0, 0, 0 };
    // c14 = { 0, 0, 0, 0 };
    // c15 = { 0, 0, 0, 0 };
    // c16 = { 0, 0, 0, 0 };
    // c17 = { 0, 0, 0, 0 };
    //
    // g_ssao_ps_apply_params
    // c18 = { 0, 0, 0, 0 };
    // c19 = { 0, 0, 0, 0 };
    //
    // SunCubeBasis
    // c20 = { 0, 0, 0, 0 };
    // c21 = { 0, 0, 0, 0 };
    //
    // shadowTextureData
    // c22 = { 1024, 1024, 0.000976563, 0.000976563 };
    //
    // ShaderDayNightParameters
    // c23 = { 1, 0, 0, 0 };
    //
    // g_lot_terrain_paint_ps_params
    // c24 = { 0, 0, 0, 0 };
    //
    // g_lot_terrain_spec_paint_ps_params
    // c25 = { 0, 0, 0, 0 };
    //
    // specScales
    // c26 = { 0, 0, 0, 0 };
    //

    ps_3_0
    def c0, 1, -0, 0.25, 10
    def c1, 1, 2, -1, 0.5
    def c2, 8, 0.104999997, 0.335000008, 0.0599999987
    dcl_color v0
    dcl_texcoord1 v1.xy
    dcl_texcoord2 v2.xyz
    dcl_texcoord3 v3.xy
    dcl_texcoord4 v4.xy
    dcl_texcoord5 v5.xyz
    dcl_texcoord6 v6
    dcl vPos.xy
    dcl_2d s0
    dcl_2d s1
    dcl_2d s2
    dcl_2d s3
    dcl_2d s4
    dcl_2d s5
    dcl_2d s6
    dcl_2d s7
    dcl_2d s8
    dcl_2d s9
    dcl_2d s10
    dcl_2d s11
    dcl_2d s12
    dcl_cube s13
    dcl_2d s14
    texld r3, v1, s14
    dp3 r0.w, r3, c1.x
    add_sat r3.w, -r0.w, c1.x
    texld r2, v4, s4
    mov r5.w, r2.w
    texld r4, v4, s6
    mov r5.z, r4.w
    texld r1, v4, s7
    mov r5.y, r1.w
    texld r0, v4, s8
    mov r5.x, r0.w
    mad r3, c1.y, r3, r5
    add_sat r3, r3, c1.z
    dp4 r0.w, r3, c1.x
    rcp r0.w, r0.w
    mul r3, r3, r0.w
    mul r4.xyz, r4, r3.z
    mad r2.xyz, r2, r3.w, r4
    mad r1.xyz, r1, r3.y, r2
    mad r6.xyz, r0, r3.x, r1
    mad r0.xy, vPos, c24, c24.zwzw
    texld r2, r0, s2
    add r4.xy, v6.w, -c16.yxzw
    mov r0.xyz, c12
    mad r0.xyz, v6, r0, c13
    cmp r1.xyz, r4.y, r0, v6
    mov r0.xyz, c14
    mad r0.xyz, v6, r0, c15
    cmp r0.xyz, r4.x, r0, r1
    mad r4.zw, r0.z, c0.xyxy, c0.xyyx
    add r6.w, -r2.w, c1.x
    mov r1.zw, r4
    mov r7.xyw, c1
    mad r4.xy, c22.zwzw, -r7.w, r0
    mov r5.zw, r1
    add r0.xy, r4, c22.zwzw
    mov r0.zw, r5
    texldp r0, r0, s5
    mov r0.w, r0.x
    mad r5.xy, c22.zwzw, r7.yxzw, r4
    texldp r5, r5, s5
    mov r0.z, r5.x
    texldp r5, r4, s5
    mov r0.x, r5.x
    mad r1.xy, c22.zwzw, r7, r4
    texldp r1, r1, s5
    mov r0.y, r1.x
    dp4 r1.z, r0, c0.z
    mad_sat r1.w, v6.w, c17.z, c17.w
    lrp r0.w, r1.w, c1.x, r1.z
    dp3_sat r4.w, v2, c7
    min r1.z, r0.w, c1.x
    mul r1.w, r4.w, c0.w
    min r0.w, r1.w, r1.z
    mov r0.xyz, c9
    add r0.xyz, -r0, c6
    mad r2.xyz, r6, r6.w, r2
    mad r4.xyz, r0.w, r0, c9
    texld r0, v3, s1
    mul r0.w, r0.w, c23.x
    lrp r1.xyz, r4.w, r4, c8
    mul r0.w, r0.w, c2.x
    mad r4.xyz, r0, r0.w, r1
    mad r0.xy, vPos, c18, c18.zwzw
    texld r0, r0, s0
    mul r0.w, r0.x, r0.x
    lrp r1.w, c19.w, r0.w, r0.x
    mov r1.xyz, v2
    dp3 r0.w, v5, r1
    mad_sat r0.z, r1.w, c19.x, c19.y
    add r0.w, r0.w, r0.w
    mul r0.xyz, r4, r0.z
    mad r1.xyz, r1, -r0.w, v5
    mul r2.xyz, r2, r0
    dp3 r0.z, r1, c21
    dp3 r0.x, r1, c20
    dp3 r0.y, r1, c7
    texld r0, r0, s13
    dp3 r0.w, r0, r0
    cmp r0.w, -r0.w, c0.y, c0.x
    mad r1.xy, vPos, c25, c25.zwzw
    texld r1, r1, s3
    if_ne r0.w, -r0.w
    mul r3, r3, c26
    texld r4, v4, s10
    mul r0.w, r3.z, r4.y
    texld r4, v4, s9
    mad r0.w, r3.w, r4.y, r0.w
    texld r4, v4, s11
    mad r0.w, r3.y, r4.y, r0.w
    texld r4, v4, s12
    mad r0.w, r3.x, r4.y, r0.w
    add r1.w, -r2.w, c1.x
    mad r0.w, r0.w, r1.w, r1.y
    mad r0.xyz, r0.w, r0, r2
    else
    mov r0.xyz, r2
    endif
    mov_sat r0.w, v0.w
    add r1.xyz, -r0, v0
    mad oC0.xyz, r0.w, r1, r0
    dp3 oC0.w, r0, c2.yzww

    // approximately 104 instruction slots used (18 texture, 86 arithmetic)

By experimenting with the shader I discovered that commenting out texld r2, r0, s2 removed the painted texture and so the issue with the edges. But it also removed parts of the common ground grass texture on the lot:

TS403 50.jpg

I was lucky to find that repacing s2 (samplerPaintTexture) with s13 (samplerTerrainCubeMap) replaced the missing parts of the ground texture. So "texld r2, r0, s13" is a workaround. In additon there are 3 other types of lots that use different PS than PS 68D76126. In this case my trick with samplerTerrainCubeMap didn't work. But I could disable the painted textures by replacing these shaders with the equivalent shaders for the empty lots without painted textures. I only had to adjust the c... and s... values. When I tried to make the disabling of painted ground textures toggleable I discovered that in some cases texld inside if_eq statements cause helixmod to ignore the override. So texld had to be replaced with texldl. I had the same issue with some texldp lines. In this case I had to use registers to keep texldp outsdide if_eq statements: Instead of:

    if_eq r30.x, c3.x
      texldp r2, r2, s5
    else
      texldp r1, r1, s5
    endif

I used:

    if_eq r30.x, c3.x
      mov r9, r2
    else
      mov r9, r1
    endif
    texldp r9, r9, s5
    if_eq r30.x, c3.x
      mov r2, r9
    else
      mov r1, r9
    endif

Lesson 6

In lesson 0 I have posted a screenshot with halo issues caused by water surfaces. Now I wanted to see if I already can fix these issues using the prime directive. Finding the relevant PS and VS for the issue was very easy as the texture for the water surface and so the issue disappeared.

PS F6D9C43C:

// when disabled water clear, water texture and halo issue removed
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
// Parameters:
//
//   float4 MinZ_MaxZRatio;
//   sampler2D SceneColorTexture;
//   float4 ScreenPositionScaleBias;
//   sampler2D Texture2D_0;
//   sampler2D Texture2D_1;
//   sampler2D Texture2D_2;
//   float4 UniformPixelVector_0;
//   float4 UniformPixelVector_1;
//   float4 UniformPixelVector_2;
//   float4 UniformPixelVector_3;
//   float4 UniformPixelVector_4;
//   float4 UniformPixelVector_5;
//
//
// Registers:
//
//   Name                    Reg   Size
//   ----------------------- ----- ----
//   UniformPixelVector_0    c0       1
//   ScreenPositionScaleBias c1       1
//   MinZ_MaxZRatio          c2       1
//   UniformPixelVector_1    c4       1
//   UniformPixelVector_2    c5       1
//   UniformPixelVector_3    c6       1
//   UniformPixelVector_4    c7       1
//   UniformPixelVector_5    c8       1
//   SceneColorTexture       s0       1
//   Texture2D_0             s1       1
//   Texture2D_1             s2       1
//   Texture2D_2             s3       1
//

    ps_3_0	
    def c3, 3, 2, -1, 1
    def c9, 4, 3.5, -9.99999997e-007, 2.5
    def c10, 2, 4, 0, 1.5
    def c11, 1, 0.5, 0.200000003, -0.0500000007
    def c12, 0.300000012, 0.589999974, 0.109999999, 0.25
    def c13, 0.800000012, 25, 40, 4
    def c14, 2, 3, 0.5, 65503
    def c15, 0.0048828125, 0, 0, 0
    dcl_texcoord4 v0
    dcl_texcoord5 v1.xyw
    dcl_texcoord6 v2.xyz
    dcl_texcoord v3.xy
    dcl_2d s0
    dcl_2d s1
    dcl_2d s2
    dcl_2d s3	
    rcp r0.x, v1.w
    mul r0.xy, r0.x, v1
    mad r0.xy, r0, c1, c1.wzzw
    texld_pp r0, r0, s0
    min_pp r1.x, r0.w, c14.w
    mad r0.x, r1.x, c2.z, -c2.w
    rcp_pp r0.x, r0.x
    add r0.x, r0.x, -v1.w
    mul_sat r0.x, r0.x, c15.x
    mul_pp oC0.w, r0.x, c11.z
    mov r0.xyw, c3
    mad r1.xy, v3, r0, c4
    texld r1, r1, s1
    mad r0.z, r1.x, c3.y, c3.z
    mad r1.xy, v3, r0.ywzw, c5
    texld r1, r1, s1
    mad r0.y, r1.y, c3.y, c3.z
    mul r0.y, r0.y, r0.z
    mov r1.xy, c9
    mad r1.xy, v3, r1, c6
    texld r1, r1, s2
    mad r0.y, r0.y, c9.x, r1.x
    mad r0.z, r0.y, c11.z, c11.w
    add r0.y, -r0.y, c3.z
    dp3 r1.x, v2, v2
    rsq r1.x, r1.x
    mul r1.xy, r1.x, v2
    mov r2.yw, c10
    mad r2.xy, v3, r2.ywzw, c8
    mad r2.xy, r0.z, r1, r2
    mad r0.yz, r0.y, r1.xxyw, v3.xxyw
    texld r3, r0.yzzw, s2
    texld r2, r2, s3
    mov r1.xy, c11
    mad r0.yz, v3.xxyw, r1.xxyw, c7.xxyw
    texld r4, r0.yzzw, s3
    mul r1.xyw, r4.xyzz, c3.x
    mul r3.xzw, r2.xyyz, r1.xyyw
    dp3 r0.y, r3.xzww, c12
    mad r1.xyw, r1, -r2.xyzz, r0.y
    mad r1.xyw, r1, c12.w, r3.xzzw
    max r2.xyz, r1_abs.xyww, -c9.z
    log r4.x, r2.x
    log r4.y, r2.y
    log r4.z, r2.z
    mul r1.xyw, r4.xyzz, c13.x
    exp r2.x, r1.x
    exp r2.y, r1.y
    exp r2.z, r1.w
    mad r0.xy, v3, r0.xwzw, c8
    texld r0, r0, s2
    mul r0.x, r0.z, r1.z
    mul r0.xyz, r0.x, c13.yzww
    mad r0.xyz, r2, c14, r0
    pow r0.w, r3_abs.y, c9.w
    add r1.x, r3_abs.y, c9.z
    mul r1.yzw, r0.w, c10.xxyz
    cmp r1.xyz, r1.x, r1.yzww, c10.z
    add r0.xyz, r0, r1
    dp3 r0.w, r0, c12
    lrp r1.xyz, c12.w, r0.w, r0
    add_pp r0.xyz, r1, c0
    mad_pp oC0.xyz, r0, v0.w, v0

// approximately 65 instruction slots used (8 texture, 57 arithmetic)

With its 3 dimensions dcl_texcoord5 v1.xyw (and dcl_texcoord6 v2.xyz) linked to the VS and offered a clue which output I should try to fix with the prime directive. It was texcoord5. So the fixed VS BA4AE8B is:

// when disabled water clear, texture and issue removed
// NOW FIXED
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
// Parameters:
//
//   float3 ApproxFogColor;
//   float4 CameraPosition;
//   float3 ExponentialFogColor;
//   float3 ExponentialFogLightVector;
//   float3 ExponentialFogParameters;
//   float4 FirstDensityFunctionParameters;
//   float4 FogDistanceScale;
//   float4 FogExtinctionDistance;
//   float4 FogInScattering[4];
//   float4 FogMaxHeight;
//   float4 FogMinHeight;
//   float4 FogStartDistance;
//   float3 FogVolumeBoxMax;
//   float3 FogVolumeBoxMin;
//   float3 LightInscatteringColor;
//   float4x4 LocalToWorld;
//   float StartDistance;
//   float4x4 ViewProjectionMatrix;
//   float3x3 WorldToLocal;
//   float bUseExponentialHeightFog;
//
//
// Registers:
//
//   Name                           Reg   Size
//   ------------------------------ ----- ----
//   ViewProjectionMatrix           c0       4
//   CameraPosition                 c4       1
//   LocalToWorld                   c6       4
//   FogInScattering                c10      4
//   WorldToLocal                   c14      3
//   bUseExponentialHeightFog       c17      1
//   ExponentialFogParameters       c18      1
//   ExponentialFogColor            c19      1
//   LightInscatteringColor         c20      1
//   ExponentialFogLightVector      c21      1
//   FogDistanceScale               c22      1
//   FogExtinctionDistance          c23      1
//   FogStartDistance               c24      1
//   FogMinHeight                   c25      1
//   FogMaxHeight                   c26      1
//   FirstDensityFunctionParameters c27      1
//   StartDistance                  c28      1
//   ApproxFogColor                 c29      1
//   FogVolumeBoxMin                c30      1
//   FogVolumeBoxMax                c31      1
//

    vs_3_0
    def c200, 0, 1, 0.0625, 0	//	0.0625 prime directive reference value
    def c5, 0.00784313772, -1, 0.00100000005, 1
    def c32, 0.5, 0, 1, 0
    dcl_2d s0							// Sampler used to fetch stereo params	
    dcl_position v0
    dcl_tangent v1
    dcl_normal v2
    dcl_color1 v3
    dcl_texcoord v4
    dcl_color o0
    dcl_texcoord o1
    dcl_texcoord4 o2
    dcl_texcoord5 o3
    dcl_texcoord6 o4
    dcl_position o5
    mul r0, c7, v0.y
    mad r0, c6, v0.x, r0
    mad r0, c8, v0.z, r0
    mad r0, c9, v0.w, r0
    mad r1, v2, c5.x, c5.y
    mad r2.xyz, v1.yzxw, c5.x, c5.y
    mul r3.xyz, r1.zxyw, r2
    mad r2.xyz, r1.yzxw, r2.yzxw, -r3
    mul r2.xyz, r1.w, r2
    mul r3.xyz, r1.yzxw, r2.zxyw
    mad r3.xyz, r2.yzxw, r1.zxyw, -r3
    mul r3.xyz, r1.w, r3
    mul r4, r0.y, c1
    mad r4, c0, r0.x, r4
    mad r4, c2, r0.z, r4
    mad r4, c3, r0.w, r4
    mad r5.xyz, r0, -c4.w, c4
    mul r6.xyz, r5.y, c15
    mad r5.xyw, c14.xyzz, r5.x, r6.xyzz
    mad r5.xyz, c16, r5.z, r5.xyww
    dp3 o4.x, r3, r5
    dp3 o4.y, r2, r5
    dp3 o4.z, r1, r5
    abs r0.w, c17.x
    if_lt -r0.w, r0.w
      add r1.xyz, r0, -c4
      dp3 r0.w, r1, r1
      rsq r0.w, r0.w
      rcp r1.w, r0.w
      mul r1.w, r1.w, c18.x
      slt r2.x, c5.z, r1_abs.z
      mul r2.y, r1.z, -c18.y
      exp r2.y, r2.y
      add r2.y, -r2.y, c5.w
      mul r2.z, r1.z, c18.y
      rcp r2.z, r2.z
      mul r2.y, r2.z, r2.y
      mad r2.y, r1.w, r2.y, -r1.w
      mad r1.w, r2.x, r2.y, r1.w
      mul r1.xyz, r0.w, r1
      dp3 r0.w, c21, r1
      slt r1.x, r0.w, c18.z
      mov r2.xyz, c19
      add r3.xyz, r2, c20
      mul r5.xyz, r3, c32.x
      add r1.y, r0.w, c5.w
      mov r2.w, c5.w
      add r1.z, r2.w, c18.z
      rcp r1.z, r1.z
      mul_sat r1.y, r1.z, r1.y
      mad r2.xyz, r3, c32.x, -r2
      mad r2.xyz, r1.y, r2, c19
      add r0.w, r0.w, -c18.z
      add r1.y, r2.w, -c18.z
      rcp r1.y, r1.y
      mul_sat r0.w, r0.w, r1.y
      mul r0.w, r0.w, r0.w
      mov r6.x, c32.x
      mad r3.xyz, r3, -r6.x, c20
      mad r3.xyz, r0.w, r3, r5
      lrp r5.xyz, r1.x, r2, r3
      exp r0.w, -r1.w
      min r1.x, r0.w, c5.w
      add r0.w, -r1.x, c5.w
      mul r2.xyz, r0.w, r5
    else
      add r3.xyz, r0, -c4
      dp3 r0.w, r3, r3
      rsq r0.w, r0.w
      rcp r0.w, r0.w
      mov r5.z, c4.z
      add r6, -r5.z, c25
      sge r2.w, c5.z, r3_abs.z
      lrp r5.x, r2.w, c5.z, r3.z
      rcp r2.w, r5.x
      mul_sat r3, r2.w, r6
      add r5, -r5.z, c26
      mul_sat r5, r2.w, r5
      add r6, r0.w, -c24
      max r6, r6, c32.y
      add r3, -r3, r5
      mul r3, r3_abs, r6
      slt r5, r3, c23
      mul r3, r3, c22
      exp r6.x, r3.x
      exp r6.y, r3.y
      exp r6.z, r3.z
      exp r6.w, r3.w
      mul r3, r5, r6
      mad r5, r5, r6, c5.y
      mul r6.xyz, r5.x, c10
      mov r6.w, r3.x
      mul r6, r3.y, r6
      mad r6.xyz, r5.y, c11, r6
      mul r6, r3.z, r6
      mad r6.xyz, r5.z, c12, r6
      mul r1, r3.w, r6.wxyz
      mad r2.xyz, r5.w, c13, r1.yzww
    endif
    add r1.yzw, -r0.xxyz, c4.xxyz
    rcp r3.x, r1.y
    rcp r3.y, r1.z
    rcp r3.z, r1.w
    add r5.xyz, -r0, c30
    mul r5.xyz, r3, r5
    add r0.xyz, -r0, c31
    mul r0.xyz, r3, r0
    min r3.xyz, r0, r5
    max r0.xyz, r0, r5
    max r0.w, r3.z, r3.y
    max_sat r0.w, r0.w, r3.x
    min r0.y, r0.z, r0.y
    min_sat r0.x, r0.y, r0.x
    dp3 r0.y, r1.yzww, r1.yzww
    rsq r0.y, r0.y
    rcp r0.y, r0.y
    add r0.y, r0.y, -c28.x
    add r0.x, -r0.w, r0.x
    max r0.xy, r0, c32.y
    mul r0.x, r0.x, r0.y
    mul r0.x, r0.x, c27.x
    exp r0.x, -r0.x
    add r0.y, -r0.x, c5.w
    mul r0.yzw, r0.y, c29.xxyz
    mad o2.xyz, r0.yzww, r1.x, r2
    mul o2.w, r1.x, r0.x
    mov o0, v3
    mul o1, c32.zzyy, v4.xyxx
//    mov o3, r4  commented out for correction below
    mov o4.w, c5.w
    mov o5, r4
	
mov r0, r4				// move r4 to r0
// At this point r0 is the output position, correctly
// placed, but without stereo.
 
// To create stereo effects, we need to calculate:
//  Xnew = Xold + Separation * (W - Convergence)
 
// Fetch the Separation (r30.x) and Convergence (r30.y)  
// using the Helix NVapi trick
texldl r30, c200.z, s0
 
// (W - Convergence)
add r30.w, r0.w, -r30.y
 
// multiply that times Separation for:
//   Separation * (W - Convergence)
mul r30.z, r30.x, r30.w
 
// Add that to Xold for the complete:
//  Xold + Separation * (W - Convergence)
add r0.x, r0.x, r30.z
		
mov o3, r0				// move fixed r4 (r0) into o3

// approximately 133 instruction slots used

Using this method I also could fix the halo caused by waterfalls and their fog. Now the area shown in lesson 0 looks like this: TheBall19 50.jpg

There are still issues caused by the shaders for the refraction of the water. I hope that these can be fixed, too ;)

Lesson 0.5

On my system The Ball plays the intro video with 1 FPS and crashes when I use AllowNvidiaStereo3d=True. So I couldn't do the quiz and (re)post some experiences I had with game settings and ini files instead: Unfortunately fixes by ini files and graphic settings became less useful in the last years as the PCs became more powerful especially in comparison to XBox 360 and PS3. So most PCs can handle dynamic shadows and simple post effects and there is no more option to turn them off completely. You often only have "low" settings that reduce the shadow's resolution but do not disable it completely. Another reason for very limited in-game settings are ports of console games that only allow You to choose "graphic quality" levels that combine many effects in a single slider. So You often have to disable several effects that work flawless in S3D to remove the one that causes issues. In this case the following trick may work:

Start the game with the highest settings. Then reduce the quality settings until the issue disappears and apply it. Change the settings again to higher quality. IGNORE it when the game tells You to restart the game to apply the higher settings. If You are lucky the effects causing issues still are disabled but other effects without issues are reenabled this way and You get better graphic quality without issues than using the lower settings from the beginning. I still use this trick with Sims 3 which often crashes with helixmod. But of course helixmod is very useful to disable single effects that are bundled with other effects in the general quality slider.

Regarding ini/config files: sometimes You don't have the option to disable effects (setting it to false, off or 0). Then You may try to "break" the effect by using false values at another point. In chrome engine games for example You could not turn off the dynamic shadows but disable them by using ShadowMapSize(1). In some cases it is also useful to flag the ini file as "read only" as Your own settings can be replaced with the default values as soon as You open the option menu in the game (just to change audio settings etc.). Sometimes it may be necessary not to change a value in the config file but also in other files (e.g. for the default settings or backup files from earlier settings). So if a setting in one file doesn't seem to have an effect it can help to search other files that also contain the relevant phrase and change them, too.