As seen in the pictures below, where we are using Distance Fields to procedurally apply foam to our water shader, this works perfectly on DX12 (image 1) but completely whites out in DX11 (image 2)
Hey! How are you using Distance Fields here? In the material?
Note that bSupportsMobileDistanceField is false on all mobile platforms (This includes PC Performance Mode) apart from Switch so you will have to protect those platforms from sampling Distance Fields. I’ll see if I can find out why DX11 is causing the issue.
Have you come across any errors on your materials in DX11? Does this reproduce in the editor if you pass -dx11 to the editor at startup?
// Kevin
Hey Kevin, yes, we’re using Distance Fields in multiple materials, some examples nodes we’re using are “DistanceToNearestSurface” and "DistanceFieldsApproxAO.
After further investigation, this can also happen in DX12, but not sure what’s causing it at all, it’s completely random.
No errors in the material either, and it doesn’t happen in editor either in DX11.
Okay, so we can’t seem to reproduce this issue in DX11 or DX12. However, my previous concern about Distance Field support on Mobile platforms still stands. DistanceToNearestSurface material node isn’t supported on Mobile platforms (you can enable Mobile preview in UEFN to see it fail there, or view the Platform Stats in the Material Editor).
Look for error
Failed to compile Material for platform PCD3D_ES31, Default Material will be used in game.
(Node DistanceToNearestSurface) Node not supported in feature level ES3_1. SM5 required.
in your log in that case.
To guard against that, you can use the DataDrivenShaderPlatformInfoSwitch node to route your distance field logic only to non-Mobile platforms. (you can also use ShadingPathSwitch for this).
Hope that helps!
// Kev
Hey! Thanks for the quick reply!
This must be a new node because it was not there last week, glad it was added.
Thanks a lot! We’ll definitely try it!