Overlay objects

What would be the best way to render overlay objects, or objects that render on top of other geometry in 3D?

Original Post on Discord

by user 943936853348855838

Maybe by rendering a separate scene / group without clearing the render buffers (or z only) in onAfterRender or disabling depth testing if thats an option and the overlay objects are already sorted.

Theres also renderOrder in threejs. I think we export that from Unity too from the material but am not 100% sure right now

What version of Unity were the samples done in? I am trying to look at the Stencil Sample, but when upgraded to 2021.3.12f1 all the custom layer information is gone so can’t really see what is going on. Is that how I should manage the objects using a RenderObject Feature?

by user 943936853348855838

2020.3.x

Sorry a little new to the RenderObjects and advanced rendering stuff in URP.

by user 943936853348855838

Yes thats controlled via the Layers.

Weird it is not working for me for some reason. I will pull down the repo again and open in 2020.3. When opening it said it was an unknown version for some reason in Hub.

by user 943936853348855838

Yeah this is what I am seeing when trying to clone through GitHub desktop, in Unity Hub. If I try switching versions it shows the second image.


unknown.png

by user 943936853348855838

Oh thats weird. Its 2020.3 tho. Thanks for letting me know will check why that is tomorrow

Mmh the ProjectVersion.txt says 2020.3.33f1 tho

I will update to that and try

by user 943936853348855838

Okay that is why I opened the “needle-engine-samples” in Hub not “needle-engine-samples\projects\Needle Engine Samples 2020_3”

by user 943936853348855838

Oh haha i see

I didn’t notice sorry

No poblem

by user 943936853348855838

User error on my part

by user 943936853348855838

Okay, now everything is working with Hub accessing the right folder.

by user 943936853348855838

okay I got it 90% where I need it. Only issue is the Shadow Catcher is rendering on top. Any ideas on why that might be happening?

I got lucky in random testing and got it working with a combination of RenderObjects and a script to set the needed values. My first TS code and I managed to make it work.

import { Behaviour, serializeable, Renderer } from "@needle-tools/engine"; export class ImagePlane extends Behaviour { // this will be a "Transform" field in Unity @serializeable() renderOrder: number = 1; @serializeable() depthTest: boolean = false; @serializeable() depthWrite: boolean = true; start(){ const imgRender = this.gameObject.getComponent(Renderer); imgRender.renderOrder = [this.renderOrder]; imgRender.sharedMaterial.depthTest = this.depthTest; imgRender.sharedMaterial.depthWrite = this.depthWrite; } }
unknown.png
unknown.png

by user 943936853348855838

Okay it looks like this was resolved when I switched to a material set Transparent instead of Opaque

by user 943936853348855838

@Marcel_Wiessler1 :cactus: And apparently this breaks, ie the objects disappear, in AR. Any thoughts on what might cause that?

by user 943936853348855838