The Crew
  5 / 10    
A heads up: If anyone reading this is planning on doing shader hunting in this game, please do me a favour.......... Edit nvm bo3b: Good thinking with lowering the auto-repeat speed. If you want to get fancy, you could add the ability to jump by 10 shaders at a time by holding down shift. If it seems feasible, maybe get (4) to show the CRC name of the file in question. That would make things easier when you alter a bunch of files at once, hit F10, and then wonder which file the syntax error was in (that happened to me a couple of times). Also, I don't know if this is feasible, but could you add a hotkey that cycles through various commonly applied settings to a shader? For example: original, disabled, o0=1, pushed to infinity? oh, and what about ignoring everything in a filename after ps_replace? That would let us append labels/comments to the filenames so that you could see what they were at a glance, without having to open each one and read the internal comments
A heads up: If anyone reading this is planning on doing shader hunting in this game, please do me a favour.......... Edit nvm


bo3b: Good thinking with lowering the auto-repeat speed. If you want to get fancy, you could add the ability to jump by 10 shaders at a time by holding down shift.

If it seems feasible, maybe get (4) to show the CRC name of the file in question. That would make things easier when you alter a bunch of files at once, hit F10, and then wonder which file the syntax error was in (that happened to me a couple of times).

Also, I don't know if this is feasible, but could you add a hotkey that cycles through various commonly applied settings to a shader? For example: original, disabled, o0=1, pushed to infinity?

oh, and what about ignoring everything in a filename after ps_replace? That would let us append labels/comments to the filenames so that you could see what they were at a glance, without having to open each one and read the internal comments

ImageVolnaPC.com - Tips, tweaks, performance comparisons (PhysX card, SLI scaling, etc)

#61
Posted 03/16/2015 02:26 AM   
[quote="DarkStarSword"] How does the bloom behave if you vary the convergence setting (without any attempt to fix it)? Is it always drawn at screen depth (driver not applying the formula at all), does it move *much* faster than everything else in the scene (very low W value, likely constant), or comparable to objects at a certain distance (larger W value)?[/quote]Always at screen depth. But in addition, the headlight blooms also seem to be constructed of multiple shaders (you disable one, and the headlight becomes fainter, but is still there until you disable a couple more) Maybe I should tackle something more discrete, like an HUD element. Would that work in a similar way?
DarkStarSword said:

How does the bloom behave if you vary the convergence setting (without any attempt to fix it)? Is it always drawn at screen depth (driver not applying the formula at all), does it move *much* faster than everything else in the scene (very low W value, likely constant), or comparable to objects at a certain distance (larger W value)?
Always at screen depth. But in addition, the headlight blooms also seem to be constructed of multiple shaders (you disable one, and the headlight becomes fainter, but is still there until you disable a couple more)

Maybe I should tackle something more discrete, like an HUD element. Would that work in a similar way?

ImageVolnaPC.com - Tips, tweaks, performance comparisons (PhysX card, SLI scaling, etc)

#62
Posted 03/16/2015 02:41 AM   
[quote="Volnaiskra"][quote="DarkStarSword"]How does the bloom behave if you vary the convergence setting (without any attempt to fix it)? Is it always drawn at screen depth (driver not applying the formula at all), does it move *much* faster than everything else in the scene (very low W value, likely constant), or comparable to objects at a certain distance (larger W value)?[/quote]Always at screen depth. But in addition, the headlight blooms also seem to be constructed of multiple shaders (you disable one, and the headlight becomes fainter, but is still there until you disable a couple more) Maybe I should tackle something more discrete, like an HUD element. Would that work in a similar way? [/quote] For ones that are always at screen depth, that is pretty likely to just need the output stereo corrected because the driver heuristic misfired. For HUD elements, they do that on purpose, so in general fixing HUD elements by moving them to some fixed depth is the simplest fix. If you want to attach a HUD element to a given object, HUD nameplates, that is generally very hard. You need to find some way to determine the proper depth of the object, and it's not always available.
Volnaiskra said:
DarkStarSword said:How does the bloom behave if you vary the convergence setting (without any attempt to fix it)? Is it always drawn at screen depth (driver not applying the formula at all), does it move *much* faster than everything else in the scene (very low W value, likely constant), or comparable to objects at a certain distance (larger W value)?
Always at screen depth. But in addition, the headlight blooms also seem to be constructed of multiple shaders (you disable one, and the headlight becomes fainter, but is still there until you disable a couple more)

Maybe I should tackle something more discrete, like an HUD element. Would that work in a similar way?

For ones that are always at screen depth, that is pretty likely to just need the output stereo corrected because the driver heuristic misfired.

For HUD elements, they do that on purpose, so in general fixing HUD elements by moving them to some fixed depth is the simplest fix.

If you want to attach a HUD element to a given object, HUD nameplates, that is generally very hard. You need to find some way to determine the proper depth of the object, and it's not always available.

Acer H5360 (1280x720@120Hz) - ASUS VG248QE with GSync mod - 3D Vision 1&2 - Driver 372.54
GTX 970 - i5-4670K@4.2GHz - 12GB RAM - Win7x64+evilKB2670838 - 4 Disk X25 RAID
SAGER NP9870-S - GTX 980 - i7-6700K - Win10 Pro 1607
Latest 3Dmigoto Release
Bo3b's School for ShaderHackers

