Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGLUniforms: Add sampler2DShadow support. #27252

Merged
merged 4 commits into from
Nov 30, 2023

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.

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
12 checks passed
@Mugen87 Mugen87 changed the title WebGLUniforms: 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 <info@mrdoob.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants