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.

преди 1 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. ---
  2. prev:
  3. text: 'NoiseBumpMaterialPlugin'
  4. link: './NoiseBumpMaterialPlugin'
  5. next:
  6. text: 'ClearcoatTintPlugin'
  7. link: './ClearcoatTintPlugin'
  8. ---
  9. # CustomBumpMapPlugin
  10. [//]: # (todo: image)
  11. [Example](https://threepipe.org/examples/#custom-bump-map-plugin/) —
  12. [Source Code](https://github.com/repalash/threepipe/blob/master/src/plugins/material/CustomBumpMapPlugin.ts) —
  13. [API Reference](https://threepipe.org/docs/classes/CustomBumpMapPlugin.html)
  14. CustomBumpMapPlugin adds a material extension to PhysicalMaterial to support custom bump maps.
  15. A Custom bump map is similar to the built-in bump map, but allows using an extra bump map and scale to give a combined effect.
  16. This plugin also has support for bicubic filtering of the custom bump map and is enabled by default.
  17. It also adds a UI to the material to edit the settings.
  18. It uses `WEBGI_materials_custom_bump_map` glTF extension to save the settings in glTF/glb files.
  19. ```typescript
  20. import {ThreeViewer, CustomBumpMapPlugin} from 'threepipe'
  21. const viewer = new ThreeViewer({...})
  22. const customBump = viewer.addPluginSync(CustomBumpMapPlugin)
  23. // Add noise bump to a material
  24. customBump.enableCustomBump(material, bumpMap, 0.2)
  25. // Change properties with code or use the UI
  26. material.userData._customBumpMat = texture
  27. material.setDirty()
  28. // Disable
  29. material.userData._hasCustomBump = false
  30. // or
  31. material.userData._customBumpMat = null
  32. material.setDirty()
  33. ```