threepipe
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122
  1. import {_testFinish, DepthBufferPlugin, IObject3D, ThreeViewer, TonemapPlugin, UnsignedByteType} from 'threepipe'
  2. import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane'
  3. async function init() {
  4. const viewer = new ThreeViewer({
  5. canvas: document.getElementById('mcanvas') as HTMLCanvasElement,
  6. tonemap: true, // this is true by default
  7. })
  8. // A GBuffer(depth buffer here) is required for the `tonemapBackground` flag in TonemapPlugin to work
  9. viewer.addPluginSync(new DepthBufferPlugin(UnsignedByteType, true))
  10. await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr')
  11. await viewer.load<IObject3D>('https://threejs.org/examples/models/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf')
  12. const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true))
  13. ui.setupPluginUi(TonemapPlugin)
  14. }
  15. init().then(_testFinish)