All Projects → yangrc1234 → Volumecloud

yangrc1234 / Volumecloud

Licence: mit
Volume cloud for Unity3D

Projects that are alternatives of or similar to Volumecloud

Skeletalgeometriceffects
Experiments on geometry shader instancing with skeletal animations
Stars: ✭ 436 (-3.75%)
Mutual labels:  unity3d, shader
Miniengineao
SSAO image effect from Microsoft MiniEngine, ported to Unity.
Stars: ✭ 448 (-1.1%)
Mutual labels:  unity3d, shader
Depthinverseprojection
An example showing how to inverse-project depth samples into the view/world space in Unity.
Stars: ✭ 296 (-34.66%)
Mutual labels:  unity3d, shader
Uieffect
UIEffect is an effect component for uGUI element in Unity. Let's decorate your UI with effects!
Stars: ✭ 3,449 (+661.37%)
Mutual labels:  unity3d, shader
Stablefluids
A straightforward GPU implementation of Jos Stam's "Stable Fluids" on Unity.
Stars: ✭ 430 (-5.08%)
Mutual labels:  unity3d, shader
Rdsystem
Reaction-diffusion system with CustomRenderTexture.
Stars: ✭ 271 (-40.18%)
Mutual labels:  unity3d, shader
Spheredissolve
Customizable procedural spherical dissolve shader for Unity3D, for all your customizable procedural spherical dissolve needs!
Stars: ✭ 311 (-31.35%)
Mutual labels:  unity3d, shader
Noiseball2
A small example of procedural modeling with compute shaders.
Stars: ✭ 215 (-52.54%)
Mutual labels:  unity3d, shader
Water2d Unity
A simple shader + example of a water surface with reflection in 2D
Stars: ✭ 335 (-26.05%)
Mutual labels:  unity3d, shader
Skyboxplus
Basic skybox extensions for Unity
Stars: ✭ 324 (-28.48%)
Mutual labels:  unity3d, shader
Unlitclouds
A unity cloud shader, using vertex colors and tessellation for a simple stylized look.
Stars: ✭ 110 (-75.72%)
Mutual labels:  cloud, shader
Grassbending
A replacement for Unity's terrain grass shader with alpha blended rendering and touch bending effect
Stars: ✭ 397 (-12.36%)
Mutual labels:  unity3d, shader
Videoplayereffects
Experimental special effects for VideoPlayer (Unity 5.6 new feature)
Stars: ✭ 252 (-44.37%)
Mutual labels:  unity3d, shader
Unity Script Collection
A maintained collection of useful & free unity scripts / library's / plugins and extensions
Stars: ✭ 3,640 (+703.53%)
Mutual labels:  unity3d, shader
Contactshadows
Experimental implementation of contact shadows for Unity.
Stars: ✭ 219 (-51.66%)
Mutual labels:  unity3d, shader
Standardgeometryshader
An example of a geometry shader with Unity's standard lighting model support.
Stars: ✭ 303 (-33.11%)
Mutual labels:  unity3d, shader
Unity Shaders
✨ Shader demo - More than 300 examples
Stars: ✭ 198 (-56.29%)
Mutual labels:  unity3d, shader
Shinyeffectforugui
Shiny effect of uGUI, which does not need mask or normal map.
Stars: ✭ 204 (-54.97%)
Mutual labels:  unity3d, shader
Unitygraphicsprogramming
書籍「UnityGraphicsProgramming vol.1」のサンプルコードリポジトリ
Stars: ✭ 321 (-29.14%)
Mutual labels:  unity3d, shader
Retro3dpipeline
A minimal example of a custom render pipeline with the Retro3D shader.
Stars: ✭ 354 (-21.85%)
Mutual labels:  unity3d, shader

Volume Cloud for Unity3D

This project won't be maintained in the future, since to work with modern Unity(HDRP, URP) there's too much work has to be done. And I have no intention to make it look better or more features either(I mainly use UE4 for now).

But still, if you have any idea or problem about volume cloud, I'm glad to hear them and share my thought!

