Skip to content

Per-object opacity for OutlineEffect #352

@canadaduane

Description

@canadaduane

Is your feature request related to a problem?

Currently, objects can be added to the OutlineEffect's selection array in order to be rendered with an outline. The outline is either "on" or "off", with whatever opacity settings that may be provided at instantiation of the OutlineEffect itself (i.e. opacity affects all objects).

Describe the solution you'd like

Would it be possible to add an opacity setting to individual objects? For example, rather than merely adding Object3Ds to the selection array, perhaps a javascript object with per-Object3D parameters could be passed? e.g.

// At initialization:
const outlineEffect = new OutlineEffect(this.scene, this.camera, { ... });
const cube = new Mesh(new BoxGeometry( 1, 1, 1 ), new MeshBasicMaterial());
...
// Later:
this.outlineEffect.selection.push({
  object: cube,
  opacity: 0.5
});

// Even later:
this.outlineEffect.selection[0].opacity = 0.1;

Describe alternatives you've considered

I could create many OutlineEffect layers with pre-configured opacity, but when the number of objects combined with the opacity settings is large, the number of effect passes increases exponentially.

Additional context

As an example, I'd like to make the outline around this lamp "fade in" gently when selected, then "fade out" when deselected:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions