-
-
Notifications
You must be signed in to change notification settings - Fork 36k
TSL: Introduce uniformTexture()
and uniformCubeTexture()
#31190
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
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
@sunag it's very cool ! I didnt understand the use of onObjectUpdate but it's so powerful! Just a quick question , when we do this approach, it create different version of the material or it re-assign the uniform between both drawcall? Also is it internally optimized so if I render material1 textureA / material1 textureB one after the other it only change the uniform ? Thanks ! |
The approach you saw above only updates the uniform according to the object/material that will be rendered, it does not create different versions of the material. |
So just to confirm if i have
instead of
note in above example lets say each mesh have a different map for example. |
The first option, with order, in order to optimize commands for gpu. |
Related issue: #30849, Closes #31173
Description
The introduction of
uniformTexture()
should help more experienced developers migrate their shaders to TSL, since it more closely resembles the GLSL style.Now the
texture()
function can also sampleuniformTexture()
as in the example below.Another example creating a helper function to get the material map as uniform.
/cc @Makio64