Thanks Evan. Just wondering is there a way to access the sky segmentation mask so I can force it to be either white or black? I saw you comment on this post, however I’m unsure how to get the texture and manipulate it from the processCpuResult.
For context this is how I’m currently trying to access it, but I just get a black screen after passing it in as a uniform to my shader.
Code to get texture:
const onUpdate = ({ processCpuResult }) => {
const lc = processCpuResult?.layerscontroller
console.log(lc)
skyLayer = lc?.layers?.sky || null
}
Code to pass it to Fragment Shader:
gMaskShader.uniforms.tMask.value = skyLayer.texture
I have also tried:
const SKY_TEX_UNIT = 3
const fsMesh = gMaskShader._fsQuad._mesh
if (fsMesh) {
fsMesh.onBeforeRender = (renderer) => {
if (!skyLayer?.texture) return
const gl = renderer.getContext()
const programMap = renderer.properties
.get(gMaskShader.material)
.programs.values()
const program = programMap.next().value.program
if (!program) return
const loc = gl.getUniformLocation(program, 'tMask')
gl.useProgram(program)
gl.activeTexture(gl.TEXTURE0 + SKY_TEX_UNIT)
gl.bindTexture(gl.TEXTURE_2D, skyLayer.texture)
gl.uniform1i(loc, SKY_TEX_UNIT)
}
}