Bo3b's School For Shaderhackers
  16 / 88    
@PirateGuyBrush: Here's another way of looking at the commands as well. This is all a lot easier in HighLevelShaderLanguage (HLSL) because we don't have to use arcane syntax, we use more math-link syntax. Fundamental ASM idea is that '//' means comments. Anything after those characters is ignored by the computer as being human-readable stuff. In case it helps, here are the math versions of what is happening: [code][i]mov [/i]aka move: x = y becomes mov x, y r30.x = c200.y becomes mov r30.x, c200.y [i]add[/i]: x = y + z becomes add x, y, z r30.x = r30.y + c200.y becomes add r30.x, r30.y, c200.y [i]mul [/i]aka multiply: x = y * z becomes mul x, y, z r30.x = r30.y * c200.y becomes mul r30.x, r30.y, c200.y [i]mad [/i]aka multiply-add: x = y * z + p becomes mad x, y, z, p r0.x = r30.x * r30.w + r0.x becomes mad r0.x, r30.x, r30.w, r0.x [/code]
@PirateGuyBrush: Here's another way of looking at the commands as well. This is all a lot easier in HighLevelShaderLanguage (HLSL) because we don't have to use arcane syntax, we use more math-link syntax.

Fundamental ASM idea is that '//' means comments. Anything after those characters is ignored by the computer as being human-readable stuff.


In case it helps, here are the math versions of what is happening:

mov aka move:

x = y becomes
mov x, y
r30.x = c200.y becomes
mov r30.x, c200.y

add:

x = y + z becomes
add x, y, z
r30.x = r30.y + c200.y becomes
add r30.x, r30.y, c200.y

mul aka multiply:

x = y * z becomes
mul x, y, z
r30.x = r30.y * c200.y becomes
mul r30.x, r30.y, c200.y

mad aka multiply-add:

x = y * z + p becomes
mad x, y, z, p
r0.x = r30.x * r30.w + r0.x becomes
mad r0.x, r30.x, r30.w, r0.x

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

Posted 09/25/2014 03:49 AM   
That's starting to make sense, thanks for the clarifications :)
That's starting to make sense, thanks for the clarifications :)

Posted 09/25/2014 04:20 AM   
@Bo3b [EDIT] Lesson 6 completed (prime directive and oil fix), uploaded with description, and screenshots. Fantastic! I finally managed to find the right spot to input the prime directive code on the water level. Thanks to the nvidia pdf on the 3d vision engine/mechanics you referenced to, as well as the Canonical Stereo Code. Awesome breakdown regarding the calculation functions from Mike as well. Great input from 4everAwake as well, so all these additional info you guys provided guided me to a solution for a fix. And I also feel confident in the behaviour and backround for the different statements and their usage as well. ! No location/offset problems where the water hits the stairs and gradually increases its width (x parameter) anymore, or any of the annoying reflection problems. Fantastic! I went through lesson 6, so that was a key lesson. Thank you so much for the great tutorial and clearifications from all the others mentioned. :) I will upload the results to the wiki page now. :) Yay! Gotta love shaderhacking! "What about that!". hehe. love that phrase when you reach the level of accomplishment Bo3b. :) Looking forward to more lessons. ;)
@Bo3b

[EDIT]
Lesson 6 completed (prime directive and oil fix), uploaded with description, and screenshots.

Fantastic! I finally managed to find the right spot to input the prime directive code on the water level. Thanks to the nvidia pdf on the 3d vision engine/mechanics you referenced to, as well as the Canonical Stereo Code. Awesome breakdown regarding the calculation functions from Mike as well. Great input from 4everAwake as well, so all these additional info you guys provided guided me to a solution for a fix.

And I also feel confident in the behaviour and backround for the different statements and their usage as well. ! No location/offset problems where the water hits the stairs and gradually increases its width (x parameter) anymore, or any of the annoying reflection problems. Fantastic! I went through lesson 6, so that was a key lesson. Thank you so much for the great tutorial and clearifications from all the others mentioned. :)

I will upload the results to the wiki page now. :)
Yay! Gotta love shaderhacking!

