Download

Shadow Map Material Function

Shadow Map Material Function

Marketplace: Link
Documentation: Documentation
Example Project: Github

https://github.com/quickzero/ShadowMapMaterialFunctionExample/raw/master/Featured Image_01.jpg

  • Independent shadow system, draw dynamic shadow by material function without light.
  • Work well without [Mobile HDR], [Mobile HDR] is necessary for [Modulated Shadows] of UE4.
  • Work well with [GoogleVR], [GoogleVR] must disable [Mobile HDR].
  • Enable [Mobile HDR] is OK.
  • Shadow caster can recive shadow. (Self Shadow)
  • Good performance for slower mobile device.
  • Good compatibility for old mobile device.
  • Supported Windows, Mac, iOS and Android.

Android Benchmark APK:

Content:
ShadowCaptureBP :
Blueprint Actor, place to scene to capture shadow, follows location of [ShadowMapTargetComponent], X-axis of ShadowCaptureBP is virtual light direction.

ShadowMapTargetComponent :
Component, ShadowCapture follows location of ShadowMapTargetComponent.

CastShadowMapComponent :
Component, Actor with this component cast shadow.

ShadowMapMultiply :
Material Function, material with ShadowMapMultiply recive shadow;

Features:
1.Shadow Mapping depth comparison.
2.Shadow Map Antialiasing by Percentage-Closer Filtering.
3.Pack depth float into a RGBA render target texture, compatible with older mobile device.

Number of Blueprints: 1
Number of C++ Classes: 5
Supported Devlopment Platforms:Win64, macOS
Supported Target Build Platforms: Win32, Win64, macOS, iOS, Android

Quickstart:
1.Create a map which have a DirectionalLight.
2.Add ShadowCapture to scene and edit ShadowCapture propertys.

  • Shadow Map Quality : Set shadow map resolution.
  • Shadow Region Size : Set area size effected by Shadow.
  • Shadow Color : Set shadow color.
  • Direct Light : Select DirectionalLight referenced by ShadowCapture, ShadowCapture will follow rotation of DirectionalLight.
  • Auto Find Direct Light : If Direct Light is null, find a DirectionalLight in the world.
  • Lock World Location of Pixel : Decrease shake of static shadow caster.
  • Force Pack RGB : Use RGBA format shadow map replace R32F format.

3.Attach CastShadowMapComponent to Actors which cast shadow.
4.Attach ShadowMapTargetComponent to Actor which be followed by ShadowCapture.
5.Add ShadowMapMultiply node in material which recive shadow, it should be the final node before Base Color.

Note:
When deploy on iOS, please modify r.MetalVertexParameterSize and r.MetalPixelParameterSize to 100.
Location is Window -> Developer Tools -> Device Profiles -> iOS.
After modity values, Press Save as Default.

Thank you for this plugin.

But this tutorial is missing things like:
How do I set the light? Should shadows be set on or off? Should the directional light be static or movable (stationary)?
ShadowCaptureBP has to be used to create a new BP that can be inserted to the scene.

Furthermore I am facing a problem with it:
When I package the project for Android, some of the objects flicker.
I get a warning in packaging process, saying:
UATHelper: Packaging (Android (ETC2)): C:\Program Files\Epic Games\UE_4.20\Engine\Plugins\Marketplace\ShadowMapMaterialFunction\Source\ShadowMapMaterialFunction\ShadowMapMaterialFunction.Build.cs: warning: Referenced directory ‘C:\Program Files\Epic Games\UE_4.20\Engine\Source\ShadowMapMaterialFunction\ShadowMap’ does not exist.
PackagingResults: Warning: Referenced directory ‘C:\Program Files\Epic Games\UE_4.20\Engine\Source\ShadowMapMaterialFunction\ShadowMap’ does not exist.

Would this plugin work with ARCore? I’m trying to make real-time shadows from the objects.

Thanks