[SOLVED]Color write disables depth?

I have this minor problem, something I don’t understand.

2 models:


Both are in opaque render bucket, both write and test depth, runs totally as you’d expect

I disable the color writing for the building, hoping for an invisible item that still writes depth and blocks the character when behind it. Does not work, character shows up. When I set the character to the transparent bucket it works as I wanted.

Here are some screenshots showing the different situations:

(Character in same place half behind a pillar in all screenshots)

The building is in opaque unless otherwise stated. Why does it not block without the character in transparent?

I ask partly because I just want to understand whats going on, but also because having the character in the transparent bucket is gonna cause me some problems later on when I add partly transparent textures like hair that need to be in transparent alone.

With the default geometry comparator setup, objects in the opaque bucket are rendered front to back.

When you aren’t writing color for the building then it’s very important that it gets drawn first.

Edit: given the way your scenes work, you probably want to take more control over your geometry sorting either by borrowing Lemur’s layer based comparators or writing your own.

1 Like

I understand now; if the player was drawn first then the building never wrote color on top of it.

I started with a copy of the Opaque comparator and got the building drawn first. Thanks for the help

With Lemur’s layer comparator you can control it just be setting a “layer” user data. But then you’d have to set a “layer” on everything you wanted drawn later.

A custom comparator (as you’ve done) may be simplest because then you can key off just the ones you want drawn first.

Glad you got it working.