All Projects → ozlael → Plannarshadowforunity

ozlael / Plannarshadowforunity

Planar Shadow is very cheap and useful for mobile games.

Labels

Projects that are alternatives of or similar to Plannarshadowforunity

Museum
Live coding rig for Channel 18 at SuperDeluxe
Stars: ✭ 30 (-59.46%)
Mutual labels:  hlsl
Ray Mmd
🎨 The project is designed to create a physically-based rendering at mikumikudance.
Stars: ✭ 1,045 (+1312.16%)
Mutual labels:  hlsl
Shaderconductor
ShaderConductor is a tool designed for cross-compiling HLSL to other shading languages
Stars: ✭ 1,146 (+1448.65%)
Mutual labels:  hlsl
Computesharp
A .NET 5 library to run C# code in parallel on the GPU through DX12 and dynamically generated HLSL compute shaders, with the goal of making GPU computing easy to use for all .NET developers! 🚀
Stars: ✭ 982 (+1227.03%)
Mutual labels:  hlsl
Shaderc
A collection of tools, libraries, and tests for Vulkan shader compilation.
Stars: ✭ 1,016 (+1272.97%)
Mutual labels:  hlsl
Reshade Xhair
A heavily customizable, fullscreen-compatible crosshair overlay for ReShade
Stars: ✭ 57 (-22.97%)
Mutual labels:  hlsl
Dahaka S Enb
A Skyrim ENB preset with multiple weather settings.
Stars: ✭ 23 (-68.92%)
Mutual labels:  hlsl
Pbr proj
Shader of PBR for Unity
Stars: ✭ 68 (-8.11%)
Mutual labels:  hlsl
Fs2020 Vl3 Rotax915
JMB VL3 Racing 915 iS aircraft for Flight Simulator 2020.
Stars: ✭ 45 (-39.19%)
Mutual labels:  hlsl
C208 Msfs2020 Fix
Improvements to the Caravan in MSFS2020
Stars: ✭ 66 (-10.81%)
Mutual labels:  hlsl
Halomd
New demo version of Halo for the Mac.
Stars: ✭ 36 (-51.35%)
Mutual labels:  hlsl
Particlecloudvrc
Interactable shader-based particle system for VRChat/Unity
Stars: ✭ 38 (-48.65%)
Mutual labels:  hlsl
Nnao
Neural Network Ambien Occlusion based on http://theorangeduck.com/page/neural-network-ambient-occlusion
Stars: ✭ 57 (-22.97%)
Mutual labels:  hlsl
Computeshader Unity Macos
Stars: ✭ 31 (-58.11%)
Mutual labels:  hlsl
3d Game Shaders For Beginners
🎮 A step-by-step guide to implementing SSAO, depth of field, lighting, normal mapping, and more for your 3D game.
Stars: ✭ 11,698 (+15708.11%)
Mutual labels:  hlsl
Lwks Fx Bundle
Synced user effects pack
Stars: ✭ 21 (-71.62%)
Mutual labels:  hlsl
Sweetfx
Stars: ✭ 51 (-31.08%)
Mutual labels:  hlsl
Fluffie
Stars: ✭ 69 (-6.76%)
Mutual labels:  hlsl
Sgi
Stargate Invasion is a mod for Sins of a Solar Empire.
Stars: ✭ 67 (-9.46%)
Mutual labels:  hlsl
Jl S Unity Blend Modes
👾 Collection of Unity shaders that support blend modes like photoshop layer style (Darken, Multiply, Linear Burn, etc)
Stars: ✭ 62 (-16.22%)
Mutual labels:  hlsl

PlannarShadowForUnity

Planar Shadow is a kind of old school. But, it is very cheap and useful for mobile games. Unity’s default shadow system use Shadowmap. It needs more power of Pixel Shader and Render Targets. That means that Shadowmap system is expensive especially on mobile devices. Not only for Unity, other engins are the same.

Actually, the Planar Shadow is not real shadow. It is just a mesh. But, it looks like a shadow by pressing/projecting into plan using Vertex Shader. It doesn’t need much power of Pixel Shader. It uses a little bit of math, but, simple trigonometric function. See image below : P is a point of the mesh and P' is a point of the shadow.

image

float4 vPosWorld = mul( _Object2World, v.vertex);
float4 lightDirection = -normalize(_WorldSpaceLightPos0); 
float opposite = vPosWorld.y - _PlaneHeight;
float cosTheta = -lightDirection.y;	// = lightDirection dot (0,-1,0)
float hypotenuse = opposite / cosTheta;
float3 vPos = vPosWorld.xyz + ( lightDirection * hypotenuse );
o.pos = mul (UNITY_MATRIX_VP, float4(vPos.x, _PlaneHeight, vPos.z ,1));  

Detailed explain(Korean) : http://ozlael.tistory.com/10

Pros is : cheap

  1. Core part is only for VS. PS handles only color and alpha (plus, Stencil)
  2. You can use LOD mesh for shadows. While, Shadowmap(Unity’s shadow) have to draw original mesh twice at least.
  3. Shadow doesn’t looks blocky. Mobile devices have to use blocky hard shadow because they doesn't have enough power to use soft shadows.

Cons

  1. Only for planar floor.
  2. Only sharp edge.
  3. Use Stencil. But, It is not a big deal nowadays because mobile devices are support it.

image Sample asset : https://www.assetstore.unity3d.com/kr/#!/content/45319

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].