Skip to content

Commit

Permalink
set shadow depth material side to double
Browse files Browse the repository at this point in the history
  • Loading branch information
swift502 committed Nov 19, 2024
1 parent dd354f6 commit 3de335a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/model-viewer/src/three-components/Shadow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {BackSide, Box3, Material, Mesh, MeshBasicMaterial, MeshDepthMaterial, Object3D, OrthographicCamera, PlaneGeometry, RenderTargetOptions, RGBAFormat, Scene, ShaderMaterial, Vector3, WebGLRenderer, WebGLRenderTarget} from 'three';
import {BackSide, DoubleSide, Box3, Material, Mesh, MeshBasicMaterial, MeshDepthMaterial, Object3D, OrthographicCamera, PlaneGeometry, RenderTargetOptions, RGBAFormat, Scene, ShaderMaterial, Vector3, WebGLRenderer, WebGLRenderTarget} from 'three';
import {HorizontalBlurShader} from 'three/examples/jsm/shaders/HorizontalBlurShader.js';
import {VerticalBlurShader} from 'three/examples/jsm/shaders/VerticalBlurShader.js';
import {lerp} from 'three/src/math/MathUtils.js';
Expand Down Expand Up @@ -107,6 +107,9 @@ export class Shadow extends Object3D {
'gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );',
'gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * opacity );');
};
// Render both sides, back sides face the light source and
// front sides supply depth information for soft shadows
this.depthMaterial.side = DoubleSide;

this.horizontalBlurMaterial.depthTest = false;
this.verticalBlurMaterial.depthTest = false;
Expand Down

0 comments on commit 3de335a

Please sign in to comment.