"What about that!". hehe. love that phrase when you reach the level of accomplishment Bo3b. :)

Looking forward to more lessons. ;)

CAB : Lian Li Tyr X-2000B | PSU : Cooler Master V1200 (1200W) | MB : Asus Rampage IV Extreme ROG | CPU : INTELi7 3930K @ 4,5GHz | FAN : Noctua NH-D14 SE | GPU(s) : (Tri-SLI) EVGA Geforce GTX 980Ti SC+ ACX 2.0 | MEM : Corsair Vengeance DDR3 1600MHz (16GB) | SSD : OCZ Vertex 2 (120GB) | SSD(s) : Samsung EVO 850 Pro (2x500GB RAID0 | SSD : Kingston HyperX 3K (2x240GB RAID0, 1x120GB) | SSD : Samsung EVO 840 (1TB) | SCR : Eizo Flexscan SX2461WK (IPS/Editing) | SCR : Eizo Flexscan EV2736W (IPS/1440p/Gaming/Editing) | SCR : Wacom Cintiq Companion Hybrid (Photo Editing/Illustration/Drawing) | SCR : Asus ROG Swift PG278Q (1440p/144Hz/G-Sync/3DV 2/Gaming) | SCR : Asus PB287Q (4K Gaming/DAW) | SCR/TV : Philips 55" PUS9109/12 UHD (4K Gaming) | NAS : QNAP TS-419PII /w Lian Li EX-503B Drive Bay | HID : (Keyboard) Corsair K95 RGB Brown Cherry (Mouse) Corsair M95 Performance & Generic Logitech HID Devices | NIC : Asus RT-AC66U (with Asus repeaters| NIC : Jensen Scandinavia 8-port Gigabit switch | SYS : NVIDIA SHIELD Portable | SYS : NVIDIA SHIELD Tablet (16 GB version/non-LTE) | Oculus Rift DK2

Posted 09/25/2014 05:55 PM   
Hey bo3b, got a question for you. I'm trying to improve the fix for A Story About Your Uncle. At present I'm focusing on shadows cast by characters, and self-shadowing on characters. I've got the following two pixel shaders identified and you should be able to see my edits, but they don't seem to be working. [code] //Character dynamic shadows // // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 ps_3_0 def c219, 0, 0, 0, 0 dcl_texcoord4 v0.x mov oC0, v0.x mov oC0.xyzw, c219.xxxx // approximately 1 instruction slot used [/code] [code] //Self shadows on characters // // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 // // Parameters: // // sampler2D PixelTexture2D_4; // // // Registers: // // Name Reg Size // ---------------- ----- ---- // PixelTexture2D_4 s0 1 // ps_3_0 def c0, -0.300000012, 0, 0, 0 dcl_texcoord v0.xy dcl_texcoord4 v1.x dcl_2d s0 texld r0, v0, s0 add r0, r0.x, c0.x texkill r0 mov oC0, v1.x mov oC0.xyzw, c0.yyyy // approximately 4 instruction slots used (1 texture, 3 arithmetic) [/code] Where have I gone wrong?
Hey bo3b, got a question for you. I'm trying to improve the fix for A Story About Your Uncle. At present I'm focusing on shadows cast by characters, and self-shadowing on characters. I've got the following two pixel shaders identified and you should be able to see my edits, but they don't seem to be working.

//Character dynamic shadows
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
ps_3_0
def c219, 0, 0, 0, 0

dcl_texcoord4 v0.x
mov oC0, v0.x

mov oC0.xyzw, c219.xxxx

// approximately 1 instruction slot used



//Self shadows on characters
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
// Parameters:
//
// sampler2D PixelTexture2D_4;
//
//
// Registers:
//
// Name Reg Size
// ---------------- ----- ----
// PixelTexture2D_4 s0 1
//

ps_3_0
def c0, -0.300000012, 0, 0, 0
dcl_texcoord v0.xy
dcl_texcoord4 v1.x
dcl_2d s0
texld r0, v0, s0
add r0, r0.x, c0.x
texkill r0
mov oC0, v1.x

mov oC0.xyzw, c0.yyyy

// approximately 4 instruction slots used (1 texture, 3 arithmetic)


Where have I gone wrong?

Posted 09/26/2014 05:49 PM   
@Pirateguybrush In the shader file for the "Character dynamic shadows", line #10, I noticed you used c219.xxxx. Use c219.wwww instead. So "mov oC0.xyzw, c219.wwww" (w = nulling, disable, while y = enable). So try using wwww (to toggle rgba off). Perhaps that will help you out. You've probably already made sure your chosen c register value of 219, is not used in the game. But I don't know if c219, 0, 0, 0 ,0 will work. I usually just type in the prime directive value as well for the z parameter (0.0625) (just following the tutorials) but perhaps this is not necessary since this is not related to stereo correction/location. And the x = 0 for comparison to dx9settings.ini with its constants for key toggle mechanism). So I usually just use "def c(value), 0, 1, 0.0625, 0", but "def c219, 0, 0, 0, 0" could work just as well. But definately change the c219.xxxx with c219.wwww. But I'm no Bo3b. Just applying what has worked for me so far through the tutorials. :)
@Pirateguybrush

In the shader file for the "Character dynamic shadows", line #10, I noticed you
used c219.xxxx.

Use c219.wwww instead. So "mov oC0.xyzw, c219.wwww"
(w = nulling, disable, while y = enable). So try using wwww (to toggle rgba off).

Perhaps that will help you out.

You've probably already made sure your chosen c register value of 219, is not used
in the game.

But I don't know if c219, 0, 0, 0 ,0 will work. I usually just type in
the prime directive value as well for the z parameter (0.0625) (just following the
tutorials) but perhaps this is not necessary since this is not related to
stereo correction/location. And the x = 0 for comparison to dx9settings.ini with its
constants for key toggle mechanism). So I usually just use "def c(value), 0, 1, 0.0625, 0",
but "def c219, 0, 0, 0, 0" could work just as well.

