2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 12:24:56 +00:00

DCLN OBB transform fix

This commit is contained in:
Jack Andersen
2019-03-07 18:16:42 -10:00
parent 4b042f6f9a
commit f40bf707f6
13 changed files with 45 additions and 40 deletions

View File

@@ -372,7 +372,7 @@ TBINDING1 uniform sampler2D sceneMap;
TBINDING2 uniform sampler2D tindMap;
void main()
{
vec2 tindTexel = texture(tindMap, vtf.uvTind).zw;
vec2 tindTexel = texture(tindMap, vtf.uvTind).ab;
vec4 sceneTexel = texture(sceneMap, mix(vtf.uvScene.xy, vtf.uvScene.zw, tindTexel));
vec4 texrTexel = texture(texrMap, vtf.uvTexr);
colorOut = vtf.color * vec4(sceneTexel.rgb, 1.0) + texrTexel;
@@ -430,7 +430,7 @@ struct VertToFrag
float4 main(in VertToFrag vtf) : SV_Target0
{
float2 tindTexel = tex2.Sample(samp, vtf.uvTind).zw;
float2 tindTexel = tex2.Sample(samp, vtf.uvTind).ab;
float4 sceneTexel = tex1.Sample(samp, lerp(vtf.uvScene.xy, vtf.uvScene.zw, tindTexel));
float4 texrTexel = tex0.Sample(samp, vtf.uvTexr);
float4 colorOut = vtf.color * float4(sceneTexel.rgb, 1.0) + texrTexel;
@@ -492,7 +492,7 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
texture2d<float> tex1 [[ texture(1) ]],
texture2d<float> tex2 [[ texture(2) ]])
{
float2 tindTexel = tex2.sample(samp, vtf.uvTind).ba;
float2 tindTexel = tex2.sample(samp, vtf.uvTind).ab;
float4 sceneTexel = tex1.sample(samp, mix(vtf.uvScene.xy, vtf.uvScene.zw, tindTexel));
float4 texrTexel = tex0.sample(samp, vtf.uvTexr);
float4 colorOut = vtf.color * float4(sceneTexel.rgb, 1.0) + texrTexel;
@@ -542,7 +542,7 @@ TBINDING1 uniform sampler2D sceneMap;
TBINDING2 uniform sampler2D tindMap;
void main()
{
vec2 tindTexel = texture(tindMap, vtf.uvTind).zw;
vec2 tindTexel = texture(tindMap, vtf.uvTind).ab;
vec4 sceneTexel = texture(sceneMap, mix(vtf.uvScene.xy, vtf.uvScene.zw, tindTexel));
colorOut = vtf.color * vec4(sceneTexel.rgb, 1.0) * texture(texrMap, vtf.uvTexr);
}
@@ -563,7 +563,7 @@ struct VertToFrag
float4 main(in VertToFrag vtf) : SV_Target0
{
float2 tindTexel = tex2.Sample(samp, vtf.uvTind).ba;
float2 tindTexel = tex2.Sample(samp, vtf.uvTind).ab;
float4 sceneTexel = tex1.Sample(samp, lerp(vtf.uvScene.xy, vtf.uvScene.zw, tindTexel));
return vtf.color * float4(sceneTexel.rgb, 1.0) * tex0.Sample(samp, vtf.uvTexr);
}
@@ -584,7 +584,7 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
texture2d<float> tex1 [[ texture(1) ]],
texture2d<float> tex2 [[ texture(2) ]])
{
float2 tindTexel = tex2.sample(samp, vtf.uvTind).ba;
float2 tindTexel = tex2.sample(samp, vtf.uvTind).ab;
float4 sceneTexel = tex1.sample(samp, mix(vtf.uvScene.xy, vtf.uvScene.zw, tindTexel));
return vtf.color * float4(sceneTexel.rgb, 1.0) * tex0.sample(samp, vtf.uvTexr);
}

View File

@@ -60,7 +60,7 @@ TBINDING2 uniform sampler2D maskTex;
TBINDING3 uniform sampler2D maskTexBlur;
void main()
{
vec2 indUv = (texture(indTex, vtf.indUv).ra - vec2(0.5, 0.5)) *
vec2 indUv = (texture(indTex, vtf.indUv).ab - vec2(0.5, 0.5)) *
vtf.indScaleOff.xy + vtf.indScaleOff.zw;
float maskBlurAlpha = clamp(0.0, (texture(maskTexBlur, vtf.maskUv).a - texture(maskTex, vtf.maskUv).a) * 2.0, 1.0);
colorOut = vtf.color * texture(screenTex, indUv + vtf.screenUv) * maskBlurAlpha;
@@ -123,7 +123,7 @@ Texture2D maskTex : register(t2);
Texture2D maskTexBlur : register(t3);
float4 main(in VertToFrag vtf) : SV_Target0
{
float2 indUv = (indTex.Sample(samp, vtf.indUv).ra - float2(0.5, 0.5)) *
float2 indUv = (indTex.Sample(samp, vtf.indUv).ab - float2(0.5, 0.5)) *
vtf.indScaleOff.xy + vtf.indScaleOff.zw;
float maskBlurAlpha = saturate((maskTexBlur.Sample(samp, vtf.maskUv).a - maskTex.Sample(samp, vtf.maskUv).a) * 2.0);
return float4((vtf.color * screenTex.Sample(samp, indUv + vtf.screenUv) * maskBlurAlpha).rgb, vtf.color.a);
@@ -186,7 +186,7 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
texture2d<float> maskTex [[ texture(2) ]],
texture2d<float> maskTexBlur [[ texture(3) ]])
{
float2 indUv = (indTex.sample(samp, vtf.indUv).ra - float2(0.5, 0.5)) *
float2 indUv = (indTex.sample(samp, vtf.indUv).ab - float2(0.5, 0.5)) *
vtf.indScaleOff.xy + vtf.indScaleOff.zw;
float maskBlurAlpha = saturate((maskTexBlur.sample(samp, vtf.maskUv).a - maskTex.sample(samp, vtf.maskUv).a) * 2.0);
return float4((vtf.color * screenTex.sample(samp, indUv + vtf.screenUv) * maskBlurAlpha).rgb, vtf.color.a);

View File

@@ -49,7 +49,7 @@ TBINDING0 uniform sampler2D sceneTex;
TBINDING1 uniform sampler2D indTex;
void main()
{
vec2 indUv = texture(indTex, vtf.indUv).xy * vec2(2.0) - vec2(1.0 - 1.0 / 256.0);
vec2 indUv = texture(indTex, vtf.indUv).ab * vec2(2.0) - vec2(1.0 - 1.0 / 256.0);
colorOut = vec4(texture(sceneTex, vtf.sceneUv + indUv * vtf.strength.xy).rgb, 1.0);
}
@@ -100,7 +100,7 @@ struct VertToFrag
float4 main(in VertToFrag vtf) : SV_Target0
{
float2 indUv = indTex.Sample(samp, vtf.indUv).xy * float2(2.0, 2.0) - float2(1.0 - 1.0 / 256.0, 1.0 - 1.0 / 256.0);
float2 indUv = indTex.Sample(samp, vtf.indUv).ab * float2(2.0, 2.0) - float2(1.0 - 1.0 / 256.0, 1.0 - 1.0 / 256.0);
return float4(sceneTex.Sample(samp, vtf.sceneUv + indUv * vtf.strength.xy).rgb, 1.0);
}
@@ -151,6 +151,6 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
texture2d<float> sceneTex [[ texture(0) ]],
texture2d<float> indTex [[ texture(1) ]])
{
float2 indUv = indTex.sample(samp, vtf.indUv).xy * float2(2.0) - float2(1.0 - 1.0 / 256.0);
float2 indUv = indTex.sample(samp, vtf.indUv).ab * float2(2.0) - float2(1.0 - 1.0 / 256.0);
return float4(sceneTex.sample(samp, vtf.sceneUv + indUv * vtf.strength.xy).rgb, 1.0);
}