npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@react-three/gpu-pathtracer

v0.1.1

Published

⚡️ A React abstraction for the popular three-gpu-pathtracer.

Downloads

140

Readme

react-three-gpu-pathtracer lets you render your react-three-fiber scenes using Path Tracing! It is as simple as

import { Pathtracer } from '@react-three/gpu-pathtracer'

function GradientSphere() {
  return (
    <Canvas>
      <Pathtracer>{/* Your scene */}</Pathtracer>
    </Canvas>
  )
}

The <Pathtracer /> component wraps your scene. The scene is then rendered using Path Tracing.

Props

| Prop | Type | Default | Description | | --------------------- | ---------------------------------------------------------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | | alpha | number | 1 | Alpha of the scene background. Must be set to <1 to see behind the canvas. Two extra render targets are used if <1. | | samples | number | 1 | Number of samples per-frame | | frames | number | Infinity | Number of frames to path trace. Will pause rendering once this number is reached. | | tiles | [number, number] / THREE.Vector2 / { x: number; y: number } / number | 2 | Number of tiles. Can be used to improve the responsiveness of a page while still rendering a high resolution target. | | bounces | number | 1 | The number of ray bounces to test. Higher is better quality but slower performance. | | enabled | boolean | true | Wether to enable pathtracing. | | resolutionFactor | number | 1 | Scaling factor for resolution.0.5 means the scene will be rendered at half of screen resolution. Higher is better quality but slower performance. | | backgroundBlur | number | 0 | Strength of blur on background env map. | | backgroundIntensity | number | 1 | Strength of the light cast by the env map. |

Backgrounds

Env maps

Env maps can be added using Drei's <Environment /> component just like in a regular scene.

<Pathtracer>
  <Environment
    preset="..."
    background // Optional, set as scene background
  />
</Pathtracer>

Or you can use a solid color as the background

<Canvas>
    <color args={[0xff0000]} attach="background" />

    <Pathtracer>
        // ...

usePathtracer

This hook provides access to useful functions in the internal renderer. Can only be used within the <Pathtracer /> component.

const { renderer, update, reset } = usePathtracer()

| Return value | Type | Description | | ------------ | --------------------- | -------------------------------------------------------------------------------------------------------- | | renderer | PathTracingRenderer | Internal renderer. Can be used to access/edit internal properties | | reset | () => void | Clear's the textures. Equiv to renderer.reset(). Must be called every time the camera moves. | | update | () => void | Re-calculates and re-uploads BVH. Needed when new objects/materials are added to/removed from the scene. |