While waiting for 4.5.0 to be officially released I had been spending some time in Unity.
And I had been learning CG script. (To a lesser degree)
One of things I found you could do is write 2 separate passes.
One that calculated with full alpha, and then the visible pass which has fresnel alpha, etc.
meant that the first front faces would cull all other front and back faces of the same object.
Much like how a ghost would appear.
I can’t for the life of me figure out how to do it.
I have an image that gives the idea of what I’m after.
Have you tried disabling Two-sided material rendering for your translucent material? If you do, UE should render nothing for backfaces, so the only visible elements of the material would be the outside (i.e. translucency should not let you see through the outside of the left half of the mesh to the inside of the right half, since the inside of the right half isn’t rendered at all.
**Hey Guys!
**
**RhythmScript:
**Everything you saw in the top image is actually all front faces. Two-sided is off.
Thanks for the reply though!
**:
**That looks like a perfect answer as to what I’m trying to achieve, however in terms of optimisation, I’m a bit worried.
I was going to be using on a skeletal mesh, so would I have to duplicate the entire moving mesh component?
(Would like to avoid basically doubling the vert and bone count for a simple Ghoul/Ghost)
Well You’ve come accross a fundamental problem in realtime rendering, especially in deferred renderers such as UE4.
If you have nested or partially overlapping meshes you can try and set the transparency drawing order manually to resolve the, but in a skeletal mesh where you can probably see all of its sides while it moves you’re gonna have to use a dynamic method such as the one alreday linked by .
True OIT (order independent transparency) is not implemented right now in UE4, and as every solution out there has drawbacks of some sorts, i think it will take some time until the epic guys figure out how to do it in an elegant way.
In the meantime you’re gonna have to use hacks.
To get to work with using the link I added earlier, you will have to create a blueprint with 2 of the same skel meshes with both at the same location (they will do by default when added), for the first one in the list apply your material as you have been, and for the second one, you will be applying a material that has no inputs (just a new blank opaque material, will default to totally black).
Now in the blueprint, with the second mesh selected, go down into the properties and change the settings to look like :
And that’s it, it should now work properly. Since it is a blueprint, you can simply drag and drop these into your scene. I would keep a copy of your original material and do some performance testing, for example place 10 of them in a scene, profile it, delete them, then place 10 of the blueprints into the scene and profile again. I am not sure how big of an impact there will be, but since the mesh is not actually rendered, it shouldn’t be too much (performance difference on mine was very minimal, maybe 1-2fps for a 2km square ocean plane with approx 40,000 tri’s).
Yes, every material that has would need to be modified in the same way unfortunately.
A depth prepass for an object is still drawing twice, but usually the whole object is drawn with the minimal amount of texture/material features as possible to reduce the load in the first pass as much as possible. So, the object you’re using to write depth should have a really simple material (you wont see it anyway) and then you only have the cost of rendering the geometry, not the textures. In your case it looks to be pretty low-poly, so it shouldn’t have a noticeable impact on performance.