But definately change the c219.xxxx with c219.wwww.

But I'm no Bo3b. Just applying what has worked for me so far through the tutorials. :)

CAB : Lian Li Tyr X-2000B | PSU : Cooler Master V1200 (1200W) | MB : Asus Rampage IV Extreme ROG | CPU : INTELi7 3930K @ 4,5GHz | FAN : Noctua NH-D14 SE | GPU(s) : (Tri-SLI) EVGA Geforce GTX 980Ti SC+ ACX 2.0 | MEM : Corsair Vengeance DDR3 1600MHz (16GB) | SSD : OCZ Vertex 2 (120GB) | SSD(s) : Samsung EVO 850 Pro (2x500GB RAID0 | SSD : Kingston HyperX 3K (2x240GB RAID0, 1x120GB) | SSD : Samsung EVO 840 (1TB) | SCR : Eizo Flexscan SX2461WK (IPS/Editing) | SCR : Eizo Flexscan EV2736W (IPS/1440p/Gaming/Editing) | SCR : Wacom Cintiq Companion Hybrid (Photo Editing/Illustration/Drawing) | SCR : Asus ROG Swift PG278Q (1440p/144Hz/G-Sync/3DV 2/Gaming) | SCR : Asus PB287Q (4K Gaming/DAW) | SCR/TV : Philips 55" PUS9109/12 UHD (4K Gaming) | NAS : QNAP TS-419PII /w Lian Li EX-503B Drive Bay | HID : (Keyboard) Corsair K95 RGB Brown Cherry (Mouse) Corsair M95 Performance & Generic Logitech HID Devices | NIC : Asus RT-AC66U (with Asus repeaters| NIC : Jensen Scandinavia 8-port Gigabit switch | SYS : NVIDIA SHIELD Portable | SYS : NVIDIA SHIELD Tablet (16 GB version/non-LTE) | Oculus Rift DK2

Posted 09/26/2014 06:41 PM   
Nope, the code sequence he has there should work I think. Just to clarify, there is no difference between using the .wwww parameter or the .xxxx like Pirate is using. The main purpose of that is to use a '0' for each of the subpieces, and it will work the same in each case, because the .x is zero in this case. The only reason I use the .wwww parameter is because it is generally unused, as a convenience. The significant part is the output register of oC0, where we can also specify it as "mov oC0.rgba, c219.xxxx". Also no difference, just slightly more clear that we are clearing all the color and alpha channel. That code you have should work, assuming this is the right shader. Check the LOG.txt file, and look for your CRC number in the log file to make sure that it assembled. There must be a 'success' line in the shader like: [code].\ShaderOverride\PixelShaders\A977E84A.txt.1 pD3DXAssembleShaderFromFile pixel Shader overrode without errors CRC: 0xA977E84A [/code] If you see an error, that would be something wrong with the code that is not obvious on inspection. If you don't see the lines at all (with your correct CRC), then that shader was not loaded properly and is not in ShaderOverride properly, wrong text file name, wrong folder. Something like that. If you can't see anything obvious, give us more details like LOG info, CRC number.
Nope, the code sequence he has there should work I think.

Just to clarify, there is no difference between using the .wwww parameter or the .xxxx like Pirate is using. The main purpose of that is to use a '0' for each of the subpieces, and it will work the same in each case, because the .x is zero in this case. The only reason I use the .wwww parameter is because it is generally unused, as a convenience.

The significant part is the output register of oC0, where we can also specify it as "mov oC0.rgba, c219.xxxx". Also no difference, just slightly more clear that we are clearing all the color and alpha channel.


That code you have should work, assuming this is the right shader. Check the LOG.txt file, and look for your CRC number in the log file to make sure that it assembled. There must be a 'success' line in the shader like:

.\ShaderOverride\PixelShaders\A977E84A.txt.1 

pD3DXAssembleShaderFromFile

pixel Shader overrode without errors CRC: 0xA977E84A


If you see an error, that would be something wrong with the code that is not obvious on inspection. If you don't see the lines at all (with your correct CRC), then that shader was not loaded properly and is not in ShaderOverride properly, wrong text file name, wrong folder. Something like that.

If you can't see anything obvious, give us more details like LOG info, CRC number.

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

Posted 09/26/2014 10:54 PM   
@Bo3b Thank you for filling in the gaps. Now I'm even wiser than before. :P Always learning. I didn't know you could be this "flexible" with the parameters as you demonstrated. @Pirateguybrush I hope you figure it out. Good luck. ;)
@Bo3b

