2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-16 04:57:01 +00:00

Metal fixes

This commit is contained in:
Jack Andersen
2019-03-03 18:45:22 -10:00
parent 54f0724de5
commit ed4ebf0af1
8 changed files with 27 additions and 32 deletions

View File

@@ -247,8 +247,11 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
texture2d<float> noiseTex [[ texture(1) ]])
{
float4 noiseTexel = noiseTex.read(Lookup8BPP(vtf.noiseUv, vtf.randOff));
float2 indCoord = (vtf.indMtx * float3(noiseTexel.r - 0.5, noiseTexel.a - 0.5, 1.0)).xy;
float indScene = dot(sceneTex.sample(samp, vtf.sceneUv + indCoord), kRGBToYPrime) + 16.0 / 255.0;
float2 indCoord = (float3x3(vtf.indMtx0, vtf.indMtx1, vtf.indMtx2) * float3(noiseTexel.r - 0.5, noiseTexel.a - 0.5, 1.0)).xy;
float2 sceneUv = vtf.sceneUv + indCoord;
sceneUv.y = 1.0 - sceneUv.y;
float indScene = dot(sceneTex.sample(samp, sceneUv), kRGBToYPrime) + 16.0 / 255.0;
float4 colorOut = vtf.colorReg0 * indScene + vtf.colorReg2 - vtf.colorReg1 * noiseTexel.r;
colorOut.a = vtf.colorReg1.a + vtf.colorReg1.a * noiseTexel.r + vtf.colorReg2.a;
return colorOut;
}