Skip to content

Per-object opacity for OutlineEffect #352

Closed

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

Activity

  1. vanruesc commented on Mar 2, 2022

    @vanruesc
    Member

    There are a number of ways the current OutlineEffect implementation could be improved, especially in terms of performance and visual quality. Supporting per-object opacity would be nice, but figuring out if and how that's possible requires further research. I'm currently prioritizing other issues in postprocessing, some of which will make it easier to implement features like this one. In that sense, let's keep this ticket open and revisit it later.

  2. canadaduane commented on Mar 2, 2022

    @canadaduane
    Author

    I sure appreciate your work. Thanks for the insights & for keeping this as a tracker for potential improvement.

  3. canadaduane commented on Jul 4, 2022

    @canadaduane
    Author

    A related feature request: per-object outline color (e.g. red outlines vs white outlines on the same pass).

  4. vanruesc commented on Jul 4, 2022

    @vanruesc
    Member

    I'll put it on the outlines revamp feature list 😅

  5. vanruesc commented on Aug 21, 2025

    @vanruesc
    Member

    Folding this into #727

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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