threepipe
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

HDRiGroundPlugin.md 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. ---
  2. prev:
  3. text: 'ParallaxMappingPlugin'
  4. link: './ParallaxMappingPlugin'
  5. next:
  6. text: 'VirtualCamerasPlugin'
  7. link: './VirtualCamerasPlugin'
  8. ---
  9. # HDRiGroundPlugin
  10. [//]: # (todo: image)
  11. [Example](https://threepipe.org/examples/#hdri-ground-plugin/) —
  12. [Source Code](https://github.com/repalash/threepipe/blob/master/src/plugins/extras/HDRiGroundPlugin.ts) —
  13. [API Reference](https://threepipe.org/docs/classes/HDRiGroundPlugin.html)
  14. HDRiGroundPlugin patches the background shader in the renderer to add support for ground projected environment map/skybox. Works simply by setting the background same as the environment and enabling the plugin.
  15. The world radius, tripod height, and origin position(center offset) can be set in the plugin.
  16. The plugin is disabled by default when added. Set `.enabled` to enable it or pass `true` in the constructor.
  17. If the background is not the same as the environment when enabled, the user will be prompted for this, unless `promptOnBackgroundMismatch` is set to `false` in the plugin.
  18. ```typescript
  19. import {ThreeViewer, HDRiGrounPlugin} from 'threepipe'
  20. const viewer = new ThreeViewer({...})
  21. const hdriGround = viewer.addPluginSync(new HDRiGrounPlugin())
  22. // Load an hdr environment map
  23. await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr')
  24. // set background to environment
  25. viewer.scene.background = 'environment'
  26. // or
  27. // viewer.scene.background = viewer.scene.environemnt
  28. // enable the plugin
  29. hdriGround.enabled = true
  30. ```
  31. Check the [example](https://threepipe.org/examples/#hdri-ground-plugin/) for a demo.