[HELP] Shader with multiple SamplerColor
- matsilagi
- Topic Author
The texture in its original form (Unity) uses 2 color buffers, but each one renders its stuff (one of them is dedicated of rendering a pass only, without mixing its color changes on the main texture, and the other one is the main).
It has something like this:
float tn = tex2D(_TapeTex, pn).x
float tn = tex2D(_MainTex, pn).x //Unity
float tn = tex2D(SamplerColor, pn).x //ReShade
How can i replicate the second SamplerColor (_TapeTex) in ReShade? Doing it like the original code just changing the names didn't work, it gave a broken result just like in Unity if i did it that way.
Please Log in or Create an account to join the conversation.
- crosire
texture _MainTexture ...;
sampler _MainTex { Texture = _MainTexture; }
texture _TapeTexture ...;
sampler _TapeTex { Texture = _TapeTexture; }
...
tex2D(_MainTex, pn);
tex2D(_TapeTex, pn);
Please Log in or Create an account to join the conversation.
Ok, so, here's the Unity shader working correctly (Using _TapeTex and _MainTex):
Here's the Unity shader if i choose to use _MainTex only:
Which is the same result i get on ReShade, no matter what:
I don't know how to say this, but the _TapeTex sampler in Unity is the entire Tape pass, plus it renders those color changes (sepia + distortion and tape noise) only on that sampler instead of mixing into the main Color one, i need a way to replicate this in ReShade (2 color samplers but each with its own changes i guess).
Here's the code i use in ReShade for them:
texture2D texColor : COLOR;
texture2D _TapeTex : COLOR;
sampler2D _TapeColor
{
Texture = _TapeTex;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = LINEAR;
AddressU = Clamp;
AddressV = Clamp;
};
sampler2D SamplerColor
{
Texture = texColor;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = LINEAR;
AddressU = Clamp;
AddressV = Clamp;
};
OK, i fixed part of it, the noise now appears, but it still needs to be joined to the other part of the code and still needs to be fixed.
Please Log in or Create an account to join the conversation.
- crosire
You have not explained what data _TapeTex is supposed to hold. Is it a rendertarget? Is it some image file? Since you mentioned a "Tape pass" I'm guessing it's the former? And _MainTex is probably the backbuffer content (= frame image)? Or is that some rendertarget buffer too?
texture BackBuffer : COLOR;
texture TapeBuffer { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; };
sampler _MainTex { Texture = BackBuffer ; }
sampler _TapeTex { Texture = TapeBuffer; }
...
float4 PS_Tape(...) : COLOR
{
...
}
float4 PS_SomePass(...) : COLOR
{
tex2D(TapeBuffer, ...);
...
}
...
technique MyEffect
{
pass TapePass
{
VertexShader = ...;
PixelShader = PS_Tape;
RenderTarget = TapeBuffer;
}
pass SomePass
{
VertexShader = ...;
PixelShader = PS_SomePass;
}
}
Or do you want multi-target rendering?
texture MainBuffer { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; };
texture TapeBuffer { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; };
sampler _MainTex { Texture = MainBuffer; }
sampler _TapeTex { Texture = TapeBuffer; }
...
void PS_Tape(..., out float4 colorMainOut : COLOR0, out float4 colorTapeOut : COLOR1)
{
colorMainOut = ...;
colorTapeOut = ...;
}
...
technique MyEffect
{
pass TapePass
{
VertexShader = ...;
PixelShader = PS_Tape;
RenderTarget0 = MainBuffer;
RenderTarget1 = TapeBuffer;
}
...
}
Please Log in or Create an account to join the conversation.
crosire wrote: "COLOR" is a semantic and a feature of ReShade FX which in this context allows you to mark a texture to recieve the backbuffer content. It has nothing to do with COLOR in Unity (you cannot put semantics on textures in Unity).
You have not explained what data _TapeTex is supposed to hold. Is it a rendertarget? Is it some image file? Since you mentioned a "Tape pass" I'm guessing it's the former? And _MainTex is probably the backbuffer content (= frame image)? Or is that some rendertarget buffer too?
texture BackBuffer : COLOR; texture TapeBuffer { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; }; sampler _MainTex { Texture = BackBuffer ; } sampler _TapeTex { Texture = TapeBuffer; } ... float4 PS_Tape(...) : COLOR { ... } float4 PS_SomePass(...) : COLOR { tex2D(TapeBuffer, ...); ... } ... technique MyEffect { pass TapePass { VertexShader = ...; PixelShader = PS_Tape; RenderTarget = TapeBuffer; } pass SomePass { VertexShader = ...; PixelShader = PS_SomePass; } }
Or do you want multi-target rendering?
texture MainBuffer { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; }; texture TapeBuffer { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; }; sampler _MainTex { Texture = MainBuffer; } sampler _TapeTex { Texture = TapeBuffer; } ... void PS_Tape(..., out float4 colorMainOut : COLOR0, out float4 colorTapeOut : COLOR1) { colorMainOut = ...; colorTapeOut = ...; } ... technique MyEffect { pass TapePass { VertexShader = ...; PixelShader = PS_Tape; RenderTarget0 = MainBuffer; RenderTarget1 = TapeBuffer; } ... }
Sorry for the late reply! Don't get mad but, i fixed it myself :v
Unity engine stores its data in a confusing way, apparently, _TapeTex was a RT that held the resolution of the screen and drew the noise and returned just the noise, the color part was beign manipulated in Pass 1, but applied to the _TapeTex RT. (I hope i didn't get confusing again)
Here's a screenshot:
Sorry for disturbing!
Please Log in or Create an account to join the conversation.
- crosire
Please Log in or Create an account to join the conversation.