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

Use Mask without modifying existing material #2052

Closed
singlecoder opened this issue Mar 29, 2024 · 0 comments · Fixed by #2369
Closed

Use Mask without modifying existing material #2052

singlecoder opened this issue Mar 29, 2024 · 0 comments · Fixed by #2369
Assignees
Labels
Milestone

Comments

@singlecoder
Copy link
Member

singlecoder commented Mar 29, 2024

问题描述

当前 Mask 的实现,当设置 Renderer 的 maskInteraction 的时候,会修改 Renderer 的现有材质,对自定义 Shader 的使用有很大限制

重构目标

当一个 Renderer 需要 Mask 的时候,不论怎么设置 maskInteraction,都要保证其材质自身状态不被修改

实现思路

  • 当 Renderer 设置 maskInteraction 的时候,仅记录状态,并不修改其材质
  • 在渲染队列真正渲染的时候,如果需要触发 Mask,渲染当前 Renderer 前,临时修改材质状态,当渲染完后,立马还原,保证在其他地方的使用不受影响
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

1 participant