Thank you for filling in the gaps. Now I'm even wiser than before. :P
Always learning. I didn't know you could be this "flexible" with the
parameters as you demonstrated.

@Pirateguybrush

I hope you figure it out. Good luck. ;)

CAB : Lian Li Tyr X-2000B | PSU : Cooler Master V1200 (1200W) | MB : Asus Rampage IV Extreme ROG | CPU : INTELi7 3930K @ 4,5GHz | FAN : Noctua NH-D14 SE | GPU(s) : (Tri-SLI) EVGA Geforce GTX 980Ti SC+ ACX 2.0 | MEM : Corsair Vengeance DDR3 1600MHz (16GB) | SSD : OCZ Vertex 2 (120GB) | SSD(s) : Samsung EVO 850 Pro (2x500GB RAID0 | SSD : Kingston HyperX 3K (2x240GB RAID0, 1x120GB) | SSD : Samsung EVO 840 (1TB) | SCR : Eizo Flexscan SX2461WK (IPS/Editing) | SCR : Eizo Flexscan EV2736W (IPS/1440p/Gaming/Editing) | SCR : Wacom Cintiq Companion Hybrid (Photo Editing/Illustration/Drawing) | SCR : Asus ROG Swift PG278Q (1440p/144Hz/G-Sync/3DV 2/Gaming) | SCR : Asus PB287Q (4K Gaming/DAW) | SCR/TV : Philips 55" PUS9109/12 UHD (4K Gaming) | NAS : QNAP TS-419PII /w Lian Li EX-503B Drive Bay | HID : (Keyboard) Corsair K95 RGB Brown Cherry (Mouse) Corsair M95 Performance & Generic Logitech HID Devices | NIC : Asus RT-AC66U (with Asus repeaters| NIC : Jensen Scandinavia 8-port Gigabit switch | SYS : NVIDIA SHIELD Portable | SYS : NVIDIA SHIELD Tablet (16 GB version/non-LTE) | Oculus Rift DK2

Posted 09/27/2014 04:27 AM   
Good deal, thanks for the feedback. Not having ever tried to teach something like this before, I'm not too sure of the right level of detail. I'm erroring on the side of too much, since that is a more conservative approach. Probably will be a bit too basic for some folks. For that sequence of assignments there, since you have looked into this a fair bit, you will probably want to read about swizzling. This explains in great detail about the different components pieces and how they can swap around at will. [url]http://msdn.microsoft.com/en-us/library/windows/desktop/bb219869(v=vs.85).aspx[/url]
Good deal, thanks for the feedback. Not having ever tried to teach something like this before, I'm not too sure of the right level of detail. I'm erroring on the side of too much, since that is a more conservative approach. Probably will be a bit too basic for some folks.

For that sequence of assignments there, since you have looked into this a fair bit, you will probably want to read about swizzling. This explains in great detail about the different components pieces and how they can swap around at will.

http://msdn.microsoft.com/en-us/library/windows/desktop/bb219869(v=vs.85).aspx

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

Posted 09/27/2014 05:03 AM   
Thanks for the assistance guys. It actually feels really good to know I didn't make an obvious mistake, and that it should be working :) Looks okay to me. [code]CreatePixelShader CRC: 0xDE23E6D3 .\ShaderOverride\PixelShaders\DE23E6D3.txt.1 pD3DXAssembleShaderFromFile pixel Shader overrode without errors CRC: 0xDE23E6D3 [/code] [code]CreatePixelShader CRC: 0xB5B3BBDD .\ShaderOverride\PixelShaders\B5B3BBDD.txt.1 pD3DXAssembleShaderFromFile pixel Shader overrode without errors CRC: 0xB5B3BBDD [/code] Here's the log file https://www.dropbox.com/s/q2olb83b6ixhrgm/LOG.txt?dl=0 Here's the contents of dx9settings.ini. I'm trying to improve Eqzitara's fix, so I didn't write this myself. I'm a little confused as to why he created Const1, but doesn't seem to give it a value. [code][General] ProxyLib = E:\Games\Steam\steamapps\common\A Story About My Uncle\Binaries\Win32\sweetfx_d3d9.dll UseEndScene = false UseRenderedShaders=true //DefSquareSurfaceMode = 1 //DefDepthStencilSurfaceMode = 1 //DefSurfaceCreationMode = 1 SkipSetScissorRect = true //DefRtCreationMode = 1 DefPSViewSizeConst = 210 DefVSConst1 = 250 DefPSConst1 = 205 //SurfaceCreationModeList = 0; PresetsKeysList = 2;3; [VS5CF48237] CheckTexCRC = true ValForDefined = 0 ValNotDefined = 1 TexCounterReg = 251 UseDefinedOnly = false DefinedTexturesVS = 568A095C; [KEY2] Key = 115 Presets = 1;2; Type = 1 [PRES1] Const3 = 0x00000000 [PRES2] Const3 = 0x3f800000 [KEY3] Key = 114 Presets = 7;10; Type = 1 [PRES7] Const2 = 0x3f800000 [PRES10] Const2 = 0x00000000 [/code]
Thanks for the assistance guys. It actually feels really good to know I didn't make an obvious mistake, and that it should be working :)

Looks okay to me.

CreatePixelShader CRC: 0xDE23E6D3 

.\ShaderOverride\PixelShaders\DE23E6D3.txt.1

pD3DXAssembleShaderFromFile

pixel Shader overrode without errors CRC: 0xDE23E6D3


CreatePixelShader CRC: 0xB5B3BBDD 

.\ShaderOverride\PixelShaders\B5B3BBDD.txt.1

pD3DXAssembleShaderFromFile

pixel Shader overrode without errors CRC: 0xB5B3BBDD



Here's the log file
https://www.dropbox.com/s/q2olb83b6ixhrgm/LOG.txt?dl=0

Here's the contents of dx9settings.ini. I'm trying to improve Eqzitara's fix, so I didn't write this myself. I'm a little confused as to why he created Const1, but doesn't seem to give it a value.

[General]
ProxyLib = E:\Games\Steam\steamapps\common\A Story About My Uncle\Binaries\Win32\sweetfx_d3d9.dll
UseEndScene = false
UseRenderedShaders=true
//DefSquareSurfaceMode = 1
//DefDepthStencilSurfaceMode = 1
//DefSurfaceCreationMode = 1
SkipSetScissorRect = true
//DefRtCreationMode = 1
DefPSViewSizeConst = 210
DefVSConst1 = 250
DefPSConst1 = 205
//SurfaceCreationModeList = 0;
PresetsKeysList = 2;3;

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

[KEY2]
Key = 115
Presets = 1;2;
Type = 1

[PRES1]
Const3 = 0x00000000

[PRES2]
Const3 = 0x3f800000

[KEY3]
Key = 114
Presets = 7;10;
Type = 1

[PRES7]
Const2 = 0x3f800000

[PRES10]
Const2 = 0x00000000

Posted 09/27/2014 06:10 AM   
DefVSConst1 = 250 c250 is reserved through dx9settings. ---------------------------------- [KEY3] Key = 114 Presets = 7;10; Type = 1 [PRES7] Const2 = 0x3f800000 [PRES10] Const2 = 0x00000000 ------------------- 114 is F3[I think. off top of my head] Const2 is 1 when F3 is pressed once. const2 is 0 when f3 is pressed twice. So c250.y will trigger 1 or 0 Const1 = x const2 = y const3 = z const4 = w This is used to change crosshair this case. Its basically an ON/OFF switch. If 250.Y = 0 Disable code If 250.Y = 1 Enable code. Should find the vertexshader in the shaderoverride that does this.
DefVSConst1 = 250

c250 is reserved through dx9settings.
----------------------------------
[KEY3]
Key = 114
Presets = 7;10;
Type = 1

[PRES7]
Const2 = 0x3f800000

[PRES10]
Const2 = 0x00000000

-------------------

114 is F3[I think. off top of my head]
Const2 is 1 when F3 is pressed once. const2 is 0 when f3 is pressed twice.

So c250.y will trigger 1 or 0
Const1 = x
const2 = y
const3 = z
const4 = w

This is used to change crosshair this case. Its basically an ON/OFF switch.

If 250.Y = 0
Disable code

If 250.Y = 1
Enable code.

Should find the vertexshader in the shaderoverride that does this.

Co-founder/Web host of helixmod.blog.com

Donations for web hosting @ paypal -eqzitara@yahoo.com
or
https://www.patreon.com/user?u=791918

Posted 09/27/2014 06:44 AM   
Thanks eqzitara, but I'm not quite sure I follow. DefVSConst1 = 250 creates c250, but where is Const2 created, and what would it's equivalent to c250 be? Apologies for what's probably a dumb question :)
Thanks eqzitara, but I'm not quite sure I follow.

DefVSConst1 = 250 creates c250, but where is Const2 created, and what would it's equivalent to c250 be?

Apologies for what's probably a dumb question :)

Posted 09/27/2014 07:18 AM   
[KEY3] Key = 114 Presets = 7;10; Type = 1 [PRES7] Const2 = 0x3f800000 [PRES10] Const2 = 0x00000000 c250.y
[KEY3]
Key = 114
Presets = 7;10;
Type = 1

[PRES7]
Const2 = 0x3f800000

[PRES10]
Const2 = 0x00000000


c250.y

Co-founder/Web host of helixmod.blog.com

Donations for web hosting @ paypal -eqzitara@yahoo.com
or
https://www.patreon.com/user?u=791918

Posted 09/27/2014 07:28 AM   
So const2 is c250.y, const3 is c250.z, etc. But const1 is where c250 is created, rather than c250.x? Say you wanted to create a second constant, c200. Would this be correct? DefPSConst1 = 250 DefPSConst1 = 200 If I'm understanding correctly, that would create c250 and c200. But then you want to set the y values for both constants. What would that look like? You couldn't just use Const2 = 0x00000000, because that doesn't distinguish between c250 and c200. On an unrelated note, why did you choose values of 7 and 10 for the key3 presets? I'm guessing reusing 1 and 2 would cause a conflict, but were they selected for a reason, or would 3 and 4 have worked just as well?
So const2 is c250.y, const3 is c250.z, etc. But const1 is where c250 is created, rather than c250.x?

Say you wanted to create a second constant, c200. Would this be correct?

DefPSConst1 = 250
DefPSConst1 = 200

If I'm understanding correctly, that would create c250 and c200.

But then you want to set the y values for both constants. What would that look like? You couldn't just use Const2 = 0x00000000, because that doesn't distinguish between c250 and c200.

On an unrelated note, why did you choose values of 7 and 10 for the key3 presets? I'm guessing reusing 1 and 2 would cause a conflict, but were they selected for a reason, or would 3 and 4 have worked just as well?

Posted 09/27/2014 07:41 AM   
No, it's not that general. You can only define the 8 constants Const1, Const2, Const3, Const4. (Const5, Const6, Const7, Const8). There is a register that has the four components. The register is defined with the DefVSConst1=N, DefPSConst1=N assignments. The register is defined here, but not the actual constants. The name of the parameter is a little misleading. This is why in the ASM code, I recommend putting the comment like: [code]//def c250, Const1, Const2, Const3, Const4[/code] So that it is more clear that that constant is being delivered from what is set in the DX9Settings. In this example, those would come in as: // def c250, undefined, 0 or 1, 0 or 1, undefined. For the 7&10, yes 3&4 would have worked as easily. It's probably copy/paste from a different .ini file, where it was known to work correctly, and it's a little fragile to edit stuff, so a lot of times we are better off to just copy/paste. Edit: To clarify, you can use 8 constants defined by Const1=0xNNNNNN..Const8=0xNNNNN. The first four work with DefVSConst1/DefPSConst1, the second four (5..8) work with DefVSConst2/DefPSConst2. The notation is confusing, so stick with just the first set unless you have problems. The second set from 5..8 only work in more recent versions of the DLL.
No, it's not that general. You can only define the 8 constants Const1, Const2, Const3, Const4. (Const5, Const6, Const7, Const8).

There is a register that has the four components. The register is defined with the DefVSConst1=N, DefPSConst1=N assignments. The register is defined here, but not the actual constants. The name of the parameter is a little misleading.

This is why in the ASM code, I recommend putting the comment like:

//def c250, Const1, Const2, Const3, Const4


So that it is more clear that that constant is being delivered from what is set in the DX9Settings.


In this example, those would come in as:

// def c250, undefined, 0 or 1, 0 or 1, undefined.


For the 7&10, yes 3&4 would have worked as easily. It's probably copy/paste from a different .ini file, where it was known to work correctly, and it's a little fragile to edit stuff, so a lot of times we are better off to just copy/paste.

Edit: To clarify, you can use 8 constants defined by Const1=0xNNNNNN..Const8=0xNNNNN. The first four work with DefVSConst1/DefPSConst1, the second four (5..8) work with DefVSConst2/DefPSConst2. The notation is confusing, so stick with just the first set unless you have problems. The second set from 5..8 only work in more recent versions of the DLL.

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

Posted 09/27/2014 08:00 AM   
Ah, I see. So you can only define a single constant in dx9settings (with it's 4 different values)? So defining c250 and c200 at the same time in dx9settings is impossible? But you could define c250 in dx9settings, then c200 in an individual shader? On the topic of the shaders I was trying to fix, replacing the contents of them with ps_3_0 dcl_texcoord v0 works, but it seems like a bit of a workaround.
Ah, I see. So you can only define a single constant in dx9settings (with it's 4 different values)? So defining c250 and c200 at the same time in dx9settings is impossible? But you could define c250 in dx9settings, then c200 in an individual shader?

On the topic of the shaders I was trying to fix, replacing the contents of them with
ps_3_0
dcl_texcoord v0
works, but it seems like a bit of a workaround.

Posted 09/28/2014 07:08 AM   
  16 / 88    
Scroll To Top