Using Anaglyph or Parallax barrier #513
rachet-khanal
started this conversation in
General
Replies: 1 comment 4 replies
-
function Annaglyph({ enabled = false }) {
const { gl, scene, camera } = useThree()
const [effect] = useState(() => new THREE.AnaglyphEffect(gl))
return useFrame(() => (enabled ? effect : gl).render(scene, camera), 1)
} now drop it into your scene <Annaglyph enabled /> or make it conditional <Annaglyph enabled={flag} /> study useFrame in the api docs, the 1 in the end is important. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, how do we do a simple render of 2D to 3D in r3f. Example on three,js:
let annaglyph = true;
const effect = new THREE.AnaglyphEffect( renderer );
if( annaglyph ){
effect.render( scene, camera );
}else{
renderer.render( scene, camera );
}
Beta Was this translation helpful? Give feedback.
All reactions