Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combining two outline effects #464

Closed
rospuye opened this issue Mar 18, 2023 · 2 comments
Closed

Combining two outline effects #464

rospuye opened this issue Mar 18, 2023 · 2 comments
Labels
support User support and general help

Comments

@rospuye
Copy link

rospuye commented Mar 18, 2023

Hey @vanruesc! Thanks for the awesome library! :)

I noticed something while working with the outline effect. I'm not 100% sure if this is an actual bug or if I haven't found the right configuration for the effect composer, but after playing with different options I haven't been able to find a solution to my problem.

Description of the bug

I'm trying to combine two outline effects that serve different purposes (one for selection and one for hover). The problem is that altering the selection for either of the outline effects affects the selection of the other one as well.

For example, if I select an object and get the red selection outline, that outline disappears as soon as the mouse stops hovering said object because the setting of the hover outline's selection to an empty array also affected the selection array for the selection outline.

I've tried exploring the outline effect attributes, I also tried to place the two outline effects on different effect passes, and I've tried to juggle two effect composers as well, all without success.

To Reproduce

I built a demo sandbox to illustrate the problem.

Expected behavior

In the demo sandbox, I have a selection outline effect (in red) that should show up according to the selection or de-selection of different objects on the scene, and I have a hover selection effect (in white) that, as the name suggests, should appear when I hover over the same objects with the mouse, and disappear when those objects are no longer being hovered. The hover outline should only appear when the selection outline is not already present for one given object.

Library versions used

  • Three: 0.146.0
  • Post Processing: 6.20.1
  • Spatial Controls: 5.0.8

Desktop

  • OS: Ubuntu
  • Browser: Chrome 110.0.5481.100
  • Graphics hardware: NVIDIA
@vanruesc
Copy link
Member

Hi,

OutlineEffect uses a Selection which relies on render layers. If you create multiple outline effects, they'll all use the same render layer (10) by default. To prevent the effects from interfering with each other, change the render layer of one of them:

outlineEffect.selection.layer = 11;

@vanruesc vanruesc added the support User support and general help label Mar 18, 2023
@rospuye
Copy link
Author

rospuye commented Mar 18, 2023

You're right, it worked! Thank you for your help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support User support and general help
Projects
None yet
Development

No branches or pull requests

2 participants