threepipe
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

ParallaxMappingPlugin.md 2.1KB


prev:

text: 'FragmentClippingExtensionPlugin'
link: './FragmentClippingExtensionPlugin'

next:

text: 'HDRiGroundPlugin'
link: './HDRiGroundPlugin'

ParallaxMappingPlugin

ExampleSource CodeAPI Reference

ParallaxMappingPlugin adds a material extension to PhysicalMaterial to add support for parallax relief mapping. The idea is to walk along a ray that has entered the bumpmap’s volume, finding the intersection point of the ray with the bumpmap. Steep parallax mapping and parallax occlusion mapping are other common names for these techniques.

To use the plugin, add the plugin to the viewer and use the bumpMap in PhysicalMaterial normally. The max height is determined by the bumpScale in the material. This is assumed to be in world scale.

import {ThreeViewer, ParallaxMappingPlugin} from 'threepipe'

const viewer = new ThreeViewer({...})

const parallaxMapping = viewer.addPluginSync(ParallaxMappingPlugin)

// load or create an object 

// set the bump map
object.material.bumpMap = await viewer.load<ITexture>(bumps[0]) || null
// set the bump scale
object.material.bumpScale = 0.1
// setDirty to notify the viewer to update.
object.material.setDirty()