Repository navigation
TextureNode: allow for non-mergeable uniforms - #34450
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
12932a3 to
f3e9e43
Compare
|
I have not bee available to respond to #34393 but I still feel very strongly that user graphs should not be modified against the users intent and that a "mergeable" flag on the node feels like a pretty heavy handed band-aid. If anything the "textureUniform" should behave only as the name implies (a new unique uniform is created always and is not merged) and a separate dedicated node should be designed that supports auto merging and implies the texture won't change - "staticTexture" or something. I'm still not convinced that's needed and that this merge behavior wasn't an early optimization. I will try to respond to issues next week. |
I agree, it's a band-aid. It appears to me that this optimisation more so exists because of TSLs unique design rather than solving a real problem. I'm not sure how much support there would be for changing the system though. There probably already is a bunch of code using repeated
This is why I was hoping we could change the behaviour of If the |
f3e9e43 to
2694293
Compare
2694293 to
cab68ab
Compare
|
Pushed a small fix, which should have no effect on the behaviour but is more correct regardless (passing the |
Related issue: #34393
Description
Right now two texture uniforms always will be merged if they use the same texture at compile-time.
This means that a material might need to be rebuilt whenever a texture uniform changes, since two uniforms that share the same texture suddenly might not.
I think the best solution here is to optionally merge texture uniforms based on a shared reference node instead of a shared texture. This allows for changing texture uniforms without needing a rebuild and enables better program reuse in some cases.
This PR introduces a
mergeableflag onTextureNode(default is true). It also changesuniformTexture()anduniformCubeTexture()to create non-mergeable uniforms. I figured this made sense given the names and thattexture()andcubeTexture()already exist to directly sample textures or create mergeable uniform (the way it works right now).Would love feedback regarding if the change makes sense to begin with, the name of the new property and if
uniformTexture()/uniformCubeTexture()behaviour should be changed or not.This contribution is funded by BitReality