Download

UE4.26 - Translucent material on top of another, causes the one on top not to show, why?

Hi I created a piece of cloth, 1 single mesh, it has 3 translucent fabric layers, middle front and back,

well, translucency works fine with the material in the middle, but If I add the same material for the layer on top and back, they don’t show up, I can only see the one in the middle, the material is correctly set to two sided, If I kind of move the camera behind the top layer looking to the outside I can see the translucent material, but once the camera renders the 3 of them I can only see the one in the middle.

image

I thought this was caused because of translucent priority, but since it is the same mesh… I can only raise priority to the entire mesh, I can’t increase it just for the top and back layers.

I also tried with “masked” instead of translucent and all shading models… but, masked causes sharp edges and no transparency.

What can I do?

In order for masked to emulate a translucent material you need to use the DitherTemporalAA node with your texture plugged into the alpha threshold.

Transparent materials come with a sort priority.
Look up the docs.
Chances are you just need to sort who lives on top for the engine to render it right.

Is it possible to do priority sorting within the same mesh?

Yes and no.

It’s way easier to just split the mesh up into 2 and deal with the priority.
(Good catch on the fact I didn’t read the post though ;P)

The alternative is to change the depth at the material level.

This can be done. It’s done regularly for Grstner waves to render correctly.

It’s Pixel sorting so it is more expensive than say splitting the mesh up in 2.

You can find different solutions for how it’s done inside the Community Ocean project.

Also the water shader does it in hlsl so you could poke around the .usf and pull out a custom node made from it that will likely perform better (remains to be seen in practice).

Thank you so much, dithering made the trick for the masked material to become transparent… I wish it had work as easy with the translucent material, but which is actually worst for FPS? masked materials with dithering or translucency?

One extra problem now: since this is a cloth mesh, it should move fast sometimes, and dithering causes a bit of translucent noise or dots when moving, how to fix that?

Dithering is MUCH less expensive than translucency. Translucency also gets increasingly more and more expensive with each layer of it you are looking through, 3 layers of lit translucency can be extremely expensive depending on how large it is on screen.

In regards to the noise, there’s not really a good solution for this as it’s just how dithering works. By setting randomness to zero you can make the dithering a fixed pattern but you won’t be able to fully eliminate it. Disabling TemporalAA can also eliminate any smearing you may have.

You could try using full translucency with the solution MostHostLA posted above, but I’ve not tried it so I can’t comment on how involved it is.

The sorting, not particularly. It kind of depends on if this stuff works for it off the bat or if you need to poke into the community project for it.

And

Let’s call that a fat finger copy paste? Lol
It’s a different kind of depth test.
The right one
Should be mentioned in the same thread.

Actually that is pretty much it. Except that transparency can write in the depth buffer so there’s no need for 2 meshes nonsense.

I would suggest the community ocean and checking their functions.

In my water shader this was solved with a cusom node. And If I remember (who are we kidding. I can’t even remember what I pasted :P) it’s per-pixel…

WOW… I’m gonna start using less transparency and more Masking and dithering now! sometimes ocean materials are very expensive, my heavy scenes, lots of assets can drop in UE4 from 125FPS to 90FPS just because of water materials… even after disabling tessellation.

This post turned into a very interesting discussion.

There’s other stuff to consider.
For water specifically the engine based shader that was added in .24 or something similar is actually better than most of the community ocean project stuff / runs slightly faster (or it used to in .25).

The issue you ware having is for meshes, so I’d wager glass.

Shouldn’t mix the 2 in the same topic even if the solutions for one can definitely apply to the other.

Glass is usually better off transparent.
Water. depends on the scene.
Turning off transparency with LODs can also be a good idea (different material on the LOD).
If you make your own tiling water mesh - that becomes possible.

1 Like