I use ARKIT to load a plane, and the plane modifies the SCNShaderModifierEntryPointFragment to display the decoded video. However, the rendered video image is too light and lighter than the video rendered using metalLayer. Why is this happening? I also tried to modify SCNShaderModifierEntryPointSurface, set the _surface.diffuse. And I also try use rgb instead of yuv. But still the same.
This should also not because of the light. I try use diffuse.content = image, and it's right.
I have tried rendering MTLTexture using SCNProgram, shaderModifiers. Render YUV or RGB results, the color is lighter
texture2d textureY;
texture2d textureUV;
float3x3 coversionMatrix;
float3 yuv;
yuv.x = textureY.sample(textureSampler, _surface.diffuseTexcoord).r;
yuv.yz = textureUV.sample(textureSampler, _surface.diffuseTexcoord).rg;
float3 rgb = coversionMatrix * (yuv - offset);
_output.color = float4(rgb, 1.0);
//set the shaderModifiers
myMaterial.shaderModifiers = @{ SCNShaderModifierEntryPointFragment : shader};