Comments (7)
Can you share a model and/or code to reproduce this?
from react-three-fiber.
Can you share a model and/or code to reproduce this?
Thank you for your replying.
Yes, of course, I will add more information for this issue.
Here is the GLB file I uploaded with Google drive link below.
https://drive.google.com/file/d/1dnuHwZMStMKexlDPrnheTN8VjfZt0Wjq/view?usp=sharing
And now please let me paste the code:
import { useGLTF } from "@react-three/drei/native";
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
import { useLoader, useThree } from "@react-three/fiber/native";
import {
forwardRef,
useRef,
useState,
useLayoutEffect,
useEffect,
} from "react";
import gtlfFile from "./B.glb";
import THREE from "three";
const Girl = forwardRef((props, ref) => {
const { camera } = useThree();
const animationGroup = useRef(null!);
const { scene, nodes } = useGLTF(
gtlfFile,
) as unknown as {
nodes: THREE.BufferGeometry[];
scene: {
geometries: THREE.BufferGeometry[];
materials: THREE.Material;
};
};
return (
<>
{Object.entries(nodes).map(([key, value]) => {
return (
<mesh
key={key}
castShadow
receiveShadow
geometry={value.geometry}
material={value.material}
>
</mesh>
);
})}
</>
);
});
Girl.displayName = "Girl";
export default Girl;
from react-three-fiber.
Can you share a model and/or code to reproduce this?
Thank you for your replying.
Yes, of course, I will add more information for this issue.Here is the GLB file I uploaded with Google drive link below.
https://drive.google.com/file/d/1dnuHwZMStMKexlDPrnheTN8VjfZt0Wjq/view?usp=sharing
And now please let me paste the code:
import { useGLTF } from "@react-three/drei/native"; import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader"; import { useLoader, useThree } from "@react-three/fiber/native"; import { forwardRef, useRef, useState, useLayoutEffect, useEffect, } from "react"; import gtlfFile from "./B.glb"; import THREE from "three"; const Girl = forwardRef((props, ref) => { const { camera } = useThree(); const animationGroup = useRef(null!); const { scene, nodes } = useGLTF( gtlfFile, ) as unknown as { nodes: THREE.BufferGeometry[]; scene: { geometries: THREE.BufferGeometry[]; materials: THREE.Material; }; }; return ( <> {Object.entries(nodes).map(([key, value]) => { return ( <mesh key={key} castShadow receiveShadow geometry={value.geometry} material={value.material} > </mesh> ); })} </> ); }); Girl.displayName = "Girl"; export default Girl;
Sorry for I forgot to mention, I have made some change here:
<primitive object={scene} {...props} />
to:
{Object.entries(nodes).map(([key, value]) => {
return (
<mesh
key={key}
castShadow
receiveShadow
geometry={value.geometry}
material={value.material}
>
</mesh>
);
})}
because I need to debug the source code, and try to find what happend
from react-three-fiber.
I debug the source code, I guess there' s something wrong with "webGL2" boolean logic:
if no "webGL2" invoker went to MathUtil.sRGBToLinear, then went here.
But the "image.data" is a {} object, if call image.data.slice(0)... BOOM~
from react-three-fiber.
Simply put, if you follow the official documentation and load any 3D model with texture maps, you will reproduce the issue I am experiencing: https://docs.pmnd.rs/react-three-fiber/getting-started/installation#react-native
from react-three-fiber.
Can someone help me, please?
the log ......that's wild
from react-three-fiber.
I updated the source code , the error disappeared, but the model turned to dark?
from react-three-fiber.
Related Issues (20)
- How to animate material during rendering
- Can't catch all useGLTF errors with React Error Boundaries HOT 7
- How to render text on top of material from list of materials? HOT 1
- Invalidate is not behaving as expected HOT 5
- Can we modify useLoader to accept an empty string or null? HOT 1
- XRFrame type resolving incorrectly HOT 2
- Error loading OBJ model in React Native HOT 2
- Help: TypeError in is.equ HOT 4
- Primitive with children mounting / unmounting + documentation HOT 4
- This sandbox doesn't work HOT 1
- Canvas eventHandler: onWebGLContextLost, onWebGLContextRestored HOT 2
- Cannot catch error HOT 1
- Is it possible to use react-three-fiber with React-Native CLI application? HOT 1
- help: using the onPointerDown event of a` <group/>` and the event.handlers of `useThree()` together HOT 1
- Types: Removed classes from three.js are still available at R3F HOT 3
- Rendering `<Context.Consumer.Provider>` is not supported HOT 1
- R3F & StereoCamera
- Breaking changes in React experimental branch HOT 1
- Cannot read properties of undefined (reading 'boundingSphere') HOT 1
- Forced landscape HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-three-fiber.