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
It would be great if there was some way to have a ShaderMaterial as a child element of the mesh,
and there was an easy way to pass new values to the uniforms.
The text was updated successfully, but these errors were encountered:
oveddan
changed the title
React-Three version of THREE.ShaderMaterial
Component for THREE.ShaderMaterial
Jan 8, 2016
The problem here is that things like ShaderMaterial and Geometry are not instances of Object3D and the underlying scene graph is built using Object3D nodes. I mean it's certainly possible but would require a lot of work and/or hackery. Especially problematic is that the behavior is undefined when people do odd things like have multiple Geometry child or other strange things.
I usually recommend doing something like you've shown above - write a component to do all the nasty work and then use that component everywhere. #34 lists a few other components I wanted to write that would be similar.
Also you might want to look at react-three-renderer which takes a different approach and betters supports embedding geometry/material as React components.
Per the example using shaders:
https://github.com/oveddan/react-three/blob/three-shader-example/examples/shader/shader.jsx#L22
It would be great if there was a react component for a
THREE.ShaderMaterial
Currently this is done like:
It would be great if there was some way to have a ShaderMaterial as a child element of the mesh,
and there was an easy way to pass new values to the uniforms.
The text was updated successfully, but these errors were encountered: