DisplayConduit - Depth Testing - Ignore Ground Plane?

Hello,

In my custom display conduit I am drawing sprites that I want to utilize depth testing and not show when behind objects, however, I want them to still show on top of the GroundPlane, is this possible?

What DrawForeground gives me with DepthTesting = True:

What DrawForeground gives me with DepthTesting = False:

What I need it to look like:

Relevant code:

def DrawForeground(self, e):
    if e.Viewport.Name != UI.viewport.ActiveViewport.Name:
        return

    sprite = UI.sprite_icons.get('sprite', None)  # Get the cluster sprite bitmap
    if UI.cluster['count'] == 1:
        if sprite: # Draw Sprite bitmap representation of icon
            e.Display.EnableDepthTesting(False)  # Disable Depth Testing so that the next elements that get drawn to through everything
            e.Display.DrawSprite(sprite, UI.cluster['center'], UI.sprite_size, False)

I would turn off the ground plane but I need to display it so that’s not an option.

Thank you all for any pointers you can provide!

Hi @michaelvollrath,

below seems to work. It draws sprites with depth so other objects occlude them but the groundplane does not occlude if the sprite is located on or below the it. I had to disable shadows for the sprite drawing, otherwise it would cast a shadow on the groundplane or other objects:

def PreDrawObjects(self, e):
    e.Display.DisplayPipelineAttributes.ShadowsOn = False
    for pt in self.Points: 
        e.Display.DrawSprite(self.Bitmap, pt, 50.0, False)

_
c.

1 Like

Thank you @clement , this appears to be the solution I need here. Thank you so much!

I do need to keep shadows on though as I utilize them elsewhere.

I wish I could flag the shadow casting per object such as turn off shadows for sprites only… I think I can do that but need to figure out where.

you might try to replace this line:

e.Display.DisplayPipelineAttributes.ShadowsOn = False

with this to get rid of the sprite shadows only:

e.Display.DisplayPipelineAttributes.DisableConduits = True

I’ve not tested this much, curious how it affects other draw events in your custom conduit ?
_
c.

1 Like

Thanks @clement,

I’ll give this a try and report back!