'depth texture' on ES2 doesn't seem to be updated while "Depth Fade" material node is in use

Our particle uses “Depth Fade” material node. The result is broken on Nexus 5.
The scene in problem, it seems to use the wrong depth texture.
The depth texture may rendered several seconds before, not now.

I found a workaround to prevent it by modifying ForwardShadeingRenderer.cpp.

		// Only these features require depth texture
		bool bDecals = ViewFamily.EngineShowFlags.Decals && Scene->Decals.Num();
		bool bModulatedShadows = ViewFamily.EngineShowFlags.DynamicShadows && GetShadowQuality() > 0 && bModulatedShadowsInUse;

		if (bDecals || bModulatedShadows || true)    // I modified here
		{

When I change this if statement always ture, the bug disappeared.
According the comment, depth texture will be updated if only decals and modulated shadows are in use.

I guess it should be updated if depth related material nodes are in use.

Thanks a lot!

Good find, you are correct. I’ll ticket that and get it fixed soon.

Thanks

Thanks for your reply:)

In addition, on LG GFlex 2 in the same scene is also something wrong but different from Nexus 5.

It seems like always applied 1 frame delayed depth buffer for “Depth Fade”. The result is the particles stencilled old position of characters in the screen space.

It also fixed when I modify above if statement always true.

Both Nexus 5(Adreno 330) and GFlex 2(Adreno 430) are Adreno GPU.

I’m glad to hear that!
Thanks for your cooperation.

Hi, any update on this topic?
We are going to fix our game soon.
Could you tell me if you found method to solve this?
Thanks!

If your game always uses “Depth Fade” you can enable that depth texture resolving permanently, just remove condition there as you did before. Proper fix will involve detecting that primitives we are going to render will actually use depth texture which is not that trivial as cases with decals and modulated shadows.

Thanks Dmitriy!

Do you have plan to release fix of it? I think applying official fix is the best way to solve it.

If the official release takes time, we may apply permanent depth texture resolving as you suggest.
So, are there any drawbacks like memory usage increase and/or extra instructions on GPU if we apply permanent depth texture resolving?

No, there is no memory increase. They way resolve is done right now is: we switch current framebuffer (scenecolor/depth) to a dummy 1x1 framebuffer and then back to original framebuffer, so device have to finish rendering and copy render targets from chip to memory. So that may add some extra frame time, but it’s hard to say exactly how much.
Currently fix is scheduled for 4.14 release.

It’s very useful information.
Our project is now requested optimization on both memory and speed.
So for now, adding hard coded switch is maybe ideal to keep better performance.
Thank you so much!