Alternatives Methods For Marking Priority Overlay On Objects

Anyway to easily priority-overlay marked objects at run-time? I am aware that 2D filters can do this, am looking for other alternatives. If possible, perhaps, a material node setup.

X-Ray Method (editor only)

Z-Offset Method (works both in editor and run-time but is glitchy with overlapping vertices)

It’s a bit hacky, but you could have a copy of the object on an overlay scene.

Or, use another way to highlight it, such as drawing boxes around it on an overlay scene.

I’ve used the z-offset method for this and never had an issue with it. Can you describe the glitchiness? This is the lowest-cpu/gpu cost solution

That or:

  • as TheDave pointed out, draw a box/crosshairs in overlay scene
  • composite in a render-to-texture of just priority objects

This method unfortunately does not support accurate environment shading/lighting.
I have even replicated all buildings into the overlay scene and passed on all transforms of the player into the overlay scene but it decreases performance rather understandably.

1 Like

Basically when polygons do not know which z-layer they are on, for instance polygon 2 is physically behind polygon 1, but renders above it never the less because they are all with equal z-offseting. I guess I could manually mark all mesh pieces with different z-offset priorities, but z-offset still does not blend with post-processing.

I know, that was why I was asking on your shader thread a few weeks ago. But I would like to find a non-GLSL option if possible. Not that I am inexperienced or anything, I would instead just prefer simplicity in this case.

what about using object color → seperate RGB → R to drive emission of the object ?

mix rgb node after your material node*

then to highlight, simply use python to set the object color- or a animation even

Sounds doable? Would you find dropping a demo blend-file of when you have time? Thanks.

Just want to point out that in case of the overlay scene, there is no need to duplicate the objects: you can simply select the object you want, the main camera (and the lights, if you want to), press Ctrl + L and link them to the overlay scene. It will make the exact same object exists in both scenes.

As you pointed out, tho, if an object casts shadows in the linked one in the main scene, the shadows will not gonna appear in the overlay version. If you link the lamps and use the same World (in the world settings) in both scenes, the result will be pretty similar.

Here is a demo (overlay):
OverlayScene-XRay.blend (539.6 KB)

1 Like

I’ve also experimented with this method in my projects, and I’ve found it’s not the best solution for several reasons.

For example:

I want to overlay some arms/gun(s) to a camera. If I link the assets into a HUD scene, they copy transforms from the other main scene’s parent object. This makes the overlay in a stationary sense, useless to me, as the assets are constantly and dynamically in motion, rather than stationary.

Sometimes, in some games, when the weapon is rendered over everything, and you get really close to objects, I get the illusion that the weapon is tiny and really close to the camera…

The normal weapon, in white, could be there to cast shadows. The tiny weapon has shadows disabled. I scaled it with the cursor at the camera location as pivot so it covers perfectly the big one. The shadows of other objects will be off sometimes and the ‘jaggies’ will be more noticeable given the size of the model, but I don’t know… just an idea.

So what you’re are suggesting is a simple, “parent double gun to camera” method? This still does not exactly solve the overlaying problem… Shading is not exactly the issue at the moment with duplicated objects.

As I said, the normal weapon could be there, for shadows, but there’s no need for it.
On the image you can see the normal-sized weapon clipping though the cube, but from the camera perspective the weapon appears to be overlayed. Naturally, if you get too close to the cube, it will clip through it too, but I assume the player has come collision that won’t allow the camera to get too close to objects.

On the matter of the Z-offset, if you change the alpha method to Sort, even if the material doesn’t have transparency, it helps prevent the issue you mention, to some degree.
Alpha opaque:
Alpha sort:

1 Like

Thank you… 6 years of frustration solved. You have my gratefulness.

1 Like