drei
drei copied to clipboard
Html not showing when scene have background
Hi, I'm using <Html>
to display DOM element on canvas, but when add background to the scene, the html not showing anymore:
- Before add background:
- After add background:
My code:
import {
OrbitControls,
Html,
} from "@react-three/drei";
import { Canvas } from "@react-three/fiber";
export default function App() {
return (
<div style={{ width: "100vw", height: "100vh" }}>
<Canvas camera={{ position: [-0.5, 1, 2] }}>
<color attach="background" args={["#f5efe6"]} />
<directionalLight position={[3.3, 1.0, 4.4]} castShadow />
<mesh>
<boxGeometry args={[1, 1, 1]} />
<meshStandardMaterial color="orange" />
</mesh>
<OrbitControls />
<Html position={[-4.5, 3.6, -3]} occlude="blending">
<h1>Testing</h1>
</Html>
</Canvas>
</div>
);
}
This is also a bug when using an Environment, bug still lurking today