angular-three-soba/materials

December 31, 2025 ยท View on GitHub

This secondary entry point includes a variety of materials for customizing the appearance of your 3D objects.

PackageDescription
three-custom-shader-materialRequired by NgtsCustomShaderMaterial. A custom shader material that can be used to create custom materials.
@pmndrs/vanillaA list of vanilla THREE.js implementations of various things.
three-mesh-bvhRequired by NgtsMeshRefractionMaterial. A BVH implementation for three.js.
npm install three-custom-shader-material @pmndrs/vanilla three-mesh-bvh
# yarn add three-custom-shader-material @pmndrs/vanilla three-mesh-bvh
# pnpm add three-custom-shader-material @pmndrs/vanilla three-mesh-bvh

TOC

NgtsCustomShaderMaterial

A component that allows you to create custom shader materials using the three-custom-shader-material library. It provides a flexible way to define your own shaders and control the rendering of your objects.

Inputs

PropertyDescriptionDefault Value
baseMaterialRequired. The base material to extend (material instance, class, or ElementRef).-
attachHow to attach the material to its parent object.'material'
optionsConfiguration options including vertexShader, fragmentShader, uniforms, cacheKey, and parameters.{}

Object Input (options)

PropertyDescriptionDefault Value
vertexShaderThe vertex shader code.undefined
fragmentShaderThe fragment shader code.undefined
uniformsAn object containing the uniforms for the shader.undefined
cacheKeyCache key for shader compilation.undefined
<ngt-points>
	<ngt-icosahedron-geometry *args="[1, 32]" />
	<ngts-custom-shader-material
		[baseMaterial]="PointsMaterial"
		[options]="{
      vertexShader: myVertexShader,
      fragmentShader: myFragmentShader,
      uniforms: { time: { value: 0 } }
    }"
	/>
</ngt-points>

NgtsMeshDistortMaterial

A material that applies animated noise-based distortion to mesh surfaces. Extends MeshPhysicalMaterial with vertex displacement using simplex noise.

Object Input (NgtsMeshDistortMaterialOptions)

PropertyDescriptionDefault Value
speedAnimation speed multiplier for the distortion.1
factorDistortion intensity factor.undefined

Also accepts all MeshPhysicalMaterial properties.

<ngt-mesh>
	<ngt-sphere-geometry />
	<ngts-mesh-distort-material [options]="{ speed: 2, factor: 0.5, color: 'hotpink' }" />
</ngt-mesh>

NgtsMeshPortalMaterial

A material that creates a portal effect, rendering a separate scene inside a mesh. Supports smooth blending between the portal scene and the world scene, edge blur, and automatic visibility culling.

Object Input (NgtsMeshPortalMaterialOptions)

PropertyDescriptionDefault Value
blendMix the portal's own scene with the world scene. 0 = world, 0.5 = both, 1 = portal0
blurEdge fade blur using signed distance field (SDF).0
resolutionSDF resolution. Smaller values result in faster start-up time.512
worldUnitsWhether portal contents use world-space coordinates.false
eventPriorityEvent priority for the portal's raycasting.0
renderPriorityRender priority for the portal scene.0
eventsWhether to enable events inside the portal.false
<ngt-mesh>
	<ngt-plane-geometry />
	<ngts-mesh-portal-material [options]="{ blend: 1, blur: 0.5 }">
		<ng-template>
			<!-- Portal scene content -->
			<ngt-mesh>
				<ngt-box-geometry />
				<ngt-mesh-basic-material color="red" />
			</ngt-mesh>
		</ng-template>
	</ngts-mesh-portal-material>
</ngt-mesh>

NgtsMeshReflectorMaterial

A material that creates realistic reflections on a planar surface. Supports blur, depth-based effects, distortion, and mirror-like reflections. The parent mesh should be a flat plane for best results.

Object Input (NgtsMeshReflectorMaterialOptions)

PropertyDescriptionDefault Value
resolutionResolution of the reflection render target.256
mixBlurAmount of blur mixing applied to the reflection.0
mixStrengthStrength of the reflection mix.1
blurBlur amount as [x, y] or a single value.[0, 0]
mirrorMirror reflection intensity (0 = no, 1 = full).0
minDepthThresholdMinimum depth threshold for depth-based effects.0.9
maxDepthThresholdMaximum depth threshold for depth-based effects.1
depthScaleScale factor for depth-based effects.0
depthToBlurRatioBiasBias ratio between depth and blur effects.0.25
distortionDistortion intensity applied to the reflection.1
mixContrastContrast adjustment for the reflection mix.1
reflectorOffsetOffset of the reflector plane along its normal.0
distortionMapOptional texture to apply distortion effects.undefined

