Asset store link
// Description
This is a fullscreen shader which uses raymarching through a texture to render clouds on screen.
// Contains
-A bunch of shaders and duplicates of Unity’s cginc for compatibility’s sake
-A c# script to attach to a camera
-Two materials, acting as presets for low and high quality
-A manual
-Four texture variant
-A bunch of editor scripts for the material inspector
// Requires
-GPU supporting Shader Model 3.0 (most GPU made after 2005)
-Unity 4.0+ (Older versions won’t compile).
// Limitations
-Performances: this can be a fairly heavy shader, performance hit is comparable to an ambient occlusion postFX but there are a ton of controls provided to reduce it.
// Media
Change log
// Version 3.5
Shape
- Cloud Flatness, controls the curve of the cloud to puff them out.
- Old ‘alpha’ from 2.x is back as Local Scale, scales cloud vertically within their boundary.
Shading
- Direct and Indirect lighting computation can now be entirely disabled to help performances.
- Base color is now effectively an albedo and Shading color now caps the minimum color.
- Changed normal intensity to shading intensity.
- Slightly changed how normals are calculated to retain more details.
- Scaled direct lighting and point light contribution by density to more accurately represent real lighting model.
- New silver lining feature and controls.
- Sky Occlusion Normalized to manipulate the size of the occlusion gradient.
- Occlusion Tint which, has its name implies, tint the occlusion.
UI
- Tons of property names have been changed to more accurately represent what they do.
- Minor UI presentation changes.
Raymarcher
- Changed how each samples are blended together, it now uses a proper front to back blending.
- Changed Step Size to min step size.
- New ‘Step Parallel Mult’ control, this scales the length of each steps when the camera ‘looks’ towards the horizon, helps with rendering distant clouds.
Breaking changes can be opted out of by clicking on the ‘New Shading’ toggle.
// Version 3.0
-
Rewrote the raymarcher entirely resulting in lower amount of steps required to render in the same or at a higher quality.
-
“Step Skip” and “Step near surface” have been replaced by a single different “Step Skip” property which adapts far better to cloud volumes.
-
Most of the lighting as been re-written as well and as such properties related to those have all changed how they influence rendering, affects the following properties: base color, shading color, normal map, normalized and normals intensity.
-
“Depth intensity” has been changed to “Sky Light Attenuation” and expanded into a color property.
-
Indirect lighting is now independent of the normal-map switch since it is no longer influenced by it.
-
New property : “Post Blend”, Controls how Distance Blend is computed, refer to the manual for more information.
-
New property for Screen Space Shadows : “Blend out of shadowmap”, toggle to filter screen space shadows out of the shadowmap.
-
New property for Screen Space Shadows: “Volumetric”, toggling it on makes shadows behave like previous versions, off will just use a projection instead which is far cheaper and slightly worse looking.
-
Renamed Density to coverage, it more accurately represent what the property controls.
-
Renamed alpha to density, same as above.
// Version 2.4b
Fix :
- Screen-space shadows
// Version 2.4
Additions/Modifications :
- Implemented spherical coordinate mapping as a secondary sphere mapping technique.
- Axis of alignment selector, you can now define which axis you want the cloud plane to align to.
- Clouds self-shadowing.
- Basic scene-view controls.
Fix :
- Normals are now more accurate at high density as well as under grazing light.
- A lot of minor shader and editor code refactoring.
- Shadows casting onto the far plane.
// Version 2.3
Added/Modified :
- Lighting computations are at least twice as fast now at the cost of an almost un-noticeable visual degradation.
- Slight improvement of some raymarching functions leading to a very small overall performance improvement.
- Variable to control clouds’s bases flatness.
Fixed :
- “Holes” in Single Pass VR.
- Compatibility with Unity 5.6.
Removed :
- Skip pixels controls ; was degrading most GPUs performance instead of helping because of how GPUs are architectured.
// Version 2.2a
Fix :
- MainLight error, support for Unity 5.5 standard shader.
// Version 2.2
Added/Modified :
-
Support for spherical mapping, perfect for atmosphere and planet rendering.
-
Support for point lights for unity 5.4 and above.
-
Supports unity 5.0 and above properly.
-
Rendering shadows only is now possible.
-
Rewrote access to Unity’s GI, should need no to minimal support for upcoming unity releases.
-
Created a new script called “CloudsEvent”, fires user defined events when entering and exiting clouds.
-
Changed material display to Plane instead of sphere.
-
Added multiple fields to give more controls over clouds :
-
“Normals Intensity” under normal map.
-
Spherical mapping controls : position and stretch horizon.
-
Orthographic Perspective, fakes perspective when rendering in orthographic.
-
Render plane offset from camera’s clipping plane.
// Version 2.1
Fix :
- Issues with draw distance being capped at one thousand.
- Toggle drawer drawing incorrectly on first inspector draw.
- Lighting issues caused by very high cloud density.
Added/Modified :
- File replacement for Unity 5.4+
- Texture based density.
- Modified light attenuation inside clouds and exposed controls for it.
- Further cleaned up the code.
- Slightly reduced branching as well as operations on shadow sampling.
// Version 2.0b
Fix :
-
Mac and OpenGL platforms compilation.
-
<5.0 Shader Model compatibility.
// Version 2.0
Fix :
- Texcoord not written by vertex shader.
- Random compile errors related to GI.
Features dropped :
-
Object space Mapping
With the new rendering system, object space is actually local to your camera which is not very useful, you still have access to x/z position offset under Cloud Transform z/w values -
Normals Direction inverting
It caused confusion and was never used anyway. -
Shader Forge Nodes
Instead of giving you the nodes I’ll actually write a tutorial on raymarching with shaderforge on the wiki in a couple of days, this means that you’ll have access to it without the need to buy my asset. -
Curved rendering
Most of the optimizations I took to render the clouds at a decent framerate don’t work as well if I render it curved, performance hit is more than 4 times the planar one.
I still have a second way to curve them to try out but that’s for another update since I don’t really have much time left.
New Features :
-
Slice based volume rendering dropped in favor of raymarching, this change comes with :
-
Better performances
-
Higher overall quality
-
Ability to render clouds from any angle
-
A whole bunch of variables to get an higher control over performances and quality
-
Ability to skip heavy calculations of 1/2 or 1/4 of the screen in a grid to help performances
-
Screenspace shadows
Post below from page 1 through half of page 5 don’t reflect the current state of this asset. Version 1.x had a geometry based rendering whereas 2.x uses ray marching, a ton of design issues encountered by the first are resolved by the later.