Skip to content

ZTest Does Not Work As Expected #3925

Description

@lxw404

Describe the bug?

The ZTest within several materials does not seem to behave as one would expect. Certain modes such as LessOrEqual, and Always seem fine, however every other mode does not.

Relevant issues

(none)

To Reproduce

The test setup is a PBSMetallic Box which overlaps halfway on a sphere with a UI_UnlitMaterial applied described similar to how Zyzyl tested in discord. This can be tested with any combination of materials that support ZTest with the same result as below:

Neos_cQ5NPYpn6C

Expected behavior

ZTest should normally behave as follows:

  • LessOrEqual - The object testing should be drawn if the Z buffer value is less than or equal to its current z value (normal occlusion)
  • GreaterOrEqual - The object testing should be drawn if the Z buffer value is greater than or equal to its current z value (draw only when behind objects or overlapping exactly)
  • Equal - The object testing should only be drawn when the Z buffer value is exactly equal to its current z value (draw on the edges of intersections)
  • Not Equal - The object testing should be drawn when the Z buffer value is not equal to its current z value (draw wherever there is not an intersection)
  • Always - The object testing is always drawn no matter what (ignore z values)
  • Less - The object testing is only drawn when the Z buffer value is strictly less than its current z value (only when completely in front)
  • Greater - The object testing is only drawn when the Z buffer value is strictly greater than its current z value (only when completely behind)

Log Files

No response

Screenshots

No response

How often does it happen?

Always

Does the bug persist after restarting Neos?

Yes

Neos Version Number

2022.1.28.1310

What Platforms does this occur on?

Windows, Linux

Link to Reproduction Item/World

neosrec:///U-LuxKitty/R-d9680e14-062e-488a-ad64-8812db67d5eb

Did this work before?

I Don't Know

If it worked before, on which build?

No response

Additional context

No response

Reporters

LuxKitty, Zyzyl

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions