Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.3k views
in Technique[技术] by (71.8m points)

reactjs - React Three Fiber: Set Depth Write / Depth Test of of Drei Text

I'm using R3F with "Drei" and want to use the Text component. Unfortunately I need to set Depth Write and Depth Test to always have the text in the foreground. Here you can see that it ist possible to set a custom material to the text component.

https://drei.react-spring.io/?path=/story/abstractions-text--custom-material-text-st

But I can't get it going. When I attach a material like so:

      <Text
        color={"#222222"} // default
        anchorX="center" // default
        anchorY="top" // default
        textAlign="center"
        fontSize={fontSize}
        maxWidth={10}
      >
        <meshBasicMaterial
          attach="material"
          depthWrite={false}
          depthTest={false}
        />
        Some Text
  </Text>

I get errors like that:

Uncaught TypeError: Cannot assign to read only property 'dispose' of object '#DerivedMaterial'

Can someone help me please? Thanks


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...