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

DepthTexture: Support texture depth comparison. #25958

Merged
merged 3 commits into from
May 1, 2023

Conversation

RenaudRohlinger
Copy link
Collaborator

@RenaudRohlinger RenaudRohlinger commented Apr 30, 2023

This PR introduces a compareFunction property to the DepthTexture class, enabling depth texture comparison.

This is the first step in order to improve the shadows in a WebGL2 context. This will allow implementing hardware anti-aliasing of shadow maps through depth comparison.

@github-actions
Copy link

github-actions bot commented Apr 30, 2023

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
634.8 kB (157.3 kB) 635.5 kB (157.6 kB) +760 B

🌳 Bundle size after tree-shaking

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

Filesize dev Filesize PR Diff
425.7 kB (103.2 kB) 426.2 kB (103.4 kB) +472 B

@RenaudRohlinger
Copy link
Collaborator Author

Updated the PR consequently, also I'm not sure about how to handle deserialized operations.

@RenaudRohlinger RenaudRohlinger changed the title WebGLTexture: Support texture depth comparison DepthTexture: Support texture depth comparison Apr 30, 2023
@Mugen87
Copy link
Collaborator

Mugen87 commented Apr 30, 2023

You can add the following new line:

 if ( data. compareFunction !== undefined ) texture. compareFunction = data. compareFunction; 

here:

if ( data.unpackAlignment !== undefined ) texture.unpackAlignment = data.unpackAlignment;

@Mugen87 Mugen87 added this to the r153 milestone May 1, 2023
@Mugen87 Mugen87 merged commit 6f45d89 into mrdoob:dev May 1, 2023
@Mugen87 Mugen87 changed the title DepthTexture: Support texture depth comparison DepthTexture: Support texture depth comparison. May 1, 2023
@@ -119,6 +119,13 @@ <h3>[page:Texture.generateMipmaps .generateMipmaps]</h3>
<h3>[property:Boolean isDepthTexture]</h3>
<p>Read-only flag to check if a given object is of type [name].</p>

<h3>[property:String compareFunction]</h3>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a string?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@WestLangley WestLangley May 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an integer, correct?. Also, the default should be specified in the docs.

Edit: It's null or an integer; hence, a number.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't any default value as otherwise it would involve that the compare function is enabled by default.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default is null. And the docs should explain the consequences of a null value.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed via 43c701c.

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.

4 participants