The Gaussian effect
- Wicked Sick
- Topic Author
"#define USE_GAUSSIAN 1 // [0 or 1] Gaussian Blur : can be used to... blur, but also bloom/hazy/glowy look, also unsharp masking."
Please Log in or Create an account to join the conversation.
- Ioxa
I took the GAUSS_DX11.fx file from Boulotaur's injector and put it in the same folder as Sweet.fx. I then added a line in the globals section in Sweet.fx to include GAUSS_DX11.fx. I took the settings from the old SweetFX_settings.txt and defined them in GAUSS_DX11.fx. At this point I tried running it and got an error about coefLuma already being defined so I changed its name in GAUSS_DX11.fx.
Now I'm getting this error,
"GAUSS_DX11.fx(46, 1): error X3000: syntax error, unexpected identifier, expecting end of file
compilation failed with 1 errors."
And this is where I'm stuck...
Please Log in or Create an account to join the conversation.
- crosire
Tip: Try to start with GAUSS_DX9.fx instead, ReShade's shading language is a lot more similar to Direct3D9 HLSL (shadermodel 3 that is).Ioxa wrote: I took the GAUSS_DX11.fx file from Boulotaur's injector and put it in the same folder as Sweet.fx.
Then try this:
- Replace "texture2D frameTex2D;" with
texture2D frameTex2D : COLOR;
- Replace "texture2D origframeTex2D;" with
texture2D origframeTex2D { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; ];
- Remove the "<" and ">" from the sampler property lists.
- Replace the FrameVS function with the following:
VSOUT FrameVS(in uint id : VERTEXID) { VSOUT OUT; OUT.UVCoord = float2((id == 2) ? 2.0 : 0.0, (id == 1) ? 2.0 : 0.0); OUT.vertPos = float4(OUT.UVCoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0); return OUT; }
- Add a new function before the technique:
float4 PassThrough(VSOUT IN) : COLOR { return tex2D(frameTex2D, IN.UVCoord); }
- Before "pass P0" add another pass like this:
pass { VertexShader = FrameVS; PixelShader = PassThrough; RenderTarget = origframeTex2D; }
- Remove all "compile vs_3_0" and "compile ps_3_0" references and the brackets in the pass bodies. You can also remove the "AlphaBlendEnable" and "SRGBWriteEnable" states if you want, ReShade's default values match them.
- Don't forget to modify the technique so it is rendered by ReShade:
technique t0 < enabled = true; > { ... }
Should do the job unless I missed something. Or at least it should be a good starting point.
Please Log in or Create an account to join the conversation.
- Wicked Sick
- Topic Author
EDIT:
I am trying but I have noticed something. A pattern. Stuff begins with a { and ends with a } but step 2 is ending with a ]. Is that right?
Please Log in or Create an account to join the conversation.
- Ioxa
So there was a problem with the two arrays at the very top, something about the initial value having to be a literal expression. Again I had no idea what the problem was so I just moved them into the methods they were being used in. From the searches I made it seemed like there was some problem with global static variables so I made them local... I think I'm using the right terminology.
So those don't seem to be causing any issues anymore, but now I'm getting issues with PIXEL_SIZE.x and PIXEL_SIZE.y.
It says they are uninitialized but they were never initialized in the original code so I don't know where it was pulling those from or what I can replace them with.
Please Log in or Create an account to join the conversation.
- TCPIP
Please Log in or Create an account to join the conversation.
- Ioxa
Hmm, maybe it would be easier to just make a new one.TCPIP wrote: Boulotaur had a lot of stuff for Gaussian shader in the dll itself, which is unfortunate for us...
I think I fixed the PIXEL_SIZE problem but of course that led to another error. Or maybe my "fix" caused the error. What I did was replace PIXEL_SIZE with PIXEL_X and PIXEL_Y then defined those as BUFFER_RCP_WIDTH and BUFFER_RCP_HEIGHT. I don't know what those are, I just saw them used in another shader and thought they might work.
But now I'm getting this error...
Shader@0x0C9C18D0(38,16): error X3017: '__tex2D': cannot implicitly convert from 'const Texture2D' to 'struct __sampler2D'
The numbers after Shader@ change each time so I'm guessing it's pointing to a memory location?
Please Log in or Create an account to join the conversation.
- crosire
#define PIXEL_SIZE float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT)
The "tex2D" intrinsic requires a sampler as parameter, no texture: I made a mistake there, you actually have to write "tex2D(frameSampler, IN.UVCoord)" and not "tex2D(frameTex2D, IN.UVCoord)".
The "Shader@XXXXXXXXX" errors are internal compiler errors and normally should not happen. I'm surprised this one appeared, was expecting a different error... But ok.
Please Log in or Create an account to join the conversation.
- kurtferro
Please Log in or Create an account to join the conversation.
- Ioxa
return tex2D(origframeSampler, IN.UVCoord) + tex2D(frameSampler, IN.UVCoord);
that finally got color right.
Thanks for all your help crosire! No way I would have got this working without it!
Where can I upload this so other people can try it if they want?
Please Log in or Create an account to join the conversation.
- crosire
There's a shader presentation section here made for that purposeIoxa wrote: Where can I upload this so other people can try it if they want?
Please Log in or Create an account to join the conversation.