Can't use node materials in R3F project

i’m trying to use meshStandardNodeMaterial in r3f but get next error from console -

> Uncaught Error: R3F: MeshStandardNodeMaterial is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively

i tried use extend from react and extend nodeMaterial but this didn’t help

someone tell me please that i’m not mad, cause it’s :(;: ?)

have you tried this approach correctly?

import { extend, useFrame } from ‘@react-three/fiber’;
import { MeshStandardNodeMaterial } from ‘three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js’;

extend({ MeshStandardNodeMaterial });

1 Like

yeah, of course, but typescript linter shows error to path of MeshStandardNodeMaterial
three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js’;

he telling me there is nothing similar
i found MeshStandardNodeMaterial class only at src/materials/nodes

i saw someone project, revision 3D (maybe) he uses MeshStandardNodeMaterial without any import and it works fine. i don’t understand how this could be possible any way?
maybe with new version three.js something changed?

How to use WebGPU in R3F

-  import * as THREE from 'three'
+  import * as THREE from 'three/webgpu'

And tell the R3F to use the WebGPURenderer

Example,

4 Likes

Property “meshStandardNodeMaterial” does not exist on type “JSX.IntrinsicElements”.ts(2339)

I’m not sure — at the moment, I prefer building projects with Vite and tree-shaking.
But this example is very useful, thanks!
I’ve attached some screenshots from the project — nothing unusual there.
Unfortunately, the error still persists.

As in Sean’s example extend(THREE)
Otherwise it should be extend({MeshStandardNodeMaterial})

This doesn’t help either

‘MeshStandardNodeMaterial’ is not defined in the current scope. You need to declare it or provide an initializer.

import {MeshStandardNodeMaterial} from 'three/webgpu' 
extend({MeshStandardNodeMaterial})

Or

extend({THREE.MeshStandardNodeMaterial})

Or as previously shown by @seanwasere
extend(THREE)

2 Likes

at the end i decaded to use

primitie with material construction and initiliaze material in body of component


yeap meshStandardNodeMaterial was in the three/webgpu but it still doesn’t recognize from typescript - JSX.IntrinsicElements not found

i don’t know why, but it’s okey

thanks ;D