Skip to content

NormalPass, SSAOPass: Enable passes to work with flat shading, back side material settings  #292

Closed

Description

@gkjohnson

Is your feature request related to a problem?

When setting a material to use "flatShading" or "BackSide" / "DoubleSide" SSAOPass does not currently work as expected because NormalPass does not respect those settings in the override material.

Describe the solution you'd like

NormalPass should use the "OverrideMaterialManager" and respect the original material "flatShading" and "side" properties.

Describe alternatives you've considered

None

Additional context

Here's a JSFiddle showing the current NormalPass results with the above material settings. The left cube uses "flatShading" with no normals while the right cube is using "side = BackSide":

https://jsfiddle.net/z4759qL8/1/

Thanks!

Activity

  1. vanruesc commented on May 9, 2021

    @vanruesc
    Member

    Thanks for the report!

    The NormalPass does make use of the OverrideMaterialManager and the side property should already be handled (see #265). The flatShading property is not supported yet. Handling this property will increase the amount of override materials from 9 to 18. This is, of course, awful, but I think this should be the last property that needs to be accounted for. The override material system is also about to become obsolete relatively soonish, now that the MRT PR has been merged.

    I'll publish a fix for flatShading soon.

  2. vanruesc commented on May 9, 2021

    @vanruesc
    Member
  3. gkjohnson commented on May 9, 2021

    @gkjohnson
    Author

    OverrideMaterialManager.workaroundEnabled = true;

    Oops I missed that this needed to be explicitly enabled. Thanks!

    The override material system is also about to become obsolete relatively soonish, now that the MRT PR has been merged.

    I'm pretty excited for the improvements that MRT will bring but how do you anticipate it removing the need for an override workaround system? Three.js' scene.overrideMaterial will still have the same limitations so I would think you'd still have to use a similar kind of workaround. But now you'd be able to use an override material that draws to multiple buffers at once, instead. Maybe I've misunderstood, though!

  4. vanruesc commented on May 9, 2021

    @vanruesc
    Member

    how do you anticipate it removing the need for an override workaround system?

    The workaround attempts to fix the shortcomings of the override material system, so it's only necessary because we use override materials. With MRT we should be able to render geometry data (normals, positions, roughness, etc.) into additional buffers during the initial RenderPass without having to re-render the scene with override materials. Since there are no other use cases for scene.overrideMaterial in this library, the NormalPass, DepthPass, LuminancePass and OverrideMaterialManager will eventually become obsolete.

    Three's current built-in materials are quite rigid and hard to extend. I think we still have to wait for NodeMaterials and declarative shader manipulation features to actually make effective use of MRT in the RenderPass.

  5. added a commit that references this issue on May 9, 2021
    edb04e1
  6. vanruesc commented on May 9, 2021

    @vanruesc
    Member
  7. gkjohnson commented on May 10, 2021

    @gkjohnson
    Author

    Three's current built-in materials are quite rigid and hard to extend. I think we still have to wait for NodeMaterials and declarative shader manipulation features to actually make effective use of MRT in the RenderPass.

    Yes I'm excited to see what Node materials bring. I think they'll be pretty enabling in a lot of ways.

    Thanks for the quick fix!

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