0.0.37 • Published 4 years ago
@youyouzone/react-sdf v0.0.37
Computer-Graphics-Lab
A React renderer for pathtracing.
Usage
install npm package
npm install @youyouzone/react-sdfuse as a React component
import Page from '@youyouzone/react-sdf';
export const App = () => {
   const rawData = [
    { position: [0, 180, 0], size: [100, 0.01, 25], color: [1.0, 0.7, 0.38], emissive: [10, 10, 10] },
    { position: [0, 201, 0], size: [200, 1, 100], color: [0.7, 0.7, 0.7], },
    { position: [-200, 50, 0], size: [1, 150, 100], color: [1, 0, 0] },
    { position: [200, 50, 0], size: [1, 150, 100], color: [0, 1, 0], roughness: 0.1, metallic: 1 },
    { position: [0, 0, -100], size: [200, 200, 1], color: [0, 1, 1], },
    { position: [0, -100, 0], size: [200, 1, 100], color: [0.7, 0.7, 0.7] },
    { position: [-50, -40, 0], size: [30, 60, 30], color: [0.5, 0.3, 0.6] },
  ]
  return <Page
    style={{ width: '100%', height: '100vh' }}
  >
    <Camera
      position={[0, 50, 250]}
      lookat={[0, 50, 0]}
      rotation={0}
      fov={50 / 180 * Math.PI}
    />
    {rawData.map(({ position, size, color, emissive, roughness, metallic }, i) =>
      <box
        key={i}
        position={position}
        size={size}
        color={color}
        emissive={emissive}
        roughness={roughness}
        metallic={metallic}
      />
    )}
    <sphere
      position={[50, -45, 0]}
      radius={50}
      color={[1, 1, 1]}
      roughness={0}
      specTrans={1}
      specular={0.02}
    />
  </Page>
}Examples
demos
https://cornell-box.netlify.app
https://disney-principled.netlify.app
https://bvh-example.netlify.app  
images with bugs
License
This project is licensed under 
Contact
0.0.37
4 years ago
0.0.36
4 years ago
0.0.35
4 years ago
0.0.34
4 years ago
0.0.33
4 years ago
0.0.32
4 years ago
0.0.31
4 years ago
0.0.30
4 years ago
0.0.29
4 years ago
0.0.28
4 years ago
0.0.27
4 years ago
0.0.25
4 years ago
0.0.24
4 years ago
0.0.23
4 years ago
0.0.22
4 years ago
0.0.21
4 years ago
0.0.20
4 years ago
0.0.19
4 years ago
0.0.18
4 years ago
0.0.17
4 years ago
0.0.16
4 years ago
0.0.15
4 years ago
0.0.14
4 years ago
0.0.13
4 years ago
0.0.12
4 years ago
0.0.11
4 years ago
0.0.10
4 years ago
0.0.9
4 years ago
0.0.8
4 years ago
0.0.7
4 years ago
0.0.6
4 years ago
0.0.5
4 years ago
0.0.4
4 years ago
0.0.3
4 years ago
0.0.2
4 years ago
0.0.1
4 years ago