You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So far, compileShader returns a tuple with two objects:
const[shader,meta]=compileShader(...)
The shader object contains the typical properties expected by Three.js shader materials and related helpers (vertexShader, fragmentShader, uniforms).
The meta object contains additional properties like update (the per-frame callback).
This structure was chosen so you could easily plug the shader object into your favorite shader material helper in Three.js or R3F, without having to explicitly destructure it yourself.
But now that Shader Composer is no longer tightly coupled to Three.js, we have an opportunity to simplify the structure of the return value into a single object containing all properties:
constshader=compileShader(...)
Would this be a good idea? Who knows!
✅ It would make the API less confusing
⛔ Using SC in Three.js would be slightly more work for the user
On the other hand, the newly introduced @shader-composer/three package could provide a helper function that forms the returned object into something that can be spread into the relevant helpers like we're used to
⛔ We currently don't know what using Shader Composer in other frameworks (eg. PlayCanvas) will look like, so it might be too early to make this change
The text was updated successfully, but these errors were encountered:
So far,
compileShader
returns a tuple with two objects:The
shader
object contains the typical properties expected by Three.js shader materials and related helpers (vertexShader
,fragmentShader
,uniforms
).The
meta
object contains additional properties likeupdate
(the per-frame callback).This structure was chosen so you could easily plug the
shader
object into your favorite shader material helper in Three.js or R3F, without having to explicitly destructure it yourself.But now that Shader Composer is no longer tightly coupled to Three.js, we have an opportunity to simplify the structure of the return value into a single object containing all properties:
Would this be a good idea? Who knows!
@shader-composer/three
package could provide a helper function that forms the returned object into something that can be spread into the relevant helpers like we're used toThe text was updated successfully, but these errors were encountered: