Skip to content

copper3d / Modules / Utils/modelCrossfade

Module: Utils/modelCrossfade

Table of contents

Interfaces

Functions

Functions

collectFadeTargets

collectFadeTargets(root): FadeTarget[]

Parameters

NameType
rootDisposableObject3D

Returns

FadeTarget[]

Defined in

src/Utils/modelCrossfade.ts:26


restoreFade

restoreFade(targets): void

Puts each material back exactly as collectFadeTargets found it.

Parameters

NameType
targetsFadeTarget[]

Returns

void

Defined in

src/Utils/modelCrossfade.ts:65


setFade

setFade(targets, factor): void

Scales each material toward transparent by factor, RELATIVE to the opacity it already had. Scaling rather than assigning is what keeps an already-translucent material translucent: opacity = factor would end every crossfade with it fully opaque.

depthWrite is suppressed for the whole fade and only restored at the fully-opaque end. A partially transparent mesh that still writes depth occludes everything drawn behind it, so a fade with depth writing left on shows the outgoing model punching holes in the incoming one.

Parameters

NameType
targetsFadeTarget[]
factornumber

Returns

void

Defined in

src/Utils/modelCrossfade.ts:56