Giter Site home page Giter Site logo

Comments (7)

CodyJasonBennett avatar CodyJasonBennett commented on May 26, 2024

Can you share a model and/or code to reproduce this?

from react-three-fiber.

eric183 avatar eric183 commented on May 26, 2024

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.

eric183 avatar eric183 commented on May 26, 2024

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.

eric183 avatar eric183 commented on May 26, 2024

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.

https://github.com/mrdoob/three.js/blob/1b8412c700316e3ed0d3b5f5ab827287e3351bad/build/three.js#L1801C32-L1801C32

But the "image.data" is a {} object, if call image.data.slice(0)... BOOM~

from react-three-fiber.

eric183 avatar eric183 commented on May 26, 2024

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.

eric183 avatar eric183 commented on May 26, 2024

Can someone help me, please?

the log ......that's wild

image

from react-three-fiber.

eric183 avatar eric183 commented on May 26, 2024

I updated the source code , the error disappeared, but the model turned to dark?

image

from react-three-fiber.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.