금속으로 셰이더 수정자를 사용하려고합니다. 나는 지금까지 내 조각 수정은 ... 유니폼을 선언하는 알아낼 수 없습니다 :SCN 셰이더 수정 자 (셰이더에 대해 균일 한 패스)
는// color changes
#pragma arguments
float4x4 u_color_transformation;
#pragma body
_output.color.rgb = vec3(1.0) - (u_color_transformation * _output.color).rgb;
이없이 로그와 함께, 보라색 텍스처를 출력 .. 난 그냥 _output.color.rgb = (u_color_transformation * _output.color).rgb
이있는 경우, 상황이 확인된다. 나는 doc을 따르고 있다고 생각하지만 어쩌면 그렇지 않을 수도 있습니다!
유니폼이 설정됩니다 :이 모든 OpenGL을 함께 잘 작동했다
material.shaderModifiers =
[ SCNShaderModifierEntryPoint.fragment: theShaderAbove ]
material.setValue(NSValue(mat4: GLKMatrix4Identity), forKey: "u_color_transformation")
업데이트 :
은 분명히, SceneKit 쉐이더 수정이 GLSL 코드를 사용하고로 변환 돌봐 금속. 그래서 난에 쉐이더를 변경 : 출력은 u_color_transformation
가 셰이더에 전달되지 않는다는 것을 제안, (적어도이 컴파일 된 것을 건의) 지금은 흰색이며, 쉐이더에서 널 행렬에 해결
// color changes
#pragma arguments
uniform mat4 u_color_transformation;
#pragma body
_output.color.rgb = vec3(1.0) - (u_color_transformation * _output.color).rgb;
하는 검은 색을 한 번 거꾸로하면 흰색을.니다.