Replies: 1 comment 4 replies
-
that isn't a primitive. 'map' itself is already a texture, so you're creating a texture and then give it a texture as an ... image? the following makes little sense: <texture attach="map" image={map} onUpdate={(self) => (self.needsUpdate = true)} /> typescript can help you eliminate these things without even having to study threejs docs. this is how you use primitive <primitive attach="map" object={map} onUpdate={(self) => (self.needsUpdate = true)} /> what you can do is using THREE.ImageLoader and then go <mesh>
<...Material>
<texture attach="map" image={image} /> but why would you, this is how it's usually done const [map] = useLoader(THREE.TextureLoader, [baseImageURL])
return (
<mesh>
<meshStandardMaterial color="green" map={map} /> |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm having trouble getting nested primitives to work with a simple texture.
This example attempts to display two components
TexturedPlane
andTexturedPlane2
.https://codesandbox.io/s/r3f-nested-texture-component-b2837?file=/src/index.js
TexturedPlane
works as expected, assigning a texture to the materialmap
property.TexturedPlane2
attempts to use the nested primitive syntax described in https://github.com/pmndrs/react-three-fiber/blob/master/markdown/api.md (see the example beginning 'You can nest primitive objects'), but this one doesn't render and generatesTypeError
in the console.Am I missing something in
TexturedPlane2
? Thanks!Beta Was this translation helpful? Give feedback.
All reactions