#63
Posted 03/16/2015 03:01 AM   
ok, I'm going to tackle a shader from the map. The map is all but unusable, but all because of one layer (the roads). The roads are at screendepth, while everything else is deeper (infinity? not sure). So I need to move the roads deeper too. Please help me do this. But you'll need to dumb down your language. When you guys say things like "apply the prime directive" I have no idea what you're talking about :( Here's the pixel shader: [code]//PS map roads - need to go deeper cbuffer cb0 : register(b0) { float4 cb0[1]; } Texture2D<float4> StereoParams : register(t125); Texture1D<float4> IniParams : register(t120); void main( float4 v0 : SV_POSITION0, float4 v1 : TEXCOORD0, float2 v2 : TEXCOORD1, out float4 o0 : SV_Target0) { float4 r0; uint4 bitmask, uiDest; float4 fDest; r0.x = -5.000000000e-001 + v2.x; r0.x = abs(r0.x) + abs(r0.x); r0.x = min(r0.x, 1.000000000e+000); r0.x = 1.000000000e+000 + -r0.x; r0.x = r0.x + r0.x; r0.x = min(r0.x, 1.000000000e+000); r0.x = v1.w * r0.x; o0.w = cb0[0].x * r0.x; o0.xyz = v1.xyz; //o0=1; return; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Generated by Microsoft (R) D3D Shader Disassembler // // // Input signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_POSITION 0 xyzw 0 POS float // TEXCOORD 0 xyzw 1 NONE float xyzw // TEXCOORD 1 xy 2 NONE float x // // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_Target 0 xyzw 0 TARGET float xyzw // ps_4_0 dcl_constantbuffer cb0[1], immediateIndexed dcl_input_ps linear v1.xyzw dcl_input_ps linear v2.x dcl_output o0.xyzw dcl_temps 1 add r0.x, v2.x, l(-0.500000) add r0.x, |r0.x|, |r0.x| min r0.x, r0.x, l(1.000000) add r0.x, -r0.x, l(1.000000) add r0.x, r0.x, r0.x min r0.x, r0.x, l(1.000000) mul r0.x, r0.x, v1.w mul o0.w, r0.x, cb0[0].x mov o0.xyz, v1.xyzx ret // Approximately 0 instruction slots used ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ [/code] And here's the vertex shader: [code]//VS map roads - need to go deeper cbuffer cb1 : register(b1) { float4 cb1[4]; } cbuffer cb0 : register(b0) { float4 cb0[9]; } Texture2D<float4> StereoParams : register(t125); Texture1D<float4> IniParams : register(t120); void main( float4 v0 : position0, float4 v1 : color0, float2 v2 : texcoord0, out float4 o0 : SV_POSITION0, out float4 o1 : TEXCOORD0, out float2 o2 : TEXCOORD1) { float4 r0,r1; uint4 bitmask, uiDest; float4 fDest; r0.x = dot(v0.xyzw, cb1[1].xyzw); r0.y = dot(v0.xyzw, cb1[2].xyzw); r0.z = dot(v0.xyzw, cb1[3].xyzw); r1.x = -cb0[4].w; r1.y = -cb0[5].w; r1.z = -cb0[6].w; r0.xyz = r1.xyz + r0.xyz; r0.xyz = -cb0[8].xyz + r0.xyz; r0.w = 1.000000000e+000; o0.x = dot(r0.xyzw, cb0[0].xyzw); o0.y = dot(r0.xyzw, cb0[1].xyzw); o0.z = dot(r0.xyzw, cb0[2].xyzw); o0.w = dot(r0.xyzw, cb0[3].xyzw); o1.xyzw = v1.zyxw; r0.x = 0.000000000e+000 < v2.x; r0.y = v2.x < 0.000000000e+000; r0.x = ((int)r0.y ? -1 : 0) + ((int)r0.x ? 1 : 0); r0.x = r0.x; o2.x = r0.x * 5.000000000e-001 + 5.000000000e-001; o2.y = v2.y; return; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Generated by Microsoft (R) D3D Shader Disassembler // // // Input signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // position 0 xyzw 0 NONE float xyzw // color 0 xyzw 1 NONE float xyzw // texcoord 0 xy 2 NONE float xy // // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_POSITION 0 xyzw 0 POS float xyzw // TEXCOORD 0 xyzw 1 NONE float xyzw // TEXCOORD 1 xy 2 NONE float xy // vs_4_0 dcl_constantbuffer cb0[9], immediateIndexed dcl_constantbuffer cb1[4], immediateIndexed dcl_input v0.xyzw dcl_input v1.xyzw dcl_input v2.xy dcl_output_siv o0.xyzw, position dcl_output o1.xyzw dcl_output o2.xy dcl_temps 2 dp4 r0.x, v0.xyzw, cb1[1].xyzw dp4 r0.y, v0.xyzw, cb1[2].xyzw dp4 r0.z, v0.xyzw, cb1[3].xyzw mov r1.x, -cb0[4].w mov r1.y, -cb0[5].w mov r1.z, -cb0[6].w add r0.xyz, r0.xyzx, r1.xyzx add r0.xyz, r0.xyzx, -cb0[8].xyzx mov r0.w, l(1.000000) dp4 o0.x, r0.xyzw, cb0[0].xyzw dp4 o0.y, r0.xyzw, cb0[1].xyzw dp4 o0.z, r0.xyzw, cb0[2].xyzw dp4 o0.w, r0.xyzw, cb0[3].xyzw mov o1.xyzw, v1.zyxw lt r0.x, l(0.000000), v2.x lt r0.y, v2.x, l(0.000000) iadd r0.x, r0.y, -r0.x itof r0.x, r0.x mad o2.x, r0.x, l(0.500000), l(0.500000) mov o2.y, v2.y ret // Approximately 0 instruction slots used ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ [/code]
ok, I'm going to tackle a shader from the map. The map is all but unusable, but all because of one layer (the roads). The roads are at screendepth, while everything else is deeper (infinity? not sure). So I need to move the roads deeper too.

