-
Notifications
You must be signed in to change notification settings - Fork 211
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
shadertools: PBR module using UBO #2173
Conversation
@@ -111,6 +111,7 @@ const lightSources: LightingProps = { | |||
type: 'ambient' | |||
}, | |||
directionalLights: [ | |||
// @ts-expect-error Remove once npm package updated with new types |
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.
Having to do this is really annoying. Not quite sure when / why it started to happen. We should restore @donmccurdy 's workspaces setup on master or find another way to fix this.
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.
Another tour de force, really appreciated!
modules/shadertools/src/modules/lighting/pbr-material/pbr-material.ts
Outdated
Show resolved
Hide resolved
USE_IBL: 0, | ||
PBR_DEBUG: 0 | ||
LIGHTING_FRAGMENT: 1 | ||
// TODO defining these as 0 breaks shader |
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.
Interesting. Some thoughts:
-We may want to separate in the API between flags (for code enablement, which are either defined or not) and constants (which would inject actual values).
- WGSL has built-in support for constants (that does not require recompiling the shader!), but not defines. However shadertools has added a simple #ifdef preprocessor system.
So, props.defines
could just be an array or a Set, or a Record<string, boolean>. and props.constants
a map of numeric values
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.
Interesting idea. #ifdef NAME
is generally a bit frustrating as setting it to 0
evaluates to true in the preprocessor. Some thoughts:
- Restricting them to boolean values makes the name
props.defines
sound weird, perhapsprops.flags
? - Could our preprocessor instead use a custom syntax? E.g.
// if FLAG(FLAG_NAME) ... // else ... // endif
- We do things like
#define SHADER_NAME simple-mesh-layer-vs
, it is weird to restrict defines from the outside to be boolean, and then sometimes use strings
This reverts commit 0cfb490.
For visgl/deck.gl#8997
Tested using
hello-gltf
app - all examples working. Not tried in deck.gl yetBackground
Change List
lighting
module