I am a newbie and I am trying to use the OutlineEffect from threejs in my application, using react three fiber. I need the outline of the meshes such as in this example https://threejs.org/examples/#webgl_loader_mmd . I am not sure how to add the effect in react three fiber syntax.
I tried the code below and there is no error but also the effect is not showing. Can anyone help me, please? Thank you in advance!
import { useGLTF } from "@react-three/drei"
import React, { useRef } from "react";
import { OutlineEffect } from "three/examples/jsm/effects/OutlineEffect.js"
import { extend, useThree } from "@react-three/fiber";
extend({ OutlineEffect })
export default function Model(props) {
const { gl, camera, scene } = useThree() //finds the renderer
const model = useGLTF('./Test_Online3DViewerVisible.glb')
const torus = useRef()
const effect = new OutlineEffect(gl)
effect.render(scene, camera)
return <>
<mesh ref={torus}>
<torusGeometry />
<meshStandardMaterial />
</mesh>
</>
}
useGLTF.preload('./Test_Online3DViewerVisible.glb')