Please help me do this. But you'll need to dumb down your language. When you guys say things like "apply the prime directive" I have no idea what you're talking about :(

Here's the pixel shader:
//PS map roads - need to go deeper

cbuffer cb0 : register(b0)
{
float4 cb0[1];
}


Texture2D<float4> StereoParams : register(t125);
Texture1D<float4> IniParams : register(t120);

void main(
float4 v0 : SV_POSITION0,
float4 v1 : TEXCOORD0,
float2 v2 : TEXCOORD1,
out float4 o0 : SV_Target0)
{
float4 r0;
uint4 bitmask, uiDest;
float4 fDest;

r0.x = -5.000000000e-001 + v2.x;
r0.x = abs(r0.x) + abs(r0.x);
r0.x = min(r0.x, 1.000000000e+000);
r0.x = 1.000000000e+000 + -r0.x;
r0.x = r0.x + r0.x;
r0.x = min(r0.x, 1.000000000e+000);
r0.x = v1.w * r0.x;
o0.w = cb0[0].x * r0.x;
o0.xyz = v1.xyz;
//o0=1;
return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION 0 xyzw 0 POS float
// TEXCOORD 0 xyzw 1 NONE float xyzw
// TEXCOORD 1 xy 2 NONE float x
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target 0 xyzw 0 TARGET float xyzw
//
ps_4_0
dcl_constantbuffer cb0[1], immediateIndexed
dcl_input_ps linear v1.xyzw
dcl_input_ps linear v2.x
dcl_output o0.xyzw
dcl_temps 1
add r0.x, v2.x, l(-0.500000)
add r0.x, |r0.x|, |r0.x|
min r0.x, r0.x, l(1.000000)
add r0.x, -r0.x, l(1.000000)
add r0.x, r0.x, r0.x
min r0.x, r0.x, l(1.000000)
mul r0.x, r0.x, v1.w
mul o0.w, r0.x, cb0[0].x
mov o0.xyz, v1.xyzx
ret
// Approximately 0 instruction slots used

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/



And here's the vertex shader:

//VS map roads - need to go deeper

cbuffer cb1 : register(b1)
{
float4 cb1[4];
}

cbuffer cb0 : register(b0)
{
float4 cb0[9];
}


Texture2D<float4> StereoParams : register(t125);
Texture1D<float4> IniParams : register(t120);

void main(
float4 v0 : position0,
float4 v1 : color0,
float2 v2 : texcoord0,
out float4 o0 : SV_POSITION0,
out float4 o1 : TEXCOORD0,
out float2 o2 : TEXCOORD1)
{
float4 r0,r1;
uint4 bitmask, uiDest;
float4 fDest;

r0.x = dot(v0.xyzw, cb1[1].xyzw);
r0.y = dot(v0.xyzw, cb1[2].xyzw);
r0.z = dot(v0.xyzw, cb1[3].xyzw);
r1.x = -cb0[4].w;
r1.y = -cb0[5].w;
r1.z = -cb0[6].w;
r0.xyz = r1.xyz + r0.xyz;
r0.xyz = -cb0[8].xyz + r0.xyz;
r0.w = 1.000000000e+000;
o0.x = dot(r0.xyzw, cb0[0].xyzw);
o0.y = dot(r0.xyzw, cb0[1].xyzw);
o0.z = dot(r0.xyzw, cb0[2].xyzw);
o0.w = dot(r0.xyzw, cb0[3].xyzw);
o1.xyzw = v1.zyxw;
r0.x = 0.000000000e+000 < v2.x;
r0.y = v2.x < 0.000000000e+000;
r0.x = ((int)r0.y ? -1 : 0) + ((int)r0.x ? 1 : 0);
r0.x = r0.x;
o2.x = r0.x * 5.000000000e-001 + 5.000000000e-001;
o2.y = v2.y;
return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// position 0 xyzw 0 NONE float xyzw
// color 0 xyzw 1 NONE float xyzw
// texcoord 0 xy 2 NONE float xy
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION 0 xyzw 0 POS float xyzw
// TEXCOORD 0 xyzw 1 NONE float xyzw
// TEXCOORD 1 xy 2 NONE float xy
//
vs_4_0
dcl_constantbuffer cb0[9], immediateIndexed
dcl_constantbuffer cb1[4], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyzw
dcl_input v2.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xy
dcl_temps 2
dp4 r0.x, v0.xyzw, cb1[1].xyzw
dp4 r0.y, v0.xyzw, cb1[2].xyzw
dp4 r0.z, v0.xyzw, cb1[3].xyzw
mov r1.x, -cb0[4].w
mov r1.y, -cb0[5].w
mov r1.z, -cb0[6].w
add r0.xyz, r0.xyzx, r1.xyzx
add r0.xyz, r0.xyzx, -cb0[8].xyzx
mov r0.w, l(1.000000)
dp4 o0.x, r0.xyzw, cb0[0].xyzw
dp4 o0.y, r0.xyzw, cb0[1].xyzw
dp4 o0.z, r0.xyzw, cb0[2].xyzw
dp4 o0.w, r0.xyzw, cb0[3].xyzw
mov o1.xyzw, v1.zyxw
lt r0.x, l(0.000000), v2.x
lt r0.y, v2.x, l(0.000000)
iadd r0.x, r0.y, -r0.x
itof r0.x, r0.x
mad o2.x, r0.x, l(0.500000), l(0.500000)
mov o2.y, v2.y
ret
// Approximately 0 instruction slots used

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

ImageVolnaPC.com - Tips, tweaks, performance comparisons (PhysX card, SLI scaling, etc)

#64
Posted 03/16/2015 03:20 AM   
Edit: Ninja'd... I really need to refresh the page before posting According to pcgamingwiki.com (bookmark this site), the saves are located in: <Uplay-folder>\savegames\<user-id>\969 Turn off UPlay cloud sync, then rename that directory and you should be able start over. For the bloom, if you are finding multiple shaders that affect it you might need to adjust it in all of them (if they are all drawing parts of the effect directly to the back buffer), or just one of the vertex shaders (if they draw the effect to an off-screen buffer, which is then copied to the back-buffer). Keep in mind that some of them might be red herrings as well (I can usually recognise these quickly as the code is often much simpler than I expect for the type of effect), so don't spend too long on one shader if it's not moving the bloom or is breaking something else. Since it's rendering at screen depth, I would try the standard stereo correction to it's output position since there is a possibility that may just work. If it doesn't work, then chances are the shader doesn't have the necessary depth information to fix it properly (or if it does will be tricky to find), in which case the only options are to move it to a fixed depth (like the examples I gave that move it to infinity), or kill it. A HUD adjustment does work in a similar way, since we almost always want to move it to a fixed depth. This is a typical pattern for adjusting UI to a fixed depth, which is defined by the X constant in the d3dx.ini to make it user customisable (hint: enable the reload_config option in the d3dx.ini before starting the game and you will then be able to edit the parameter live): [code] float4 stereo = StereoParams.Load(0); float separation = stereo.x; float convergence = stereo.y; float hud_depth = IniParams.Load(0).x; o0.x += separation * hud_depth; [/code]e.g: https://github.com/bo3b/3Dmigoto/commit/1e1ad578eca9d80839f0f7554fc12e81bc5f30a5 It's generally not possible (or extremely difficult) to align the HUD to match a specific object (for much the same reason we often can't accurately fix bloom), but occasionally you get lucky and the standard stereo correction works, as it did for enemy markers in Far Cry 4: https://github.com/bo3b/3Dmigoto/commit/9a30077443d1fb309799298ed3dd4408fe778982 BTW, I noticed the shader you posted is missing headers. That's fine for the simpler fixes where we don't really need them, but keep in mind that this won't be a good game to learn more advanced fixes on.
Edit: Ninja'd... I really need to refresh the page before posting


According to pcgamingwiki.com (bookmark this site), the saves are located in:

<Uplay-folder>\savegames\<user-id>\969

Turn off UPlay cloud sync, then rename that directory and you should be able start over.



For the bloom, if you are finding multiple shaders that affect it you might need to adjust it in all of them (if they are all drawing parts of the effect directly to the back buffer), or just one of the vertex shaders (if they draw the effect to an off-screen buffer, which is then copied to the back-buffer). Keep in mind that some of them might be red herrings as well (I can usually recognise these quickly as the code is often much simpler than I expect for the type of effect), so don't spend too long on one shader if it's not moving the bloom or is breaking something else.

Since it's rendering at screen depth, I would try the standard stereo correction to it's output position since there is a possibility that may just work. If it doesn't work, then chances are the shader doesn't have the necessary depth information to fix it properly (or if it does will be tricky to find), in which case the only options are to move it to a fixed depth (like the examples I gave that move it to infinity), or kill it.



A HUD adjustment does work in a similar way, since we almost always want to move it to a fixed depth.

This is a typical pattern for adjusting UI to a fixed depth, which is defined by the X constant in the d3dx.ini to make it user customisable (hint: enable the reload_config option in the d3dx.ini before starting the game and you will then be able to edit the parameter live):
float4 stereo = StereoParams.Load(0);
float separation = stereo.x; float convergence = stereo.y;
float hud_depth = IniParams.Load(0).x;
o0.x += separation * hud_depth;
e.g: https://github.com/bo3b/3Dmigoto/commit/1e1ad578eca9d80839f0f7554fc12e81bc5f30a5

It's generally not possible (or extremely difficult) to align the HUD to match a specific object (for much the same reason we often can't accurately fix bloom), but occasionally you get lucky and the standard stereo correction works, as it did for enemy markers in Far Cry 4:
https://github.com/bo3b/3Dmigoto/commit/9a30077443d1fb309799298ed3dd4408fe778982



BTW, I noticed the shader you posted is missing headers. That's fine for the simpler fixes where we don't really need them, but keep in mind that this won't be a good game to learn more advanced fixes on.

2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit

Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD

Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword

#65
Posted 03/16/2015 04:06 AM   
[quote]Please help me do this. But you'll need to dumb down your language. When you guys say things like "apply the prime directive" I have no idea what you're talking about :([/quote]The "prime directive" or "standard stereo correction formula" is the maths that make 3D Vision work. It's pretty fundamental to fixing anything in 3D so you need to be familiar with it: [url]http://wiki.bo3b.net/index.php?title=Canonical_Stereo_Code[/url] (if you are a maths boff and thinking to yourself, "hang on a tick... that formula can't possibly work!", you're right and the reason is because the formula as we usually apply it is not actually the complete adjustment. There is a hidden division by clipPos.w that happens after the vertex shader has run, known as the "perspective divide". Usually you don't need to worry about it, but occasionally you might) [quote="Volnaiskra"]ok, I'm going to tackle a shader from the map. The map is all but unusable, but all because of one layer (the roads). The roads are at screendepth, while everything else is deeper (infinity? not sure). So I need to move the roads deeper too.[/quote]Ok, so you are trying to align one effect with another - this may complicate things. Quick questions - is the map 2D and always at a fixed depth, or is it 3D, or otherwise has a variable depth? Also, does the map depth vary with convergence? Depending on the answers to these there are several possibilities: 1. Use the standard stereo correction formula/prime directive. There is a possibility it just hasn't been stereoised by the driver, while the map has and this might just work. 2. Use the UI depth adjustment from my previous post. If the map depth varies with convergence this may not work so well, but it's worth trying. 3. Use a variation of the standard stereo correction that moves the roads to a fixed scene depth so they also vary with convergence. Given that you noted that the roads are at screen depth, I think this would be something like this (note: I haven't checked this!): [code] float4 stereo = StereoParams.Load(0); float separation = stereo.x; float convergence = stereo.y; float fake_depth = 10; // Experiment with this value o0.x += separation * (fake_depth - convergence) / fake_depth * o0.w; [/code] 4. There is a possibility that this might not even be a pure UI effect and will need a more advanced fix, but let's try the simple options first. By the way, posting the shaders is definitely helpful, but I really need to see the effect in context as well to provide the best advice since the shaders don't give me a complete picture of how the game is actually using them and examining a 3D screenshot allows me to guess a lot of that.
Please help me do this. But you'll need to dumb down your language. When you guys say things like "apply the prime directive" I have no idea what you're talking about :(
The "prime directive" or "standard stereo correction formula" is the maths that make 3D Vision work. It's pretty fundamental to fixing anything in 3D so you need to be familiar with it:

http://wiki.bo3b.net/index.php?title=Canonical_Stereo_Code

(if you are a maths boff and thinking to yourself, "hang on a tick... that formula can't possibly work!", you're right and the reason is because the formula as we usually apply it is not actually the complete adjustment. There is a hidden division by clipPos.w that happens after the vertex shader has run, known as the "perspective divide". Usually you don't need to worry about it, but occasionally you might)


Volnaiskra said:ok, I'm going to tackle a shader from the map. The map is all but unusable, but all because of one layer (the roads). The roads are at screendepth, while everything else is deeper (infinity? not sure). So I need to move the roads deeper too.
Ok, so you are trying to align one effect with another - this may complicate things.

Quick questions - is the map 2D and always at a fixed depth, or is it 3D, or otherwise has a variable depth? Also, does the map depth vary with convergence?

Depending on the answers to these there are several possibilities:

1. Use the standard stereo correction formula/prime directive. There is a possibility it just hasn't been stereoised by the driver, while the map has and this might just work.

2. Use the UI depth adjustment from my previous post. If the map depth varies with convergence this may not work so well, but it's worth trying.

3. Use a variation of the standard stereo correction that moves the roads to a fixed scene depth so they also vary with convergence. Given that you noted that the roads are at screen depth, I think this would be something like this (note: I haven't checked this!):
float4 stereo = StereoParams.Load(0);
float separation = stereo.x; float convergence = stereo.y;
float fake_depth = 10; // Experiment with this value
o0.x += separation * (fake_depth - convergence) / fake_depth * o0.w;

4. There is a possibility that this might not even be a pure UI effect and will need a more advanced fix, but let's try the simple options first.


By the way, posting the shaders is definitely helpful, but I really need to see the effect in context as well to provide the best advice since the shaders don't give me a complete picture of how the game is actually using them and examining a 3D screenshot allows me to guess a lot of that.

2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit

Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD

Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword

#66
Posted 03/16/2015 04:43 AM   
[quote="Volnaiskra"]ok, I'm going to tackle a shader from the map. The map is all but unusable, but all because of one layer (the roads). The roads are at screendepth, while everything else is deeper (infinity? not sure). So I need to move the roads deeper too. Please help me do this. But you'll need to dumb down your language. When you guys say things like "apply the prime directive" I have no idea what you're talking about :([/quote] So.... That means that you haven't finished the lessons in Bo3b's School for ShaderHackers. That means you are trying to run before you can walk. Trying to fix shaders without going through that earlier material is just going to be overwhelmingly confusing I think. [i]Disabling[/i] effects is completely doable with no background. Fixing effects requires understanding more of the pieces, and just jumping in cold is going to be pretty frustrating. I put a fairly large chunk of time into creating those lessons so that we'd all be at the same level when discussing these sorts of problems, and I'm not keen on spending more time to re-explain the topics here. If you are planning on fixing effects, please, go back and do the classes. It will save all of us time. All of the concepts in the classes apply directly to 3Dmigoto fixes as well. If the videos are too boring, you should still be able to quickly go through the lesson text.
Volnaiskra said:ok, I'm going to tackle a shader from the map. The map is all but unusable, but all because of one layer (the roads). The roads are at screendepth, while everything else is deeper (infinity? not sure). So I need to move the roads deeper too.

Please help me do this. But you'll need to dumb down your language. When you guys say things like "apply the prime directive" I have no idea what you're talking about :(

So.... That means that you haven't finished the lessons in Bo3b's School for ShaderHackers.

That means you are trying to run before you can walk. Trying to fix shaders without going through that earlier material is just going to be overwhelmingly confusing I think.

Disabling effects is completely doable with no background. Fixing effects requires understanding more of the pieces, and just jumping in cold is going to be pretty frustrating.


I put a fairly large chunk of time into creating those lessons so that we'd all be at the same level when discussing these sorts of problems, and I'm not keen on spending more time to re-explain the topics here.

If you are planning on fixing effects, please, go back and do the classes. It will save all of us time. All of the concepts in the classes apply directly to 3Dmigoto fixes as well. If the videos are too boring, you should still be able to quickly go through the lesson text.

Acer H5360 (1280x720@120Hz) - ASUS VG248QE with GSync mod - 3D Vision 1&2 - Driver 372.54
GTX 970 - i5-4670K@4.2GHz - 12GB RAM - Win7x64+evilKB2670838 - 4 Disk X25 RAID
SAGER NP9870-S - GTX 980 - i7-6700K - Win10 Pro 1607
Latest 3Dmigoto Release
Bo3b's School for ShaderHackers

#67
Posted 03/16/2015 05:37 AM   
Looks like I got caught playing hookey, eh? Ok, I'll go back to class. I got up to the constants one, but it seemed unfamiliar compared to 3dmigoto so I stopped the lessons. I also had looked through the prime directive one, but I took one look at the code and ran away. Thanks for all the info guys. I'll keep learning and experimenting and report back.
Looks like I got caught playing hookey, eh? Ok, I'll go back to class. I got up to the constants one, but it seemed unfamiliar compared to 3dmigoto so I stopped the lessons. I also had looked through the prime directive one, but I took one look at the code and ran away.

Thanks for all the info guys. I'll keep learning and experimenting and report back.

ImageVolnaPC.com - Tips, tweaks, performance comparisons (PhysX card, SLI scaling, etc)

#68
Posted 03/16/2015 07:02 AM   
It's easier than it initially seems, the video lessons are an absolute must. I have no programming background at all, and while I still have to ask for help very frequently, I'm starting to get the basics.
It's easier than it initially seems, the video lessons are an absolute must. I have no programming background at all, and while I still have to ask for help very frequently, I'm starting to get the basics.

#69
Posted 03/16/2015 11:10 AM   
I'm getting through them now. Just finished Lesson 5, though it was a bit tricky because I have the full version of The Ball, and some of the code is very different to what bo3b has in the demo (eg. it doesn't have any of the stereoscopic if/else stuff that is in bo3b's video). But I still managed to solve the lava problem even though the code was different, which is hopefully a good sign. I still draw a blank at words like "canonical" and "heuristics", but I think I'm starting to absorb the general gist. I really want to make this fix no matter what. I'll certainly be able to disable the worst of the bloom and lens flares. But if I don't manage to get rid of some of the lighting issues, I'll consider the game a "fair" at best, and will opt to play it in 2D myself (though others might differ so I'll still upload the fix). So that's spurring me on to try and learn the more complex stuff despite this being my first time, so I can actually use my own fix. Between working on Spryke, and making 3D fixes in my spare time, I can see that I'm barely going to play any games this year :D
I'm getting through them now. Just finished Lesson 5, though it was a bit tricky because I have the full version of The Ball, and some of the code is very different to what bo3b has in the demo (eg. it doesn't have any of the stereoscopic if/else stuff that is in bo3b's video).

But I still managed to solve the lava problem even though the code was different, which is hopefully a good sign. I still draw a blank at words like "canonical" and "heuristics", but I think I'm starting to absorb the general gist.

I really want to make this fix no matter what. I'll certainly be able to disable the worst of the bloom and lens flares. But if I don't manage to get rid of some of the lighting issues, I'll consider the game a "fair" at best, and will opt to play it in 2D myself (though others might differ so I'll still upload the fix). So that's spurring me on to try and learn the more complex stuff despite this being my first time, so I can actually use my own fix.

Between working on Spryke, and making 3D fixes in my spare time, I can see that I'm barely going to play any games this year :D

ImageVolnaPC.com - Tips, tweaks, performance comparisons (PhysX card, SLI scaling, etc)

#70
Posted 03/16/2015 11:49 AM   
[quote="Volnaiskra"]I'm getting through them now. Just finished Lesson 5, though it was a bit tricky because I have the full version of The Ball, and some of the code is very different to what bo3b has in the demo (eg. it doesn't have any of the stereoscopic if/else stuff that is in bo3b's video).[/quote]I might have to go back and check that - I have the full version, but it's been so long since I looked at it I can't remember if my shaders matched the ones in the lessons or not :-/ [quote]I still draw a blank at words like "canonical" and "heuristics", but I think I'm starting to absorb the general gist.[/quote]"canonical" would be referring to the stereo correction formula (AKA prime directive) - and it just means the standard form of the equation. Some more advanced fixes may need variations of the formula to account for something else - those are stereo corrections, but are not "canonical". "heuristics" basically means an educated guess. For 3D games, most things need to be converted into 3D, but there are some things that should remain 2D, such as the user interface and shadow maps. The problem is, the driver doesn't know what does and does not been to be 3D, so it makes an educated guess, but it doesn't always get it right - and when it doesn't we need to intervene to fix it's mistake.[/quote] [quote]I really want to make this fix no matter what.[/quote]Hehe - when I was learning this stuff I had a game like that (Miasmata), but the remaining things to fix in it were on the quite advanced end of the spectrum so I waited until I had fixed a dozen other games and had gained enough experience that I felt I had a realistic chance of solving it. Had to come up with a few new tricks for it as well, but it was so worth it :) [quote]Between working on Spryke, and making 3D fixes in my spare time, I can see that I'm barely going to play any games this year :D[/quote]God, tell me about it - since I'm spending so much time fixing games I'm not getting through them anywhere near as fast as I used to. My buying habits have slowed down as well, but probably not enough to match.
Volnaiskra said:I'm getting through them now. Just finished Lesson 5, though it was a bit tricky because I have the full version of The Ball, and some of the code is very different to what bo3b has in the demo (eg. it doesn't have any of the stereoscopic if/else stuff that is in bo3b's video).
I might have to go back and check that - I have the full version, but it's been so long since I looked at it I can't remember if my shaders matched the ones in the lessons or not :-/

I still draw a blank at words like "canonical" and "heuristics", but I think I'm starting to absorb the general gist.
"canonical" would be referring to the stereo correction formula (AKA prime directive) - and it just means the standard form of the equation. Some more advanced fixes may need variations of the formula to account for something else - those are stereo corrections, but are not "canonical".

"heuristics" basically means an educated guess. For 3D games, most things need to be converted into 3D, but there are some things that should remain 2D, such as the user interface and shadow maps. The problem is, the driver doesn't know what does and does not been to be 3D, so it makes an educated guess, but it doesn't always get it right - and when it doesn't we need to intervene to fix it's mistake.

I really want to make this fix no matter what.
Hehe - when I was learning this stuff I had a game like that (Miasmata), but the remaining things to fix in it were on the quite advanced end of the spectrum so I waited until I had fixed a dozen other games and had gained enough experience that I felt I had a realistic chance of solving it. Had to come up with a few new tricks for it as well, but it was so worth it :)

Between working on Spryke, and making 3D fixes in my spare time, I can see that I'm barely going to play any games this year :D
God, tell me about it - since I'm spending so much time fixing games I'm not getting through them anywhere near as fast as I used to. My buying habits have slowed down as well, but probably not enough to match.

2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit

Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD

Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword

#71
Posted 03/16/2015 05:14 PM   
[quote="DarkStarSword"]I might have to go back and check that - I have the full version, but it's been so long since I looked at it I can't remember if my shaders matched the ones in the lessons or not :-/[/quote] Here's the lava shader as I have it [code]//lava // 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; // float UniformPixelScalar_6; // float4 UniformPixelVector_0; // float4 UniformPixelVector_1; // float4 UniformPixelVector_10; // float4 UniformPixelVector_11; // 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 // 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 // UniformPixelVector_6 c9 1 // UniformPixelVector_7 c10 1 // UniformPixelVector_8 c11 1 // UniformPixelVector_9 c12 1 // UniformPixelVector_10 c13 1 // UniformPixelVector_11 c14 1 // UniformPixelScalar_6 c15 1 // SceneColorTexture s0 1 // Texture2D_0 s1 1 // Texture2D_1 s2 1 // Texture2D_2 s3 1 // ps_3_0 //def c220, Const1, Const2, Const3, Const4 def c200, 0, 1, 0.0625, 0 // x=0 for comparison to Const1 def c3, 0.400000006, -0.5, 0.0500000007, 4 def c16, 2.5, -0.25, 0.0250000004, 65503 def c17, 8, -0.5, 0.75, 1 def c18, 0.300000012, 0.589999974, 0.109999999, 0.99000001 def c19, 12, 6, 0, 0 def c20, 0.400000006, 4, 0, 0.0526315793 def c21, 4.80000019, 1.20000005, 0, 8 def c22, 3.19999981, 0.799999952, 0, 3 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 mov r0.w, c21.w mad r0.xy, v3, r0.w, c7 texld r0, r0, s2 max_sat r1.x, r0.y, c3.x mad r0.x, r1.x, c3.y, c3.z dp3 r0.y, v2, v2 rsq r0.y, r0.y mul r0.yz, r0.y, v2.xxyw mov r1.zw, c22 mad r1.xy, v3, r1.w, c6 mad r0.xw, r0.x, r0.yyzz, r1.xyzy texld r2, r0.xwzw, s1 mov r0.x, c16.x mad r0.xw, v3.xyzy, r0.x, c10.xyzy texld r3, r0.xwzw, s2 max_sat r0.x, r3.z, c3.x mad r0.x, r0.x, c16.y, c16.z mad r1.xy, v3, c3.w, c3.y dp2add r3.x, c8, r1, r1.z dp2add r3.y, c9, r1, r1.z add r3.xy, r3, -c3.y mad r0.xy, r0.x, r0.yzzw, r3 texld r0, r0, s1 //made top brighter mul_sat r0.xyz, r0, r2 dp3 r0.w, r0, c18 mul r0.xyz, r0, c20 mad r2.xyz, r0.w, c19, -r0 dp2add r3.x, c11, r1, r1.z dp2add r3.y, c12, r1, r1.z add r1.xy, r3, -c3.y texld r3, r1, s2 mad r1.xy, v3, c17.x, c17.y dp2add r3.x, c13, r1, r1.z dp2add r3.y, c14, r1, r1.z add r1.xy, r3, -c3.y texld r1, r1, s2 add r0.w, r1.z, r1.z mul r0.w, r3.z, r0.w mul r0.w, r0.w, c16.x mad r0.xyz, r0.w, r2, r0 rcp r0.w, v1.w //mul r1.xy, r0.w, v1 mad r1.xy, r1, c1, c1.wzzw texld_pp r1, r1, s0 //this is it? min_pp r0.w, r1.w, c16.w mad r0.w, r0.w, c2.z, -c2.w rcp_pp r0.w, r0.w // add r0.w, r0.w, -v1.w mul_sat r0.w, r0.w, c20.w mul r0.w, r0.w, c18.w add r1.xy, c4, v3 texld r1, r1, s1 add r1.yz, c5.xxyw, v3.xxyw texld r2, r1.yzzw, s1 mul r1.x, r1.x, r2.x mul r1.y, r1.x, c15.x mul r1.yzw, r1.y, c22.xxyz mad r1.xyz, r1.x, c21, r1.yzww lrp r2.xyz, r0.w, r0, r1 texld r0, v3, s3 //makes redder add r0.x, r0.y, c17.z mad_pp r0.xyz, r0.x, r2, c0 mad_pp oC0.xyz, r0, v0.w, v0 mov_pp oC0.w, c17.w //disable lava // if Const1 = 0 disable effect, else leave it on mov r30.x, c220.x if_eq r30.x, c200.x mov oC0.xyzw, c200.wwww //fix lava mov r30.xyzw, c200.wwww mul r1.xy, r0.w, r30 mov r30.xyzw, c200.wwww add r0.w, r0.w, -r30.w endif // approximately 70 instruction slots used (10 texture, 60 arithmetic) [/code] Note the missing C3 register. In bob's video that's called NvStereoEnabled. Here, it's just plain missing - like they purposely removed it for the final version. There's also a 3dvision-related texture register missing (in bob's video it's "NvStereoFixTexture: s1"), as well as related code further down. Actually, in the bottom body section where all the, er, gibberish is (all that r1.xyyz, mul, add, dp2add stuff) most of my gibberish is different to bob's gibberish. Just comparing them now, I struggle to even find one line that's the same. Even certain commands like "abs" and "cmp" aren't used in mine but are in his. Yet I managed to solve the lava anyway. It seems pretty clear to me that I must be a natural genius at this stuff. Damn. Handsome [i]and[/i] smart.
DarkStarSword said:I might have to go back and check that - I have the full version, but it's been so long since I looked at it I can't remember if my shaders matched the ones in the lessons or not :-/


Here's the lava shader as I have it

//lava


// 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;
// float UniformPixelScalar_6;
// float4 UniformPixelVector_0;
// float4 UniformPixelVector_1;
// float4 UniformPixelVector_10;
// float4 UniformPixelVector_11;
// 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
// 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
// UniformPixelVector_6 c9 1
// UniformPixelVector_7 c10 1
// UniformPixelVector_8 c11 1
// UniformPixelVector_9 c12 1
// UniformPixelVector_10 c13 1
// UniformPixelVector_11 c14 1
// UniformPixelScalar_6 c15 1
// SceneColorTexture s0 1
// Texture2D_0 s1 1
// Texture2D_1 s2 1
// Texture2D_2 s3 1
//

ps_3_0


//def c220, Const1, Const2, Const3, Const4
def c200, 0, 1, 0.0625, 0 // x=0 for comparison to Const1




def c3, 0.400000006, -0.5, 0.0500000007, 4
def c16, 2.5, -0.25, 0.0250000004, 65503
def c17, 8, -0.5, 0.75, 1
def c18, 0.300000012, 0.589999974, 0.109999999, 0.99000001
def c19, 12, 6, 0, 0
def c20, 0.400000006, 4, 0, 0.0526315793
def c21, 4.80000019, 1.20000005, 0, 8
def c22, 3.19999981, 0.799999952, 0, 3
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
mov r0.w, c21.w
mad r0.xy, v3, r0.w, c7
texld r0, r0, s2
max_sat r1.x, r0.y, c3.x
mad r0.x, r1.x, c3.y, c3.z
dp3 r0.y, v2, v2
rsq r0.y, r0.y
mul r0.yz, r0.y, v2.xxyw
mov r1.zw, c22
mad r1.xy, v3, r1.w, c6
mad r0.xw, r0.x, r0.yyzz, r1.xyzy
texld r2, r0.xwzw, s1
mov r0.x, c16.x
mad r0.xw, v3.xyzy, r0.x, c10.xyzy
texld r3, r0.xwzw, s2
max_sat r0.x, r3.z, c3.x
mad r0.x, r0.x, c16.y, c16.z
mad r1.xy, v3, c3.w, c3.y
dp2add r3.x, c8, r1, r1.z
dp2add r3.y, c9, r1, r1.z
add r3.xy, r3, -c3.y
mad r0.xy, r0.x, r0.yzzw, r3
texld r0, r0, s1 //made top brighter
mul_sat r0.xyz, r0, r2
dp3 r0.w, r0, c18
mul r0.xyz, r0, c20
mad r2.xyz, r0.w, c19, -r0
dp2add r3.x, c11, r1, r1.z
dp2add r3.y, c12, r1, r1.z
add r1.xy, r3, -c3.y
texld r3, r1, s2
mad r1.xy, v3, c17.x, c17.y
dp2add r3.x, c13, r1, r1.z
dp2add r3.y, c14, r1, r1.z
add r1.xy, r3, -c3.y
texld r1, r1, s2
add r0.w, r1.z, r1.z
mul r0.w, r3.z, r0.w
mul r0.w, r0.w, c16.x
mad r0.xyz, r0.w, r2, r0
rcp r0.w, v1.w


//mul r1.xy, r0.w, v1




mad r1.xy, r1, c1, c1.wzzw
texld_pp r1, r1, s0 //this is it?
min_pp r0.w, r1.w, c16.w
mad r0.w, r0.w, c2.z, -c2.w
rcp_pp r0.w, r0.w


// add r0.w, r0.w, -v1.w



mul_sat r0.w, r0.w, c20.w
mul r0.w, r0.w, c18.w
add r1.xy, c4, v3
texld r1, r1, s1
add r1.yz, c5.xxyw, v3.xxyw
texld r2, r1.yzzw, s1
mul r1.x, r1.x, r2.x
mul r1.y, r1.x, c15.x
mul r1.yzw, r1.y, c22.xxyz
mad r1.xyz, r1.x, c21, r1.yzww
lrp r2.xyz, r0.w, r0, r1
texld r0, v3, s3 //makes redder

add r0.x, r0.y, c17.z
mad_pp r0.xyz, r0.x, r2, c0
mad_pp oC0.xyz, r0, v0.w, v0
mov_pp oC0.w, c17.w

//disable lava
// if Const1 = 0 disable effect, else leave it on
mov r30.x, c220.x
if_eq r30.x, c200.x
mov oC0.xyzw, c200.wwww

//fix lava
mov r30.xyzw, c200.wwww
mul r1.xy, r0.w, r30

mov r30.xyzw, c200.wwww
add r0.w, r0.w, -r30.w



endif



// approximately 70 instruction slots used (10 texture, 60 arithmetic)


Note the missing C3 register. In bob's video that's called NvStereoEnabled. Here, it's just plain missing - like they purposely removed it for the final version.

There's also a 3dvision-related texture register missing (in bob's video it's "NvStereoFixTexture: s1"), as well as related code further down.

Actually, in the bottom body section where all the, er, gibberish is (all that r1.xyyz, mul, add, dp2add stuff) most of my gibberish is different to bob's gibberish. Just comparing them now, I struggle to even find one line that's the same. Even certain commands like "abs" and "cmp" aren't used in mine but are in his.

Yet I managed to solve the lava anyway. It seems pretty clear to me that I must be a natural genius at this stuff. Damn. Handsome and smart.

ImageVolnaPC.com - Tips, tweaks, performance comparisons (PhysX card, SLI scaling, etc)

#72
Posted 03/17/2015 06:12 AM   
Oh now I remember - I had jumped ahead in the lessons and had started applying what I was learning to Betrayer instead of The Ball, so naturally the shaders I was looking at didn't match the lessons.
Oh now I remember - I had jumped ahead in the lessons and had started applying what I was learning to Betrayer instead of The Ball, so naturally the shaders I was looking at didn't match the lessons.

2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit

Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD

Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword

#73
Posted 03/17/2015 06:50 AM   
[quote="DarkStarSword"] According to pcgamingwiki.com (bookmark this site), the saves are located in: <Uplay-folder>\savegames\<user-id>\969 Turn off UPlay cloud sync, then rename that directory and you should be able start over.[/quote]Weird, I don't have the 969 folder at all. When googling, the consensus seems to be that the saves are stored server-side. But apparently you can get a new "starter car" with a microtransaction and replay the first bit, so I might have a look at that later on.
DarkStarSword said:
According to pcgamingwiki.com (bookmark this site), the saves are located in:

<Uplay-folder>\savegames\<user-id>\969

Turn off UPlay cloud sync, then rename that directory and you should be able start over.
Weird, I don't have the 969 folder at all. When googling, the consensus seems to be that the saves are stored server-side. But apparently you can get a new "starter car" with a microtransaction and replay the first bit, so I might have a look at that later on.

ImageVolnaPC.com - Tips, tweaks, performance comparisons (PhysX card, SLI scaling, etc)

#74
Posted 03/18/2015 03:21 AM   
ok, I've done all the lessons, and the lava looks flabbergastingly good now. I have a foggy understanding of the principles, though much better than before. I'm ready to jump back into the crew and tackle that rogue map layer. I want to try the various methods you guys have suggested thus far, but I'm hitting a block when trying the first one (the canonical code). The problem seems to come down to o2.w. When I include it, I get a low beep. Am I supposed to declare it earlier or something? [code]//map roads vs? cbuffer cb1 : register(b1) { float4 cb1[4]; } cbuffer cb0 : register(b0) { float4 cb0[9]; } Texture2D<float4> StereoParams : register(t125); Texture1D<float4> IniParams : register(t120); void main( float4 v0 : position0, float4 v1 : color0, float2 v2 : texcoord0, out float4 o0 : SV_POSITION0, out float4 o1 : TEXCOORD0, out float2 o2 : TEXCOORD1) { float4 r0,r1; uint4 bitmask, uiDest; float4 fDest; r0.x = dot(v0.xyzw, cb1[1].xyzw); r0.y = dot(v0.xyzw, cb1[2].xyzw); r0.z = dot(v0.xyzw, cb1[3].xyzw); r1.x = -cb0[4].w; r1.y = -cb0[5].w; r1.z = -cb0[6].w; r0.xyz = r1.xyz + r0.xyz; r0.xyz = -cb0[8].xyz + r0.xyz; r0.w = 1.000000000e+000; o0.x = dot(r0.xyzw, cb0[0].xyzw); o0.y = dot(r0.xyzw, cb0[1].xyzw); o0.z = dot(r0.xyzw, cb0[2].xyzw); o0.w = dot(r0.xyzw, cb0[3].xyzw); o1.xyzw = v1.zyxw; r0.x = 0.000000000e+000 < v2.x; r0.y = v2.x < 0.000000000e+000; r0.x = ((int)r0.y ? -1 : 0) + ((int)r0.x ? 1 : 0); r0.x = r0.x; o2.x = r0.x * 5.000000000e-001 + 5.000000000e-001; o2.y = v2.y; //o2=0; //this successfully disables the roads //the prime directive: // clipPos.x += EyeSign * Separation * ( clipPos.w – Convergence ) //these pass the beep test: float4 stereo = StereoParams.Load(0); float separation = stereo.x; float convergence = stereo.y; // o2.x += separation * (111-convergence); //this passes the beep test; // o2.x += separation * (o2.w - convergence); //this doesn't pass the beep test. The problem seems to be o2.w return; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Generated by Microsoft (R) D3D Shader Disassembler // // // Input signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // position 0 xyzw 0 NONE float xyzw // color 0 xyzw 1 NONE float xyzw // texcoord 0 xy 2 NONE float xy // // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_POSITION 0 xyzw 0 POS float xyzw // TEXCOORD 0 xyzw 1 NONE float xyzw // TEXCOORD 1 xy 2 NONE float xy // vs_4_0 dcl_constantbuffer cb0[9], immediateIndexed dcl_constantbuffer cb1[4], immediateIndexed dcl_input v0.xyzw dcl_input v1.xyzw dcl_input v2.xy dcl_output_siv o0.xyzw, position dcl_output o1.xyzw dcl_output o2.xy dcl_temps 2 dp4 r0.x, v0.xyzw, cb1[1].xyzw dp4 r0.y, v0.xyzw, cb1[2].xyzw dp4 r0.z, v0.xyzw, cb1[3].xyzw mov r1.x, -cb0[4].w mov r1.y, -cb0[5].w mov r1.z, -cb0[6].w add r0.xyz, r0.xyzx, r1.xyzx add r0.xyz, r0.xyzx, -cb0[8].xyzx mov r0.w, l(1.000000) dp4 o0.x, r0.xyzw, cb0[0].xyzw dp4 o0.y, r0.xyzw, cb0[1].xyzw dp4 o0.z, r0.xyzw, cb0[2].xyzw dp4 o0.w, r0.xyzw, cb0[3].xyzw mov o1.xyzw, v1.zyxw lt r0.x, l(0.000000), v2.x lt r0.y, v2.x, l(0.000000) iadd r0.x, r0.y, -r0.x itof r0.x, r0.x mad o2.x, r0.x, l(0.500000), l(0.500000) mov o2.y, v2.y ret // Approximately 0 instruction slots used ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ [/code]
ok, I've done all the lessons, and the lava looks flabbergastingly good now.

I have a foggy understanding of the principles, though much better than before. I'm ready to jump back into the crew and tackle that rogue map layer.

I want to try the various methods you guys have suggested thus far, but I'm hitting a block when trying the first one (the canonical code).

The problem seems to come down to o2.w. When I include it, I get a low beep. Am I supposed to declare it earlier or something?

//map roads vs?

cbuffer cb1 : register(b1)
{
float4 cb1[4];
}

cbuffer cb0 : register(b0)
{
float4 cb0[9];
}


Texture2D<float4> StereoParams : register(t125);
Texture1D<float4> IniParams : register(t120);

void main(
float4 v0 : position0,
float4 v1 : color0,
float2 v2 : texcoord0,
out float4 o0 : SV_POSITION0,
out float4 o1 : TEXCOORD0,
out float2 o2 : TEXCOORD1)
{
float4 r0,r1;
uint4 bitmask, uiDest;
float4 fDest;

r0.x = dot(v0.xyzw, cb1[1].xyzw);
r0.y = dot(v0.xyzw, cb1[2].xyzw);
r0.z = dot(v0.xyzw, cb1[3].xyzw);
r1.x = -cb0[4].w;
r1.y = -cb0[5].w;
r1.z = -cb0[6].w;
r0.xyz = r1.xyz + r0.xyz;
r0.xyz = -cb0[8].xyz + r0.xyz;
r0.w = 1.000000000e+000;
o0.x = dot(r0.xyzw, cb0[0].xyzw);
o0.y = dot(r0.xyzw, cb0[1].xyzw);
o0.z = dot(r0.xyzw, cb0[2].xyzw);
o0.w = dot(r0.xyzw, cb0[3].xyzw);
o1.xyzw = v1.zyxw;
r0.x = 0.000000000e+000 < v2.x;
r0.y = v2.x < 0.000000000e+000;
r0.x = ((int)r0.y ? -1 : 0) + ((int)r0.x ? 1 : 0);
r0.x = r0.x;
o2.x = r0.x * 5.000000000e-001 + 5.000000000e-001;
o2.y = v2.y;


//o2=0; //this successfully disables the roads

//the prime directive:
// clipPos.x += EyeSign * Separation * ( clipPos.w – Convergence )


//these pass the beep test:
float4 stereo = StereoParams.Load(0);
float separation = stereo.x; float convergence = stereo.y;

// o2.x += separation * (111-convergence); //this passes the beep test;

// o2.x += separation * (o2.w - convergence); //this doesn't pass the beep test. The problem seems to be o2.w











return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// position 0 xyzw 0 NONE float xyzw
// color 0 xyzw 1 NONE float xyzw
// texcoord 0 xy 2 NONE float xy
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION 0 xyzw 0 POS float xyzw
// TEXCOORD 0 xyzw 1 NONE float xyzw
// TEXCOORD 1 xy 2 NONE float xy
//
vs_4_0
dcl_constantbuffer cb0[9], immediateIndexed
dcl_constantbuffer cb1[4], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyzw
dcl_input v2.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xy
dcl_temps 2
dp4 r0.x, v0.xyzw, cb1[1].xyzw
dp4 r0.y, v0.xyzw, cb1[2].xyzw
dp4 r0.z, v0.xyzw, cb1[3].xyzw
mov r1.x, -cb0[4].w
mov r1.y, -cb0[5].w
mov r1.z, -cb0[6].w
add r0.xyz, r0.xyzx, r1.xyzx
add r0.xyz, r0.xyzx, -cb0[8].xyzx
mov r0.w, l(1.000000)
dp4 o0.x, r0.xyzw, cb0[0].xyzw
dp4 o0.y, r0.xyzw, cb0[1].xyzw
dp4 o0.z, r0.xyzw, cb0[2].xyzw
dp4 o0.w, r0.xyzw, cb0[3].xyzw
mov o1.xyzw, v1.zyxw
lt r0.x, l(0.000000), v2.x
lt r0.y, v2.x, l(0.000000)
iadd r0.x, r0.y, -r0.x
itof r0.x, r0.x
mad o2.x, r0.x, l(0.500000), l(0.500000)
mov o2.y, v2.y
ret
// Approximately 0 instruction slots used

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

ImageVolnaPC.com - Tips, tweaks, performance comparisons (PhysX card, SLI scaling, etc)

#75
Posted 03/18/2015 11:32 AM   
  5 / 10    
Scroll To Top