Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple scenes rendering using THREE.Renderpass

I have the following problem: Trying to render multiple scenes for postprocessing using RenderPass.

There are 2 scenes now:

1) terrain + clouds

2) text layer

Both scenes are rendering but the text layer gets blended into the terrain (normally if they would be rendered in the same scene it should act like this). What is strange: I can see the text through the clouds which are rendered much higher than the terrain (both terrain and clouds are in the same scene for testing)You cann see the text above the clouds but it blends to the terrain

You cann see the text above the clouds but it blends to the terrain

To render it i'm using the following code:

    @renderPass = new THREE.RenderPass( @scene, @camera )
    @renderPass.renderToScreen = true
    @renderPass.clear = false
    @renderPass.clearDepth = true

    @textPass = new THREE.RenderPass( @textScene, @camera )
    @textPass.renderToScreen = true
    @textPass.clear = false
    @textPass.clearDepth = true

@composer = new THREE.EffectComposer( @renderer );

        @composer.addPass( @renderPass )
        @composer.addPass( @textPass )

But when Im trying to render them normally using:

    @renderer.clear()
    @renderer.render @scene, @camera
    @renderer.clearDepth();
    @renderer.render @textScene, @camera

everything works as expected. enter image description here

like image 785
mjanisz1 Avatar asked Aug 31 '25 22:08

mjanisz1


1 Answers

RenderPass doesn't actually have a clearDepth option. I opened a pull request to add support for this, which should fix your problem:

https://github.com/mrdoob/three.js/pull/10159

Update: The pull request was merged and included in the r83 release, so your code as written should now work.

like image 53
ford Avatar answered Sep 03 '25 20:09

ford