-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add shader textureBias #4088
Add shader textureBias #4088
Conversation
Use
|
Did you mean to update pacakge-lock.json in this PR? |
Yes! but forgot to add to the PR description. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome. Maybe edit the PR title tho.
related to #2856 |
@@ -568,6 +568,9 @@ class WebglGraphicsDevice extends GraphicsDevice { | |||
} | |||
|
|||
this.constantTexSource = this.scope.resolve("source"); | |||
this.textureBias = this.scope.resolve("textureBias"); | |||
|
|||
this.textureBias.setValue(0.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should have a public API for this. Ideally the viewer code you test it on would not do
this.scope.resolve("textureBias").SetValue(...);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This transform feedback example already uses this API. This uniform management is long overdue a redesign.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true, but transform feedback example is accessing this API to set uniforms in its own shader.
But here we're adding new functionality to the engine that the Viewer wants to use .. and that should be different API, allowing us to even rename the variable later if needed. Maybe `Scene.standardMaterialTextureBias' or a shorter version of it? Something we publicly document.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer something like Scene#textureBias
and then potentially add Texture#bias
which would take precedence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be a scene setting... though I would prefer creating and exposing public API in followup PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine by me.
This PR:
textureBias
uniform to control biased texture reads across standard material texturesWEBGL_depth_texture
extension on webgl1 devices (used when creating texture-based render targets)These changes aid with the implementation of a high quality, multi-frame rendering solution.
Questions:
Answers: