Greeting Folks,
I want to use a planar mesh with a custom shader in order to customize the background of my scene with a gradient. So far I could get that working as I wanted but I’m having trouble combining that with the OutlinePass.
here is some code fragment of my app:
createRenderer ({height, width}) {
const renderer = new THREE.WebGLRenderer({
powerPreference: 'high-performance',
logarithmicDepthBuffer: false,
physicallyCorrectLights: true,
preserveDrawingBuffer: false,
premultipliedAlpha: true,
precision: "highp",
gammaOutput: true,
gammaFactor: 2.2,
antialias: false,
alpha: true
})
renderer.setPixelRatio(window.devicePixelRatio)
renderer.setClearColor(0x4a484e, 1)
renderer.setSize(width, height)
renderer.gammaOutput = true
renderer.gammaInput = true
renderer.autoClear = false
return renderer
}
initializeComposer (width, height) {
const composer = new EffectComposer(
this.renderer)
this.backgroundPass = new RenderPass(
this.background.scene,
this.background.camera)
composer.addPass(this.backgroundPass)
this.renderPass = new RenderPass(
this.scene, this.camera)
composer.addPass(this.renderPass)
this.outlinePass = new OutlinePass(
new THREE.Vector2(width, height),
this.scene, this.camera)
this.outlinePass.enabled = true
this.outlinePass.clear = false
composer.addPass(this.outlinePass)
return composer
}
render () {
this.renderer.clear(true, true, true)
this.composer.render()
}
When disabling the outlinePass it looks as expected, but when adding that pass all I get is a black scene. Is there a way to combine both background & outline or I need to create a custom outline as well? Maybe some tweaking in how buffers are cleared?