Closed jinincarnate closed 1 year ago
@jinincarnate How are you doing it now - ie: this does not work?
<texture
url="assets/textures/diffuse.png"
assignTo="diffuseTexture"
uScale={textureUScale}
uOffset={textureUOffset}
/>
ref: https://doc.babylonjs.com/typedoc/classes/BABYLON.Texture#uScale
<standardMaterial name="media_material" roughness={1} emissiveColor={Color3.FromHexString('#000000')} specularColor={Color3.Black()} ref={mediaMaterialRef} />
`const [mediaMaterial, setMediaMaterial] = useState<StandardMaterial | null>( null );
const mediaMaterialRef = useCallback((node: any) => { if (node) { setMediaMaterial(node); } }, []);`
mediaMaterial.diffuseTexture. doesn't have uOffset
can you share a working codesandbox or babylonjs playground?
This is because the type for the diffuseTexture is BaseTexture, which doesn't have the property. If you cast it, you should get your available options:
(material.diffuseTexture as Texture).uScale = 2
https://doc.babylonjs.com/typedoc/classes/BABYLON.BaseTexture
Thank you so much that was the exact case
you should also be able to do:
<standardMaterial name="media_material" ,,, >
<texture assignFrom='diffuseTexture' uScale={2} />
</standardMaterial>
how to set a textures uOffset or uScale property for tiling purpose