Also accepts all MeshStandardMaterial properties.

<ngt-mesh [rotation]="[-Math.PI / 2, 0, 0]">
	<ngt-plane-geometry *args="[10, 10]" />
	<ngts-mesh-reflector-material
		[options]="{
      blur: [300, 100],
      resolution: 1024,
      mixBlur: 1,
      mixStrength: 50,
      mirror: 0.5,
      color: '#a0a0a0'
    }"
	/>
</ngt-mesh>

NgtsMeshRefractionMaterial

A material that simulates realistic light refraction through transparent objects. Uses ray tracing with BVH acceleration for accurate light bending effects. Ideal for diamonds, crystals, glass, and other transparent materials.

Inputs

PropertyDescriptionDefault Value
envMapRequired. The environment map (CubeTexture or Texture).-
attachHow to attach the material to its parent object.'material'
optionsConfiguration options for the refraction material.See below

Object Input (NgtsMeshRefractionMaterialOptions)

PropertyDescriptionDefault Value
bouncesThe number of ray-cast bounces.2
iorThe refraction index. Diamond is 2.4, glass is 1.5.2.4
fresnelThe Fresnel effect intensity (strip light reflections).0
aberrationStrengthThe RGB chromatic aberration shift intensity.0
colorThe color of the material.'white'
fastChromaWhether to use fewer ray casts for the RGB shift sacrificing physical accuracy.true

If you want it to reflect other objects in the scene you best pair it with a cube-camera.

<ngts-cube-camera>
	<ngt-mesh *cameraContent="let texture">
		<ngts-mesh-refraction-material [envMap]="texture()" />
	</ngt-mesh>
</ngts-cube-camera>

Otherwise, just pass it an environment map.

<!-- texture = injectLoader(() => RGBELoader, () => 'path/to/texture.hdr') -->
<ngt-mesh>
	<ngts-mesh-refraction-material [envMap]="texture()" />
</ngt-mesh>

NgtsMeshTransmissionMaterial

A physically-based transmission material for realistic glass, water, and other transparent surfaces. Extends MeshPhysicalMaterial with additional features like backside rendering, temporal reprojection, and anisotropic blur.

Object Input (NgtsMeshTransmissionMaterialOptions)

PropertyDescriptionDefault Value
transmissionThe transmission factor of the material.1
thicknessThe thickness of the material.0
backsideThicknessThe thickness of the backside of the material.0
transmissionSamplerWhether to use the Three.js transmission sampler texture.false
backsideWhether to render the backside of the material for more accurate results.false
backsideEnvMapIntensityThe environment map intensity of the backside of the material.1
resolutionThe resolution of the local buffer.undefined
backsideResolutionThe resolution of the local buffer for backfaces.undefined
samplesThe number of refraction samples.10
backgroundThe background of the buffer scene (texture, color, or null).undefined
anisotropicBlurAnisotropic blur amount for the transmission effect.undefined
bufferCustom buffer texture. If not provided, an internal FBO is used.undefined

Also accepts all MeshPhysicalMaterial properties like roughness, chromaticAberration, distortion, distortionScale, temporalDistortion, etc.

<ngt-mesh>
	<ngt-sphere-geometry />
	<ngts-mesh-transmission-material
		[options]="{
      backside: true,
      thickness: 0.5,
      chromaticAberration: 0.05,
      anisotropicBlur: 0.1
    }"
	/>
</ngt-mesh>

NgtsMeshWobbleMaterial

A material that applies animated sine-wave wobble distortion to mesh surfaces. Extends MeshStandardMaterial with vertex displacement for organic, jelly-like motion.

Object Input (NgtsMeshWobbleMaterialOptions)

PropertyDescriptionDefault Value
speedAnimation speed multiplier for the wobble.1
factorThe strength of the wobble effect.undefined

Also accepts all MeshStandardMaterial properties.

<ngt-mesh>
	<ngt-torus-geometry />
	<ngts-mesh-wobble-material [options]="{ speed: 2, factor: 0.6, color: 'cyan' }" />
</ngt-mesh>

NgtsPointMaterial

A material for rendering point clouds with consistent size regardless of distance. Extends THREE.PointsMaterial with additional shader modifications for improved point rendering with size attenuation control.

Object Input

Accepts all THREE.PointsMaterialParameters properties like size, color, sizeAttenuation, map, etc.

<ngt-points>
	<ngt-buffer-geometry>
		<ngt-buffer-attribute attach="attributes.position" [args]="[positions, 3]" />
	</ngt-buffer-geometry>
	<ngts-point-material [options]="{ size: 0.1, color: 'orange', sizeAttenuation: true }" />
</ngt-points>