All Projects → techizgit → Unityplayground

techizgit / Unityplayground

Experimental use

Labels

Projects that are alternatives of or similar to Unityplayground

Shadergraph examplelibrary
A library of Shaders created using Unity's Shader Graph.
Stars: ✭ 1,273 (+902.36%)
Mutual labels:  shaderlab
Smo Shaders
A collection of shaders to replicate those used in Super Mario Odyssey's Snapshot Mode.
Stars: ✭ 97 (-23.62%)
Mutual labels:  shaderlab
Otto
Otto sample project for the AI Planner
Stars: ✭ 113 (-11.02%)
Mutual labels:  shaderlab
Uimask
Stars: ✭ 91 (-28.35%)
Mutual labels:  shaderlab
Sigexam
Correction of a Shader Exam
Stars: ✭ 94 (-25.98%)
Mutual labels:  shaderlab
Normal Mapping For A Triplanar Shader
Example shaders showing different methods of implementing normal mapping for triplanar shaders.
Stars: ✭ 101 (-20.47%)
Mutual labels:  shaderlab
Photosynthesizer
Unity plugin to procedurally sprout foliage throughout your scene.
Stars: ✭ 85 (-33.07%)
Mutual labels:  shaderlab
2d Water Shader
2D Water Shader made in HLSL in Unity based on water effect from the game Kingdom
Stars: ✭ 126 (-0.79%)
Mutual labels:  shaderlab
Unitypixelartcamera
Easy pixel art camera rendering in Unity
Stars: ✭ 95 (-25.2%)
Mutual labels:  shaderlab
Raymarchinginhdrp
Stars: ✭ 112 (-11.81%)
Mutual labels:  shaderlab
Unity Basic Shader
Unity Basic Shader
Stars: ✭ 93 (-26.77%)
Mutual labels:  shaderlab
Dq Skinning For Unity
Stars: ✭ 93 (-26.77%)
Mutual labels:  shaderlab
Arcadevehiclephysics
A framework for creating an arcade inspired physics system for vehicles in Unity
Stars: ✭ 103 (-18.9%)
Mutual labels:  shaderlab
Iridescence
Iridescence shader
Stars: ✭ 89 (-29.92%)
Mutual labels:  shaderlab
Unity fps
Project and asset files for FPS Unity game.
Stars: ✭ 117 (-7.87%)
Mutual labels:  shaderlab
Unityvertexcolors
Stars: ✭ 86 (-32.28%)
Mutual labels:  shaderlab
Unitytoonshader
👾 Toon shader for Unity.
Stars: ✭ 99 (-22.05%)
Mutual labels:  shaderlab
Rcam
Real time volumetric video capture for live visuals
Stars: ✭ 128 (+0.79%)
Mutual labels:  shaderlab
Lwrpshaders
A collection of high customizable unlit shaders for Lightweight Render Pipeline
Stars: ✭ 125 (-1.57%)
Mutual labels:  shaderlab
Optically Realistic Water
A Unity port of Martins Upitis' fantastic ocean water shader, which was originally coded in GLSL for Blender.
Stars: ✭ 111 (-12.6%)
Mutual labels:  shaderlab

Unity Playground

Ocean Shader

Wave Simulation

Using 12 groups of Gerstner wave with different wave length to form the shape of surface, each group has 6 single Gerster wave with different direction. The calculated displacement data will be applied on a 400x400 plane mesh after in the ocean vertex shader. The calculating process is done in another shader, and we can change this method to FFT (using the spectrum of real world water waveforms) to get more accurate result of the surface shape.

Reflective Color

In this part I still used the method of mirror reflecting. Basically we need another camera which is placed in a symmetrical position of the main camera relative to the water surface, and use the render texture of this camera to simulate mirror reflection. To avoid reflect objects under water which can produce false result, we need to change the near clip plane of the mirror camera by using cam.CalculateObliqueMatrix(clipPlane) to calculate a camera projection matrix with its near clip plane setting to clipPlane and passing this new matrix to the camera. Then we use the world space normal's XZ component to distort the UV, and use the Y component of fragment world position to adjust the sampling point of the reflection texture to simulate the wave height. It looks good until we apply a very big wave onto the water surface, but this approximation is good and simple enough.

Refractive Color

This part I used GrabPass to get the transparent texture under water. Still, I used world space normal's XZ component to distort the UV,and then use the view ray depth in water to decide the "transparency". However we need to fix this:

This is caused by false distortion of background above water. So after distortion we need to sample the ray depth in water again to remove the false distortion. If the depth is smaller than 0, it means that this sampled point should be "above water" so we need to remove the distortion effect.

Shallow Water Scattering

First we need to have a height map to tell us which part of the water is shallow. At first I simply exported the 8-bit height map from terrain in Unity and did some processing in Photoshop, but then I realized the precision is really low because we have only 4~5 height magnitude near the surface. Besides, after modifying the terrain we need to remake a texture again, which is annoying. So we can put a orthogonal camera above the terrain with culling mask only set to terrain, then pass the render texture to water shader. The generated height map looks like this:

Then we give additive light to shallow parts of the water:

Fake Sub-surface Scattering

This part I referenced the following page: GDC 2011 – Approximating Translucency for a Fast, Cheap and Convincing Subsurface Scattering Look Simulating the sub-surface scattering makes our water "clear" and "transparent". The basic calculating method can be explained by the following picture:

This simulate how light can "go through" the material then go into our eyes. Before and after applying this effect, the water looks like:

Specular

Not much to talk about in this part. Simply used Phong specular.

Fake Water Surface Shadow

This part basically talks about how to give correct surface color rather than simulate shadow. When water surface cannot receive the light from the sun, we should not add the sub-surface scattering to our final result. Or the result would look like this: We can notice that the surface is very bright but, unnatural. But the water render queue is set to transparent, how can we get the surface shadow? Now we have to remove this effect by sampling a shadow render texture from another shader, with an invisible plane to receive the shadow.

And one more thing, we also need to fix the specular using similar technique. Now we have the correct result:

Whitecap(not completed)

We use Jacobian determinant of the displacement XZ component to calculate how much "tearing" is happening at one specific point. The more "tearing" happens, the more foam and whitecap should appear.

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].