Hi, during the creation of my scene in Unreal Engine, I imported my tree which was perfectly fine and nothing was missing, but the moment I textured it and flew the camera a little further I found that the leaves were disappearing due to the distance I was looking for all over the forums and nothing helped me. But I found that the error was in the Opacity Mask. And since I was already desperate, I didn’t know what to do, but before that I tried to change one setting, which surprisingly worked.
Here is what work for me:
You have to go to your material (leaves) then click on Opacity Mask and on the left just below the material preview you have to find (Material Expression Texture Sample) there you will have 5 settings:
MipValueMode = MipLevel(absolute, 0 is full resolution)
Sampler Source = From texture asstes
Automatic View = Checked
Const Coordinate = 0
Const Mip Value = 0
I strongly recommend against setting the MIP value to always render at the largest level. This will make performance absolutely tank when you have more objects in the scene.
Instead, generate the MIP maps such that they work correctly with your asset. If the default MIP filtering ends up cutting out too many pixels, make the MIP levels have more opacity.
Or, perhaps better, use blending (translucency) instead of opacity mask. (Yes, this means you have to worry about sorting triangles. Nothing is free!)
Hi, thank you for your reply, yes I am aware that this will cause a load on the GUP and CPU. However, the problem is that this is the only setting that works for me. I don’t know if it’s a bug or I missed something. I tried basically everything I could find on the internet. Fortunately, the project I’m working on is only for a scene that will be rendered afterwards, it’s not a game that would require a lot of optimization.
As I said: the problem is likely that your cut-out (masking) mode and the alpha values in your texture don’t agree. This has been a common problem for foliage (and fences!) for graphics in the distance for a long time, in all game engines.
The solutions available are typically:
Use FSAA and 8x samples or better
Create MIP maps explicitly, with the alpha values set to not mask out too many pixels further away
Use translucent/blended instead of masked/cut-out blending mode
don’t be lazy and create light maps that use pixel corners so that mips just automatically always work…
Around 90% of marketplace stuff lacks this very basic Best Practice…
(at least they won’t accept your stuff if you don’t use power of 2 textures! XD)
And - because say you rendered hair out of blender, the opacity mask on that will never be right anyway - You can always bump mips up or down at the material level without forcing the highest possible.
PS:
Anyone reading this and wondering wtf do lightmaps have to do with anything.
You’d be right. This applies to any UV.
In this case, the one you use to bake from an actual object to a transparency map - On top of lightmaps…
If you want to be OCD about this, you place each UV corner in the center of an 8x8 pixel square. E g, if your DCC tool has an 8x8 grid when mapping UVs, each UV corner should be exactly in the center of each of those. This will give you three MIP levels of “crisp” filtering before you start blending with other nearby charts.