Skip to content

Commit

Permalink
Betrayer: Completely fix light shafts
Browse files Browse the repository at this point in the history
Hooray! This game might actually be glitch free now!

Removed the ability to disable light shafts - why would you want to disable
that which is perfect?

Need to check if there is still any issues with the enemies, but they are very
uncooperative and move around a lot, so it's hard to tell.

I'll have to play through once more to be sure - there was one minor broken
effect near the end (fire), but it's concievable that one of the other ghosting
fixes or Eqzitara's fixes got it as well.
  • Loading branch information
DarkStarSword committed Sep 4, 2014
1 parent fd34ce4 commit f4e6474
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 31 deletions.
17 changes: 16 additions & 1 deletion Betrayer/ShaderOverride/PixelShaders/44C59ABC.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Something something possibly relevant to light shafts because it uses the
// TextureSpaceBlurOrigin

//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
Expand Down Expand Up @@ -31,12 +34,24 @@
def c1, 4, 0, 0, 0
def c2, 0.5, 1.5, 0, 1
def c3, 0.300000012, 0.589999974, 0.109999999, -3
def c220, 0, 1, 0.0625, 0.5
dcl_texcoord v0.xy
dcl_texcoord1 v1.xy
dcl_2d s0
dcl_2d s1
dcl_2d s13

mov r0.zw, c8
mad r0.xy, v0, -r0.zwzw, c0

// Adjust the blur offset to match the light shaft adjustment:
// mad r0.xy, v0, -r0.zwzw, c0

mov r4, c0
texldl r5, c220.z, s13
mul r5.x, r5.x, c220.w // Adjust each eye by half the separation
add r4.x, r4.x, r5.x
mad r0.xy, v0, -r0.zwzw, r4

dp2add r0.x, r0, r0, c2.z
rsq r0.x, r0.x
rcp r0.x, r0.x
Expand Down
18 changes: 17 additions & 1 deletion Betrayer/ShaderOverride/PixelShaders/60D72E9C.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Pixel shader something something god rays mask thing
// This one seems to control how far the rays extend.

//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
Expand Down Expand Up @@ -31,8 +34,11 @@
def c1, 1, 0, 8, 0.25
def c3, 0.300000012, 0.589999974, 0.109999999, 6.10351999e-005
def c4, 0.5, 5, 0, 0
def c220, 0, 1, 0.0625, 0.5
dcl_texcoord v0.xy
dcl_2d s0
dcl_2d s13

add r0.xy, -c10, v0
rcp r1.x, c10.z
rcp r1.y, c10.w
Expand Down Expand Up @@ -95,7 +101,17 @@
cmp r0.yzw, r0.z, r1.xxyz, c1.y
mul r0.xyz, r0.x, r0.yzww
mov r1.zw, c11
mad r1.xy, v0, -r1.zwzw, c0

// Adjust blur origin to match adjusted light shafts
// mad r1.xy, v0, -r1.zwzw, c0

mov r4, c0
texldl r5, c220.z, s13
mul r5.x, r5.x, c220.w // Adjust each eye by half the separation
add r4.x, r4.x, r5.x

mad r1.xy, v0, -r1.zwzw, r4

dp2add r0.w, r1, r1, c1.y
rsq r0.w, r0.w
rcp r0.w, r0.w
Expand Down
5 changes: 0 additions & 5 deletions Betrayer/ShaderOverride/PixelShaders/85C91670.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,3 @@ mad r1, v0.xyxy, -r1.zwzw, r4.xyxy
mad r3, r1, c2.y, r3
endrep
mul oC0, r2, c1.z

// Optionally disable broken lightshafts:
// if_eq r13.x, c1.x // if (Const2 == 0) {
// mov oC0.xyzw, c1.xxxx // oC0 = (0, 0, 0, 0);
// endif // }
25 changes: 1 addition & 24 deletions Betrayer/dx9settings.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[General]
UseRenderedShaders = true
DumpAll = false
PresetsKeysList = 1;2;
PresetsKeysList = 1;
DefVSConst1 = 200
DefPSConst1 = 200
// These are from Eqzitara's fix:
Expand All @@ -24,13 +24,6 @@ Presets = 0;1;
Type = 2
//Delay = 150
// Pressing 0 (key 48) toggles Const2, which is used to enable/disable light
// shafts.
[KEY2]
Key = 48
Presets = 2;3;
Type = 1
// Preset 0 is activated while the right mouse button is held down. It lowers
// the convergence for easier aiming.
Expand All @@ -53,19 +46,3 @@ SaveSepSettings = true
//Separation = 0x42c80000
Const1 = 0x3f7eb852
UseByDef = true
// Preset 2 is activated when 0 is pressed and sets Const2 to 0.0, which will
// disable the light shafts. As the lower numbered preset of KEY2, this one
// will be activated the first time 0 is pressed, hence we don't want it to be
// the default preset.
[PRES2]
Const2 = 0x00000000


// Preset 3 is activated when 0 is pressed and sets Const2 to 1.0, which will
// enable the light shafts. Since the light shafts are not very distracting in
// this game, I've left them enabled by default.
[PRES3]
Const2 = 0x3f800000
UseByDef = true

0 comments on commit f4e6474

Please sign in to comment.