Translucent 2 sided material with 100% solid opacity

Ok so I’m coming from UDK and I have a material that I set up as Translucent and 2 sided, and I use a parameter to fade between 50% translucent and 100% opaque. (It works in UDK.)
However when setting up the same material in Unreal 4, the back polygons are showing up in front of the front polygons. seems the sorting order is screwy in Unreal 4.
If this is some kind of rendering limitation in Unreal 4 than I suppose I’m screwed. but yeah I hope there is some kind of work around someone could point out, because a lot of the game I’m working on requires this feature to function.

Notice the back and side walls render in front of the front wall (with 100% opacity), they are behind the front wall)
wow.PNG

I’ve also looked into the dithering method, but it does not render translucent objects behind one another.

Tranclucent objects does not write depth so depth testing between object is not going to work.

OMG ! Seriously?! that’s so bad ! I know UDK also didn’t seem to do that between objects, but it seemed to work on itself in UDK, wow talk about a step back. Sigh, What am I going to do now ?!

Tranclucency is always worked exactly like that. Depth buffer can only contain single value per pixel. If translucent material would write depth then it would not render anything behind it. This is unsolvable problem without unbound memory requirements.

I got lucky with udk than somehow?

The solution is called order independent transparency. It is fantastically expensive and complicated to implement with many possible but imperfect solutions, and only a couple games have ever shipped with it as far as I am aware.

The only practical approach is to sort objects by distance, so they are painted back to front. This happens by default with translucent objects, and can be turned on for particle systems, but it will not work for the faces of a single mesh. You would need to split the object into separate meshes.

You can also sort the triangles in your model such that they always render in the correct order, for certain shapes.
Even for shapes where it’s not 100% possible, it is often good enough.
The trick is to use a 1-sided material, and split the front/back sides of the geometry into two separate triangles, and sort those triangles in different order.

I don’t know at all if the Unreal importer has the option to partially order the imported triangles, but it’s a pretty common feature, so I’d be surprised if it didn’t.

I noticed that older games i.e. on the N64 had a lot of gorgeous objects that appeared to have some 2 sided transparency that lacked this issue. If the problem is as pervasive and unsolvable as you’ve said, how were they able to overcome it back then?

If object does not have any triangle intersections you can sort triangles and render them from back to front. You can pre sort per axis direction and use multiple index buffers and choose one based on view vector. But this does not work when you have any overlapping transparent geometry. There are tricks that can be done but for perfect results you need to sort per pixel.

One approach that works only for convex meshes is to not actually draw two-sided, but draw backfaces first, then front faces. The simplest code-free way to implement this is to make two copies of your mesh, one with the normals flipped, and give it a lower sort priority.