PinBall Arcade, having Trouble with Light Effect shader?

Post Reply
User avatar
The_Nephilim
Diamond Eyed Freakazoid!
Posts: 764
Joined: Sat Dec 22, 2007 3:38 am
Location: 3rd Stone from the Sun

PinBall Arcade, having Trouble with Light Effect shader?

Post by The_Nephilim »

Hey all you shader hackers,

I am trying to fix Pinball Arcade and came across a shader I don't quite understand as how to fix it. I found a post by DarkStarSword who explained it but I don't quite get it and what he is talking about kind eludes me a bit..

Here is the post where he talked about how to fix this effect. I will upload the VS and PS here as well.


https://www.nvidia.com/en-us/geforce/fo ... 9/#4715553


Now in the VS 66f049509221fc it looks similat to what he said in his post. Now here is what I did to that shader.

Code: Select all

  // Lights inside Pinball machine Need Fix..
// ---- Created with 3Dmigoto v1.3.16.58 on Sat Jul 09 19:24:57 2022

cbuffer ModelViewProjectionConstantBuffer : register(b0)
{
  float4x4 model : packoffset(c0);
  float4x4 view : packoffset(c4);
  float4x4 projection : packoffset(c8);
  float4x4 mvp : packoffset(c12);
  float4 color_modulation : packoffset(c16);
  float4 uv_tfm : packoffset(c17);
}



// 3Dmigoto declarations
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);


void main(
  float3 v0 : POSITION0,
  float2 v1 : TEXCOORD0,
  out float4 o0 : SV_POSITION0,
  out float2 o1 : TEXCOORD0,
  out float4 o2 : COLOR0)
{
  float4 r0;
  uint4 bitmask, uiDest;
  float4 fDest;

  
 
  
  
  r0.xyz = v0.xyz;
  r0.w = 1;
//  o0.x = dot(r0.xyzw, mvp._m00_m10_m20_m30);
//  o0.y = dot(r0.xyzw, mvp._m01_m11_m21_m31);
 // o0.z = dot(r0.xyzw, mvp._m02_m12_m22_m32);
 // o0.w = dot(r0.xyzw, mvp._m03_m13_m23_m33);
 
 
 
 
 



  

o0.x = dot(r0.xyzw, world_view_proj._m00_m10_m20_m30);
o0.y = dot(r0.xyzw, world_view_proj ._m01_m11_m21_m31);
o1.z = dot(r0.xyzw, world_view_proj._m02_m12_m22_m32);
o1.w = dot(r0.xyzw, world_view_proj._m03_m13_m23_m33);
  
  
  
  
  o1.xy = uv_tfm.xy + v1.xy;
  o2.xyzw = color_modulation.xyzw;  
  

//float4 stereo = StereoParams.Load(0);
//r0.x += stereo.x * (r0.w - stereo.y);
o0.xyzw = r0.xyzw;  
  
  return;
}

Now I understand it might be a variable of the above I would just like to know does it look like I am on the correct path and maybe it just needs a variation on the variables there..

I think I understand the VS Part better then the PS pars DSS was talking about. he said to go intop the PS and try these variables:

Code: Select all

 // We need to apply the correction in the *middle* of this instruction before
// adding the camera position, so split it into two separate instructions:
// r1.xyz = r1.yzw * r1.xxx + camera_pos.xyz;
r1.xyz = r1.yzw * r1.xxx;
 
// We have a coordinate in world-space relative to the camera. We convert this
// into projection-space, apply the correction, then convert it back (there are
// some alternative variations that may work as well, such as only converting
// to view-space instead of projection-space and using the view-space formula, or
// since we already have the linear depth just convert float4(separation * (depth
// - convergence), 0, 0, 1) to world-space and subtract that from r1 (which may
// help if you find this produces flickering, or just slightly inaccurate shadows).
 
float4 stereo = StereoParams.Load(0);
float4 tmp;
 
tmp = mul(camera_view, float4(r1.xyz, 1)); // If 1 doesn't work, try 0
tmp = mul(camera_projection, tmp);
tmp = tmp / tmp.w; // May or may not be necessary
 
tmp.x -= stereo.x * (tmp.z - stereo.y);
 
tmp = mul(camera_inv_projection, tmp);
tmp = mul(camera_inv_view, tmp);
r1.xyz = tmp.xyz / tmp.w; // May or may not be necessary
 
 
// This is the final part of the original instruction we split up:
r1.xyz = r1.xyz + camera_pos.xyz;

What I don't quite understand here is what to do in the PS fully.. This in particular float4 stereo = StereoParams.Load(0);
float4 tmp; is where it says Temp; is there supposed to be a variable there or is it as it should be written. I hope that made sense.. I had tried numerous things and while nothing changed in the stereo effect I guess I am just missing a simple understanding of what DSS is saying here..

Here are the 2 shaders complete with my added code and I really don't know If I am supposed to add anything in the PS for sure or not..


EDIT: I tried a few variations in the VS but I keep getting an undeclared identifier error 30004!! Do I need to make a stereo correction in the VS as well as adding the line DSS said too in the PS. still not sure if anything needs to be added in the PS.. will keep reading that and toying with the Shaders.


66f04950922aa944-vs_replace.txt
a3b125121fc5d040-ps_replace.txt

e6a74639f12eb789-ps.jps.jpg
You do not have the required permissions to view the files attached to this post.
Intel i7 10700K @ 5.1 GHZ / ASRock Phantom 4 AC/4 Z590 Motherboard / G. SKILL Trident Z 64GB - 4000mhz / eVGA 2080Ti 11gb / SoundBlaster Z / HP Reverb G2 / HOTAS Cougar / Thrustmaster MFD's / Buttkicker Gamer 2 / :shutter
User avatar
The_Nephilim
Diamond Eyed Freakazoid!
Posts: 764
Joined: Sat Dec 22, 2007 3:38 am
Location: 3rd Stone from the Sun

Re: PinBall Arcade, having Trouble with Light Effect shader?

Post by The_Nephilim »

Hey Guys,

I had figured out what I did and got it working in VR again.. that was a wierd one as I had to put in half the fix for DGVooDoo to get it too work in VR..
Intel i7 10700K @ 5.1 GHZ / ASRock Phantom 4 AC/4 Z590 Motherboard / G. SKILL Trident Z 64GB - 4000mhz / eVGA 2080Ti 11gb / SoundBlaster Z / HP Reverb G2 / HOTAS Cougar / Thrustmaster MFD's / Buttkicker Gamer 2 / :shutter
Post Reply

Return to “Nvidia 3D Vision Fixes, Solutions and Troubleshooting”