Cloud at dawn.
Cloud forms a hole in the sky.
A huge cloud at distant.
Cloud view from above. With the hi-height(name from hi-z since they're similar) technique, a much larger view range could be used when rendering cloud. The screenshot is rendered with my atmosphere scattering system(Here)
(The ap system is just my hobby project, not optimized at all. It's included in this repo, use it at your own risk).

Volume Cloud for Unity3D is a plugin for rendering cloud using raymarch. For now only compatible with standard rendering pipeline.

Quick startup

Clone the repo, find three screenshot scenes under folder in Assets/VolumeCloud/Example, and you should see the cloud right away.

Performance

The benchmark here is done in Unity Editor (Sorry for my lazyness), on my laptop with GTX 1060 6G.

The time is measured from stats panel in Game window.

Two tables are listed, with the first set to same options used to render screenshots at top, to show the performance under generic usage.

Scene Quality DownSample Hi-Height enabled Time Comment
Screenshot1 Low Half True 1.0ms
Screenshot2 Low Half True 1.0ms
Screenshot3 Low Half True 1.1ms
Screenshot4 Low Half True 5.0ms Above cloud layer, many hi-height lookups

Here the second list is set to render at full resolution, to better show how each option affects performance.

Scene Quality DownSample Hi-Height enabled Time Comment
Screenshot1 Low Full True 9.0ms
Screenshot1 Low Full False 7.2ms
Screenshot1 High Full True 10.0ms
Screenshot4 Low Full True 11.5ms Above cloud layer, many hi-height lookups

Customize

This section shows you how to setup and adjust the shape and looking of the cloud to fit your own need.

Camera Script

  1. Attach VolumeCloudRenderer to your camera. It's advised to put it before any post processing scripts. Once you add the script, the values in Inspector be filled with default values, and you should see effect right away.
  2. Adjust rendering settings.
  • DownSample option let cloud rendered into a low-resolution buffer, which greatly saves gpu performance. Setting to 1 means half the resolution, and 2 for quater.
  • Quality option controls the sample count during raymarching. Lower quality only does half samples than high quality. Some noise pattern are visible when using low quality.
  • Allow cloud front object. Turn on this option so that cloud could be rendered in front of object, but this brings a little artifact when object moves around. If you're sure your camera won't go into cloud, uncheck it.
  • Use Ap system. Check this only when AtmosphereScatteringLutManager script in scene. (It will have impact on performance, since the atmosphere scattering system is not very optimized. I only used it for the screenshot.)
    The script has a config parameter. Create a new config by rightclick - Create - Volume Cloud Configuration. By default there's a config file under Assets\VolumeCloud\Example.
    There're many paramters you can tweak in the config file. Most of the params are intuitive enough to play with.
  • Use Hi-Height Map. Check to enable Hi-height map feature. The Hi-height map is an empty space skipping technique. It could help extending the view range above cloud layer, skipping lots of samples when there's no cloud with some extra 2D texture lookups. It introduces some overheads, but saves the sample count required to render distant cloud.
  1. Adjust cloud properties in the config file. See below.

Cloud Configuration

Most cloud properties are seprated from the script into the config asset for reuse.

The default config in example should be nice enough to use. If you want do more control, continue reading. The most important options are listed below. Other options are not important or intuitive enough.

Weather map

The weather Tex tells the renderer how does cloud formed over sky. It's most important if you want to adjust your sky.

RGB channles are used, R channel for cloud coverage. G channel for wetness, and B for cloud type(see below).

For now there isn't an automatic way to generate a weather map, just paint it yourself, or use those in example.

Height-Density Map(Idea from [4])

Height-density map describes the density of your cloud at specified height and type. X-axis for cloud type used in weather tex, Y-axis for height.

On the R channel, density is set for corresponding cloud type and height.

On the G channel, a detail value is set for corresponding cloud type and height. Higher the value, more "round" will the cloud be.

Shape / Shape-Detail / Shape-Curl

The basic idea of volume cloud rendering is raymarch though 3D cloud-like noise texture. Here two textures are used, naming base texture and detail texture. The cloud shape is formed from base texture, then subtracted by detail texture. Also, a curl noise is used to offset detail texture sampling, to provide a turbulence-like effect.

Adjust corresponding settings will affect how sampling is done.

Shape Modifiers

These are global modifiers for some values. Just leave them for 1.

Lighting

The cloud lighting contains ambient light and directional light color contribution.

Ambient color is directly added to final result no matter what.

Scattering/Extinction coefficient are used to adjust how directional light affects cloud. Extinction describes how much cloud receives light, and scattering describes how much cloud scatters the light. Extinction value should never be greater than scattering value unless you want a non-physical effect(Or, the cloud in your game can glow).

The multi-scattering section contains parameters for simulate multi-scattering effects. The idea is from [4]. Hover your mouse over the label for more info.

Lighting - Silver

This value controls how does the silver effect spread over cloud. Lower value causes silver effect more concentrated around sun and brighter.

Lighting - Atmosphere

These settings simulate aerial perspective effect for distant cloud. Cloud color is modified with following code:

float atmosphericBlendFactor = exp(-depth / _AtmosphereColorSaturateDistance);
result.rgb = lerp(_AtmosphereColor, result.rgb, saturate(atmosphericBlendFactor));

Wind

Wind effect simulates the cloud moving by rotating the noise texture. So the overall cloud position won't be changed.

Known issues

Nothing yet.

TODO

  • [x] Add aerial perspective things.
  • [x] Extend view distance above cloud.
  • [ ] Cloud shadow implementation.
  • [ ] HDRP integration?
  • [ ] Weather map generator.
  • [ ] Make the noise generator usable.

References

[1]The Real-time Volumetric Cloudscapes of Horizon: Zero Dawn
[2]Nubis: Authoring Real-Time Volumetric Cloudscapes with the Decima Engine
[3]TAA from playdead
[4]Physically Based Sky, Atmosphere and Cloud Rendering in Frostbite
[5]Cool TAA history clip from zhihu [6]Bilateral upsample code from SlightlyMad/VolumetricLights

Implementation Details

If you're intersted in how volume cloud is implemented, see the references. Or if you're intersted at what improvements I made and how, refer to the IMPLEMENTATIONDETAIL.md at root folder.

History.

18/4/15 - Fixed "band" glitch.
18/7/7 - Added low-resolution rendering.
18/10/28 - Added Height-Density map from [4]
19/3/2 - Added depth estimation stuff, reduced blur problem when rotating camera.
19/3/4 - Rewrite lighting code, using methods from [4], it should be very "physically based" now.
19/5/18 - Rewrite raymarch and TAA. The 4x4 pattern is obsoleted. A full-screen raymarch with much lower sample count and temporal reprojection is used now.
19/5/31 - Hi-Height technique implemented.
19/6/25 - Rewrite shape function, the "cauliflower" shape is more visible now. Fixed object edge glitch when downsample is used.

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