Skip to content

Instantly share code, notes, and snippets.

@hopezh
Created June 3, 2023 16:02
Show Gist options
  • Save hopezh/b0f5c20f9d05ca9d569ec878fe2b6aa7 to your computer and use it in GitHub Desktop.
Save hopezh/b0f5c20f9d05ca9d569ec878fe2b6aa7 to your computer and use it in GitHub Desktop.
react-three/fiber scene
import "./style.css";
import ReactDOM from "react-dom/client";
// import * as THREE from "three";
import { Canvas } from "@react-three/fiber";
import Episode from "./Episode.js";
import * as THREE from "three";
import React from 'react'
import Plot from 'react-plotly.js'
const root = ReactDOM.createRoot(document.querySelector("#root"));
// r3f -------------------------------------------------------------------------
// camera settings
const cameraSettings = {
fov: 45,
// zoom : 100,
near: 0.1,
far: 1000,
position: [3, 2, 6],
};
// WebGLRenderer settings
const glSettings = {
antialias: true,
// toneMapping : THREE.CineonToneMapping,
toneMapping: THREE.ACESFilmicToneMapping,
// outputEncoding : THREE.LinearEncoding,
outputEncoding: THREE.sRGBEncoding,
};
// prettier-ignore
root.render(
<Canvas
dpr={[1, 2]} // pixel ratio range (default value)
gl={glSettings}
camera={cameraSettings}
>
<Episode />
</Canvas>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment