Hello and good day to the gurus of three.js.
here is the thing, I have add a plane geometry which shows a video in it but I want to have rounded edges for the plane. Any suggestion would be nice. What I found on the internet was bit confusing for me.
Here is what i get
Here is my code (its not great)
import React, { Suspense, useEffect, useState } from "react";
import { Canvas } from "@react-three/fiber";
import {
OrbitControls,
Preload,
useGLTF,
useVideoTexture,
useTexture,
RoundedBox,
Shape,
} from "@react-three/drei";
import * as THREE from "three";
import CanvasLoader from "./CanvasLoader";
const Mobile = ({ isMobile }) => {
const mobile = useGLTF("./mobile3D/scenes5.glb");
return (
<group>
<mesh>
<hemisphereLight intensity={1} />
<ambientLight intensity={10} />
<primitive
object={mobile.scene}
scale={isMobile ? 0.7 : 50}
position={isMobile ? [0, 0, 0] : [0, -4, 0]}
rotation={[0, 4.35, 0]}
/>
<mesh rotation={[0, 205.41, 0]} position={[-0.19, 0, -0.07]}>
<planeGeometry args={[1, 1]} />
<Suspense>
<LogoMaterial url="mylogo.png" />
</Suspense>
</mesh>
{/* video texture and settings HERE */}
<mesh
rotation={[0, -199.85, 0]}
position={[0.19, 0, 0.07]}
>
<planeGeometry args={[3.65, 7.8]} />
<Suspense fallback={<FallbackMaterial url="play_icon.png" />}
<VideoMaterial url="10.mp4" />
</Suspense>
</mesh>
</mesh>
</group>
);
};
function VideoMaterial({ url }) {
const texture = useVideoTexture(url);
return <meshBasicMaterial map={texture} toneMapped={false} />;
}
function FallbackMaterial({ url }) {
const texture = useTexture(url);
return <meshBasicMaterial map={texture} toneMapped={false} />;
}
function LogoMaterial({ url }) {
const texture = useTexture(url);
return (
<meshBasicMaterial map={texture} toneMapped={false} transparent={true} />
);
}
Although I have found few suggestions but they are not very clear… Any suggestion would be really helpful.