Skip to content

Conversation

@takahirox
Copy link
Collaborator

This PR fixes broken cinemaric camera example #13729

@Mugen87

Why DEPTH_PACKING comparison in fragment shader of BokehShader2 is not

#if DEPTH_PACKING == 3201

but

#if DEPTH_PACKING == 1

?

3201 is THREE.RGBADepthPacking.

@Mugen87
Copy link
Collaborator

Mugen87 commented Mar 30, 2018

It is just a true/false flag 😊

I've reused this pattern from other shaders for consistency reasons e.g.

"float getDepth( const in vec2 screenPosition ) {",
" #if DEPTH_PACKING == 1",
" return unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );",
" #else",
" return texture2D( tDepth, screenPosition ).x;",
" #endif",
"}",

this.saoMaterial.defines[ 'DEPTH_PACKING' ] = this.supportsDepthTextureExtension ? 0 : 1;

@Mugen87
Copy link
Collaborator

Mugen87 commented Mar 30, 2018

The depth material of CinematicCamera also needs RGBADepthPacking.

https://github.com/takahirox/three.js/blob/f069efb0d79b7b9adadc30005d7c832543a68db5/examples/js/cameras/CinematicCamera.js#L20

this.material_depth = new THREE.MeshDepthMaterial();
this.material_depth.depthPacking = THREE.RGBADepthPacking;

@takahirox
Copy link
Collaborator Author

Thanks, I've updated.

@mrdoob mrdoob added this to the r92 milestone Mar 30, 2018
@mrdoob mrdoob merged commit 46cf3f9 into mrdoob:dev Mar 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants