threepipe
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

NoiseBumpMaterialPlugin.md 1.4KB

1 год назад
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ---
  2. prev:
  3. text: 'FilmicGrainPlugin'
  4. link: './FilmicGrainPlugin'
  5. next:
  6. text: 'CustomBumpMapPlugin'
  7. link: './CustomBumpMapPlugin'
  8. ---
  9. # NoiseBumpMaterialPlugin
  10. [//]: # (todo: image)
  11. [Example](https://threepipe.org/examples/#noise-bump-material-plugin/) —
  12. [Source Code](https://github.com/repalash/threepipe/blob/master/src/plugins/material/NoiseBumpMaterialPlugin.ts) —
  13. [API Reference](https://threepipe.org/docs/classes/NoiseBumpMaterialPlugin.html)
  14. NoiseBumpMaterialPlugin adds a material extension to PhysicalMaterial to add support for sparkle bump / noise bump by creating procedural bump map from noise to simulate sparkle flakes.
  15. It uses voronoise function from blender along with several additions to generate the noise for the generation.
  16. It also adds a UI to the material to edit the settings.
  17. It uses `WEBGI_materials_noise_bump` glTF extension to save the settings in glTF/glb files.
  18. ```typescript
  19. import {ThreeViewer, NoiseBumpMaterialPlugin} from 'threepipe'
  20. const viewer = new ThreeViewer({...})
  21. const noiseBump = viewer.addPluginSync(NoiseBumpMaterialPlugin)
  22. // Add noise bump to a material
  23. NoiseBumpMaterialPlugin.AddNoiseBumpMaterial(material, {
  24. flakeScale: 300,
  25. })
  26. // Change properties with code or use the UI
  27. material.userData._noiseBumpMat!.bumpNoiseParams = [1, 1]
  28. material.setDirty()
  29. // Disable
  30. material.userData._noiseBumpMat!.hasBump = false
  31. material.setDirty()
  32. ```