Skip to content

Conversation

@RenaudRohlinger
Copy link
Collaborator

@RenaudRohlinger RenaudRohlinger commented Nov 27, 2023

Init sampler2DShadow if the texture is not set yet by the user to WebGLUniforms.

Basically if in your shader you're using a sampler2DShadow and you didn't bind the correct texture format yet, WebGL will not be happy and crash as it will fallback to a basic texture.

Requires compareFunc parameter in DepthTexture constructor #27251 (otherwise we need needsUpdate=true which is probably something we don't want to add in WebGLUniforms.

All these elements are necessary for a better implementation of shadows that I want to introduce in the future that use sampler2DShadow instead of sampler2D.

@github-actions
Copy link

github-actions bot commented Nov 27, 2023

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
668.7 kB (166 kB) 668.8 kB (166 kB) +123 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
449.8 kB (108.9 kB) 449.9 kB (109 kB) +123 B

@Mugen87 Mugen87 merged commit 7cda1bf into mrdoob:dev Nov 30, 2023
@Mugen87 Mugen87 changed the title WebGLUniforms: sampler2DShadow support WebGLUniforms: Add sampler2DShadow support. Nov 30, 2023
AdaRoseCannon pushed a commit to AdaRoseCannon/three.js that referenced this pull request Jan 15, 2024
* add support for sampler2DShadow in uniforms

* Update WebGLUniforms.js

* use gl.SAMPLER_2D_SHADOW instead

* Update WebGLUniforms.js

---------

Co-authored-by: mrdoob <[email protected]>
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