[Lite] Depth / Transparency issue?

Hey gang! long time.

I’ve been messing around with Babylon Lite and i like it!
Just having a small depth issue with transparency and i can’t seem to figure out how to set it up properly..
In BabylonJs this would fixed:

Material.needDepthPrePass = true;

In Lite currently it will take more lines

You need a custom four-pass setup.

Create the scene with:

createSceneContext(engine, { defaultRenderTask: false })

Then add your normal meshes to the scene as usual.

For transparent materials, create a depth-only version with:

createStandardNoColorMaterialView(material)

Add the real transparent mesh to the transparent color task.

Add the same mesh to the transparent depth task, but use the depth-only material override.

Keep the render tasks in this order:

Opaque depth, opaque color, transparent depth, transparent color.

Do not add a separate depth-only proxy mesh directly with addToScene(). The depth-only material should only be used inside the depth render task.

Finally, call registerScene(scene) and startEngine(engine) normally.

Hey @labris
Thanks for the reply! That does work.

Very suddenly having an awfully complex index file just to render transparent meshes through :slight_smile: - I hope the team have more friendly support planned for the future :laughing:

Not necessarily :slight_smile:

The goal of Lite is perf and size. Not convenience :slight_smile:

That’s fair! :smile:

Is Labris’ solution how Babylonjs handles it internally?

pretty much yes!

Here is the helper with resize support - Babylon Lite Playground