Raymarching Cleanup

Removed redundant code from raymarching implementation
Moved last remaining raymarching variable (Extinction) to environment settings
This commit is contained in:
Reinier Vens 2022-07-13 04:15:20 +01:00
commit d61d2f19ed
150 changed files with 187 additions and 8921 deletions

View file

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 4a05bb7e252ad90438c47651bf01d639
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 1160bd9542584c24f9b140d6356fd375
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,544 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 8
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 1147614136}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.056427088, g: 0.12670922, b: 0.296874, a: 1}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 9
m_Resolution: 2
m_BakeResolution: 40
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVRFilteringMode: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &7102893
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 7102896}
- component: {fileID: 7102895}
- component: {fileID: 7102894}
- component: {fileID: 7102898}
- component: {fileID: 7102897}
- component: {fileID: 7102899}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &7102894
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 7102893}
m_Enabled: 1
--- !u!20 &7102895
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 7102893}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 10000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 0
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &7102896
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 7102893}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -172.5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &7102897
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 7102893}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ff26db721962cdf4a8edcdfa9a767d2a, type: 3}
m_Name:
m_EditorClassIdentifier:
profile: {fileID: 0}
--- !u!114 &7102898
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 7102893}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 45d85419f2e23c540999c1a1fee6ed90, type: 3}
m_Name:
m_EditorClassIdentifier:
distance: 10
center: {x: 0, y: 0, z: 0}
scale: 1
distanceSpeed: 0.1
rotationSpeed: 0.1
--- !u!114 &7102899
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 7102893}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b535dacf702e20c4b9ef528e42081835, type: 3}
m_Name:
m_EditorClassIdentifier:
volumeTexSize: {x: 128, y: 128, z: 32}
--- !u!1 &74323546
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 74323548}
- component: {fileID: 74323547}
- component: {fileID: 74323549}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &74323547
Light:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 74323546}
m_Enabled: 1
serializedVersion: 8
m_Type: 1
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 4
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &74323548
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 74323546}
m_LocalRotation: {x: -0.03515344, y: -0.86159647, z: 0.50277907, w: 0.060241405}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 59.559002, y: -164.05801, z: 13.835001}
--- !u!114 &74323549
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 74323546}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 325c269146dc2ac49b190f730a961573, type: 3}
m_Name:
m_EditorClassIdentifier:
basePosition: {x: 0, y: 50, z: 0}
--- !u!1 &297555710
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 297555712}
- component: {fileID: 297555711}
m_Layer: 0
m_Name: GameObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &297555711
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 297555710}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e16dd2ddbdfa7ea4f87a3cfb032ffd0f, type: 3}
m_Name:
m_EditorClassIdentifier:
progressiveUpdate: 1
computeShader: {fileID: 7200000, guid: 2d4396a54b390d742b84d4bb4a122e54, type: 3}
outputDebug: 0
lutConfig:
transmittanceSize: {x: 256, y: 128}
scatteringSize: {x: 32, y: 128, z: 32}
irradianceSize: {x: 64, y: 32}
cameraVolumeSize: {x: 128, y: 128, z: 32}
atmosphereConfig: {fileID: 11400000, guid: 8e73e89daf00b8447b2410427953df25, type: 2}
--- !u!4 &297555712
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 297555710}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 2.736024, y: 2.8123064, z: -0.70711327}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!21 &1147614136
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Skybox/AtmosphereScatteringPrecomputed
m_Shader: {fileID: 4800000, guid: e2088dd19a71d1244976cd0de1ff68a7, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs: []
m_Floats: []
m_Colors: []
--- !u!1 &1729729729
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 1996505793}
serializedVersion: 5
m_Component:
- component: {fileID: 1729729730}
m_Layer: 0
m_Name: Missing Prefab
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1729729730
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 1996505793}
m_GameObject: {fileID: 1729729729}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1764631964
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1764631968}
- component: {fileID: 1764631967}
- component: {fileID: 1764631966}
- component: {fileID: 1764631965}
m_Layer: 0
m_Name: Cube
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!23 &1764631965
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1764631964}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!65 &1764631966
BoxCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1764631964}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!33 &1764631967
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1764631964}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1764631968
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1764631964}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -969, y: 1, z: 7922}
m_LocalScale: {x: 2000, y: 2000, z: 2000}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1996505793
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2}
propertyPath: m_LocalScale.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2}
propertyPath: m_LocalScale.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2}
propertyPath: m_LocalScale.z
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2}
m_IsPrefabParent: 0

View file

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: dacf033ff4744d446a53da2400fe27bc
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 11b97a229abf2df46a16432582b9f95d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,92 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Yangrc.AtmosphereScattering {
public class AerialPerspective : MonoBehaviour {
private new Camera camera;
private void Start() {
camera = GetComponent<Camera>();
if ((camera.depthTextureMode & DepthTextureMode.Depth) == 0)
camera.depthTextureMode |= DepthTextureMode.Depth;
material = new Material(Shader.Find("Hidden/Yangrc/AerialPerspective"));
}
private Material material;
[ImageEffectOpaque]
private void OnRenderImage(RenderTexture source, RenderTexture destination) {
material.SetVector("_ProjectionExtents", camera.GetProjectionExtents());
Graphics.Blit(source, destination, material, 0);
}
private void Update() {
//Control sun intensity.
}
private RenderTexture transmittanceVolume;
private RenderTexture scatteringVolume;
public Vector3Int volumeTexSize = new Vector3Int(128, 128, 32);
Vector3[] _FrustumCorners = new Vector3[4];
//Generate camera volume texture.
private void OnPreRender() {
if (RenderSettings.sun == null)
return;
// get four corners of camera frustom in world space
// bottom left
_FrustumCorners[0] = camera.ViewportToWorldPoint(new Vector3(0, 0, camera.farClipPlane));
// bottom right
_FrustumCorners[1] = camera.ViewportToWorldPoint(new Vector3(1, 0, camera.farClipPlane));
// top left
_FrustumCorners[2] = camera.ViewportToWorldPoint(new Vector3(0, 1, camera.farClipPlane));
// top right
_FrustumCorners[3] = camera.ViewportToWorldPoint(new Vector3(1, 1, camera.farClipPlane));
//Render camera volume texture.
var projection_matrix = GL.GetGPUProjectionMatrix(camera.projectionMatrix, false);
AtmLutHelper.CreateCameraAlignedVolumeTexture(ref transmittanceVolume, ref scatteringVolume, volumeTexSize);
AtmLutHelper.UpdateCameraVolume(
transmittanceVolume,
scatteringVolume,
volumeTexSize,
transform.position,
-RenderSettings.sun.transform.forward,
_FrustumCorners,
new Vector2(camera.nearClipPlane, camera.farClipPlane)
);
//Set it.
Shader.SetGlobalTexture("_CameraVolumeTransmittance", transmittanceVolume);
Shader.SetGlobalTexture("_CameraVolumeScattering", scatteringVolume);
var vp_matrix = projection_matrix * camera.worldToCameraMatrix;
Shader.SetGlobalMatrix("_Camera_VP", vp_matrix);
}
private void OnDisable() {
Shader.SetGlobalTexture("_CameraVolumeTransmittance", null);
Shader.SetGlobalTexture("_CameraVolumeScattering", null);
}
}
public static class CameraExtension {
public static Vector4 GetProjectionExtents(this Camera camera, float texelOffsetX, float texelOffsetY) {
if (camera == null)
return Vector4.zero;
float oneExtentY = camera.orthographic ? camera.orthographicSize : Mathf.Tan(0.5f * Mathf.Deg2Rad * camera.fieldOfView);
float oneExtentX = oneExtentY * camera.aspect;
float texelSizeX = oneExtentX / (0.5f * camera.pixelWidth);
float texelSizeY = oneExtentY / (0.5f * camera.pixelHeight);
float oneJitterX = texelSizeX * texelOffsetX;
float oneJitterY = texelSizeY * texelOffsetY;
return new Vector4(oneExtentX, oneExtentY, oneJitterX, oneJitterY);// xy = frustum extents at distance 1, zw = jitter at distance 1
}
public static Vector4 GetProjectionExtents(this Camera camera) {
return GetProjectionExtents(camera, 0.0f, 0.0f);
}
}
}

View file

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: b535dacf702e20c4b9ef528e42081835
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,568 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
namespace Yangrc.AtmosphereScattering {
public static class HighResolutionDateTime {
public static bool IsAvailable { get; private set; }
[DllImport("Kernel32.dll", CallingConvention = CallingConvention.Winapi)]
private static extern void GetSystemTimePreciseAsFileTime(out long filetime);
public static DateTime UtcNow {
get {
if (!IsAvailable) {
throw new InvalidOperationException(
"High resolution clock isn't available.");
}
long filetime;
GetSystemTimePreciseAsFileTime(out filetime);
return DateTime.FromFileTimeUtc(filetime);
}
}
static HighResolutionDateTime() {
try {
long filetime;
GetSystemTimePreciseAsFileTime(out filetime);
IsAvailable = true;
} catch (EntryPointNotFoundException) {
// Not running Windows 8 or higher.
IsAvailable = false;
}
}
}
public class ProgressiveLutUpdater {
public void Cleanup() {
var allTextures = new List<RenderTexture> {
this.groundIrradianceCombine,
this.multiScatteringCombine,
this.multiScatteringDensity,
this.singleMie,
this.singleRayleigh,
this.transmittance,
};
allTextures.AddRange(
this.groundIrradianceTemp);
allTextures.AddRange(
this.multiScatteringTemp);
for (int i = 0; i < allTextures.Count; i++) {
if (allTextures[i] != null && allTextures[i].IsCreated())
allTextures[i].Release();
}
}
public interface ITimeLogger {
void Log(string itemName);
}
public AtmosphereConfig atmConfigToUse { get; set; }
public AtmosphereConfig atmConfigUsedToUpdate { get; private set; }
public AtmLutGenerateConfig lutConfig { get; set; }
ITimeLogger logger;
public ProgressiveLutUpdater(AtmosphereConfig atmConfig, AtmLutGenerateConfig lutConfig, ITimeLogger logger = null) {
this.atmConfigToUse = atmConfig;
this.lutConfig = lutConfig;
this.logger = logger;
working = false;
atmConfigUsedToUpdate = ScriptableObject.CreateInstance<AtmosphereConfig>();
}
public const int k_MultiScatteringOrderDepth = 4;
public RenderTexture[] groundIrradianceTemp = new RenderTexture[k_MultiScatteringOrderDepth + 1];
public RenderTexture multiScatteringDensity;
public RenderTexture[] multiScatteringTemp = new RenderTexture[k_MultiScatteringOrderDepth + 1];
public RenderTexture transmittance;
public RenderTexture singleRayleigh, singleMie;
public RenderTexture multiScatteringCombine, groundIrradianceCombine;
internal string name;
public bool working { get; private set; }
private void Log(string t) {
if (this.logger != null)
logger.Log(t);
}
public IEnumerator UpdateCoroutine() {
working = true;
atmConfigUsedToUpdate.CopyDataFrom(atmConfigToUse);
AtmLutHelper.CreateTransmittanceTexture(ref transmittance, lutConfig);
using (new ConvenientStopwatch("Complete Lut update timecost", Log)) {
//Update transmittance.
AtmLutHelper.ApplyComputeShaderParams(lutConfig, atmConfigUsedToUpdate);
using (new ConvenientStopwatch("Transmittance ", Log)) {
AtmLutHelper.UpdateTransmittance(
transmittance,
lutConfig,
0.0f,
1.0f
);
yield return null;
}
//Update GroundDirect
using (new ConvenientStopwatch("GroundDirect", Log)) {
AtmLutHelper.ApplyComputeShaderParams(lutConfig, atmConfigUsedToUpdate);
AtmLutHelper.CreateGroundIrradianceTexture(ref groundIrradianceTemp[0], 0, lutConfig);
AtmLutHelper.UpdateGroundDirectIrradiance(groundIrradianceTemp[0], transmittance, lutConfig, 0.0f, 1.0f);
yield return null;
}
//Update SingleRayleigh/Mie
using (new ConvenientStopwatch("Single Rayleigh/Mie", Log)) {
AtmLutHelper.ApplyComputeShaderParams(lutConfig, atmConfigUsedToUpdate);
AtmLutHelper.CreateSingleRayleighMieTexture(ref singleRayleigh, ref singleMie, lutConfig);
AtmLutHelper.UpdateSingleRayleighMie(singleRayleigh, singleMie, transmittance, lutConfig);
yield return null;
}
AtmLutHelper.CreateMultiScatteringTexture(ref multiScatteringTemp[1], 1, lutConfig); //This texture is not "Meaningful"(Since the 1-st order should be SingleRayleigh and SingleMie, and this tex won't be used in actual computation either), but we need to make an empty one to avoid shader error.
using (new ConvenientStopwatch("GroundIrradiance 1", Log)) {
//Ground irradiance of 1-st order scattering.
AtmLutHelper.ApplyComputeShaderParams(lutConfig, atmConfigUsedToUpdate);
AtmLutHelper.CreateGroundIrradianceTexture(ref groundIrradianceTemp[1], 1, lutConfig);
AtmLutHelper.UpdateGroundIrradiance(groundIrradianceTemp[1], singleRayleigh, singleMie, multiScatteringTemp[1], 1, lutConfig, 0.0f, 1.0f);
yield return null;
}
//Real game start.
AtmLutHelper.CreateMultiScatteringDensityTexture(ref multiScatteringDensity, lutConfig);
for (int i = 2; i <= k_MultiScatteringOrderDepth; i++) {
using (new ConvenientStopwatch("Multi Scattering Density" + i, Log)) {
AtmLutHelper.ApplyComputeShaderParams(lutConfig, atmConfigUsedToUpdate);
AtmLutHelper.UpdateMultiScatteringDensity(multiScatteringDensity, transmittance, singleRayleigh, singleMie, multiScatteringTemp[i - 1], groundIrradianceTemp[i - 2], i, lutConfig);
yield return null;
}
AtmLutHelper.CreateGroundIrradianceTexture(ref groundIrradianceTemp[i], i, lutConfig);
using (new ConvenientStopwatch("Ground Irradiance" + i, Log)) {
AtmLutHelper.ApplyComputeShaderParams(lutConfig, atmConfigUsedToUpdate);
AtmLutHelper.UpdateGroundIrradiance(groundIrradianceTemp[i], singleRayleigh, singleMie, multiScatteringTemp[i - 1], i - 1, lutConfig);
yield return null;
}
AtmLutHelper.CreateMultiScatteringTexture(ref multiScatteringTemp[i], i, lutConfig);
using (new ConvenientStopwatch("Multi Scattering " + i, Log)) {
AtmLutHelper.ApplyComputeShaderParams(lutConfig, atmConfigUsedToUpdate);
AtmLutHelper.UpdateMultiScatteringCombineDensity(multiScatteringTemp[i], transmittance, multiScatteringDensity, lutConfig);
yield return null;
}
}
//Combine our multiscattering texture.
AtmLutHelper.CreateFinalCombinedTexture(ref multiScatteringCombine, ref groundIrradianceCombine, lutConfig);
AtmLutHelper.ClearFinalCombinedMultiScatter(multiScatteringCombine, lutConfig);
AtmLutHelper.ClearFinalCombinedIrradiance(groundIrradianceCombine, lutConfig);
AtmLutHelper.ApplyComputeShaderParams(lutConfig, atmConfigUsedToUpdate);
for (int i = 2; i <= k_MultiScatteringOrderDepth; i++) {
AtmLutHelper.UpdateFinalCombinedMultiScatter(multiScatteringCombine, multiScatteringTemp[i], lutConfig);
}
for (int i = 1; i <= k_MultiScatteringOrderDepth; i++) {
AtmLutHelper.UpdateFinalCombinedIrradiance(groundIrradianceCombine, groundIrradianceTemp[i], lutConfig);
}
}
//All calculations are done.
/* DON"T RELEASE TEMP TEXTURES HERE, IT WILL CAUSE GRAPHICS GLITCH(FLASHING) WHEN RENDERING SKYBOX. I DON'T KNOW WHY.(2017.4.11f1) */
/* AND THAT GLITCH COST ME 4 HOURS TO FIND OUT, THANK YOU UNITY */
/* I guess that after combine dispatch call, the process isn't finished immediately, if we release the textures right now, it will blow up. */
/* but I tried to wait for a few frame(yield return null), still doesn't work. */
////Release all temp textures. They won't be used in the future.
//for (int i = 0; i < groundIrradianceTemp.Length; i++) {
// if (groundIrradianceTemp[i] != null) {
// groundIrradianceTemp[i].Release();
// groundIrradianceTemp[i] = null;
// }
//}
//for (int i = 0; i < multiScatteringTemp.Length; i++) {
// if (multiScatteringTemp[i] != null) {
// multiScatteringTemp[i].Release();
// multiScatteringTemp[i] = null;
// }
//}
//Done!
working = false;
yield break;
}
}
[System.Serializable]
public class AtmLutGenerateConfig {
public Vector2Int transmittanceSize = new Vector2Int(512, 512);
public Vector3Int scatteringSize = new Vector3Int(32, 32, 128);
public Vector2Int irradianceSize = new Vector2Int(32, 32);
public Vector3Int cameraVolumeSize = new Vector3Int(128, 128, 32);
private static class Keys {
private static readonly int transmittanceSize = Shader.PropertyToID("TransmittanceSize");
private static readonly int scatteringSize = Shader.PropertyToID("ScatteringSize");
private static readonly int irradianceSize = Shader.PropertyToID("IrradianceSize");
}
public void Apply(ComputeShader shader) {
shader.SetInts("TransmittanceSize", transmittanceSize.x, transmittanceSize.y);
shader.SetInts("ScatteringSize", scatteringSize.x, scatteringSize.y, scatteringSize.z);
shader.SetInts("IrradianceSize", irradianceSize.x, irradianceSize.y);
}
}
public class ConvenientStopwatch : System.IDisposable {
public ConvenientStopwatch(string name, System.Action<string> Log = null) {
this.name = name;
start = HighResolutionDateTime.UtcNow;
this.Log = Log;
}
System.Action<string> Log;
DateTime start;
string name;
public void Dispose() {
var timeSpan = HighResolutionDateTime.UtcNow - start;
if (Log != null)
Log(name + ":" + timeSpan.TotalMilliseconds);
}
}
public static class AtmLutHelper {
public static void Init(ComputeShader shader) {
if (computeShader == null) {
AtmLutHelper.computeShader = shader;
SetupKernals(computeShader);
}
}
public static ComputeShader computeShader;
private static int CalculateTransmittanceLUT;
private static int CalculateSingleScatteringLUT;
private static int CalculateGroundDirectIrradianceLUT;
private static int CalculateGroundIndirectIrradianceLUT;
private static int CalculateMultipleScatteringDensityLUT;
private static int CalculateMultipleScatteringLUT;
private static int SumGroundIrradianceLUT;
private static int SumMultipleScatteringLUT;
private static int ClearCombineGroundIrradianceLUT;
private static int ClearCombineMultipleScatteringLUT;
private static int CalculateCameraScatteringVolume;
/// <summary>
/// These functions help do all the "SetXXX" stuff.
/// So we can focus on how to generate Luts.
/// </summary>
private static void SetupKernals(ComputeShader computeShader) {
CalculateTransmittanceLUT = computeShader.FindKernel("CalculateTransmittanceLUT");
CalculateSingleScatteringLUT = computeShader.FindKernel("CalculateSingleScatteringLUT");
CalculateGroundDirectIrradianceLUT = computeShader.FindKernel("CalculateGroundDirectIrradianceLUT");
CalculateGroundIndirectIrradianceLUT = computeShader.FindKernel("CalculateGroundIndirectIrradianceLUT");
CalculateMultipleScatteringDensityLUT = computeShader.FindKernel("CalculateMultipleScatteringDensityLUT");
CalculateMultipleScatteringLUT = computeShader.FindKernel("CalculateMultipleScatteringLUT");
SumGroundIrradianceLUT = computeShader.FindKernel("CombineGroundIrradianceLUT");
SumMultipleScatteringLUT = computeShader.FindKernel("CombineMultipleScatteringLUT");
ClearCombineGroundIrradianceLUT = computeShader.FindKernel("ClearCombineGroundIrradianceLUT");
ClearCombineMultipleScatteringLUT = computeShader.FindKernel("ClearCombineMultipleScatteringLUT");
CalculateCameraScatteringVolume = computeShader.FindKernel("CalculateCameraScatteringVolume");
}
public static void ApplyComputeShaderParams(AtmLutGenerateConfig lutConfig, AtmosphereConfig atmConfig) {
lutConfig.Apply(computeShader);
atmConfig.Apply(computeShader);
}
private static void CreateLUT(ref RenderTexture result, string name, int width, int height, int zsize, RenderTextureFormat format, bool forceReplace = false) {
if (result != null) {
if (!forceReplace && result.name == name && result.width == width && result.height == height && result.volumeDepth == zsize && result.format == format)
return;
result.Release();
}
result = new RenderTexture(width, height, 0, format, RenderTextureReadWrite.Linear);
result.name = name;
result.enableRandomWrite = true;
if (zsize > 0) {
result.dimension = UnityEngine.Rendering.TextureDimension.Tex3D;
result.volumeDepth = zsize;
} else {
result.dimension = UnityEngine.Rendering.TextureDimension.Tex2D;
}
result.filterMode = FilterMode.Bilinear;
result.wrapMode = TextureWrapMode.Clamp;
result.Create();
}
private static void NormalizeProgressPointer(float start, float end, int length, out int startInt, out int endInt) {
if (end < start) {
var t = start;
start = end;
end = t;
}
start = Mathf.Clamp01(start);
end = Mathf.Clamp01(end);
startInt = Mathf.RoundToInt(length * start);
endInt = Mathf.RoundToInt(length * end);
}
public static void CreateTransmittanceTexture(
ref RenderTexture target,
AtmLutGenerateConfig lutconfig) {
CreateLUT(ref target, "Transmittance", lutconfig.transmittanceSize.x, lutconfig.transmittanceSize.y, 0, RenderTextureFormat.ARGBFloat);
}
public static void CreateSingleRayleighMieTexture(ref RenderTexture rayleigh, ref RenderTexture mie, AtmLutGenerateConfig lutconfig) {
CreateLUT(ref rayleigh, "SingleMie", lutconfig.scatteringSize.x, lutconfig.scatteringSize.y, lutconfig.scatteringSize.z, RenderTextureFormat.ARGBFloat);
CreateLUT(ref mie, "SingleRayleigh", lutconfig.scatteringSize.x, lutconfig.scatteringSize.y, lutconfig.scatteringSize.z, RenderTextureFormat.ARGBFloat);
}
public static void CreateGroundIrradianceTexture(ref RenderTexture target, int order, AtmLutGenerateConfig lutconfig) {
CreateLUT(ref target, "Ground Irrdiance Order " + order, lutconfig.irradianceSize.x, lutconfig.irradianceSize.y, 0, RenderTextureFormat.ARGBFloat);
}
public static void CreateMultiScatteringDensityTexture(
ref RenderTexture result,
AtmLutGenerateConfig lutConfig
) {
CreateLUT(ref result, "MultiScatteringDensity", lutConfig.scatteringSize.x, lutConfig.scatteringSize.y, lutConfig.scatteringSize.z, RenderTextureFormat.ARGBFloat);
}
public static void CreateMultiScatteringTexture(
ref RenderTexture result,
int order,
AtmLutGenerateConfig lutConfig
) {
CreateLUT(ref result, "MultiScattering " + order, lutConfig.scatteringSize.x, lutConfig.scatteringSize.y, lutConfig.scatteringSize.z, RenderTextureFormat.ARGBFloat);
}
public static void CreateFinalCombinedTexture(
ref RenderTexture MultipleScatteringLUT,
ref RenderTexture IrradianceLUT,
AtmLutGenerateConfig lutConfig
) {
CreateLUT(ref MultipleScatteringLUT, "Multiple Scattering Combined Final", lutConfig.scatteringSize.x, lutConfig.scatteringSize.y, lutConfig.scatteringSize.z, RenderTextureFormat.ARGBFloat, true);
CreateLUT(ref IrradianceLUT, "Irradiance Combined Final", lutConfig.irradianceSize.x, lutConfig.irradianceSize.y, 0, RenderTextureFormat.ARGBFloat, true);
}
public static void CreateCameraAlignedVolumeTexture(
ref RenderTexture transmittance,
ref RenderTexture scattering,
Vector3Int volumeTexSize
) {
CreateLUT(ref transmittance,
"CameraVolumeTransmittance",
volumeTexSize.x,
volumeTexSize.y,
volumeTexSize.z,
RenderTextureFormat.ARGBFloat,
false);
CreateLUT(ref scattering,
"CameraVolumeScattering",
volumeTexSize.x,
volumeTexSize.y,
volumeTexSize.z,
RenderTextureFormat.ARGBFloat,
false);
}
public static void UpdateTransmittance(
RenderTexture target,
AtmLutGenerateConfig lutConfig,
float start = 0.0f,
float end = 1.0f
) {
int xStart, xEnd;
NormalizeProgressPointer(start, end, lutConfig.transmittanceSize.x / 32, out xStart, out xEnd);
computeShader.SetInts("_ThreadOffset", xStart, 0, 0);
computeShader.SetTexture(CalculateTransmittanceLUT, "TransmittanceLUTResult", target);
computeShader.Dispatch(CalculateTransmittanceLUT, xEnd - xStart, lutConfig.transmittanceSize.y / 32, 1);
}
public static void UpdateSingleRayleighMie(
RenderTexture rayleightarget,
RenderTexture mietarget,
RenderTexture TransmittanceLUT,
AtmLutGenerateConfig lutConfig,
float start = 0.0f,
float end = 1.0f
) {
int xStart, xEnd;
NormalizeProgressPointer(start, end, lutConfig.scatteringSize.x / 8, out xStart, out xEnd);
computeShader.SetInts("_ThreadOffset", xStart, 0, 0);
computeShader.SetTexture(CalculateSingleScatteringLUT, "TransmittanceLUT", TransmittanceLUT);
computeShader.SetTexture(CalculateSingleScatteringLUT, "SingleScatteringMieLUTResult", mietarget);
computeShader.SetTexture(CalculateSingleScatteringLUT, "SingleScatteringRayleighLUTResult", rayleightarget);
computeShader.Dispatch(CalculateSingleScatteringLUT, xEnd - xStart, lutConfig.scatteringSize.y / 8, lutConfig.scatteringSize.z / 8);
}
public static void UpdateGroundDirectIrradiance(
RenderTexture target,
RenderTexture TransmittanceLUT,
AtmLutGenerateConfig lutConfig,
float start = 0.0f,
float end = 1.0f
) {
int xStart, xEnd;
NormalizeProgressPointer(start, end, lutConfig.irradianceSize.x / 32, out xStart, out xEnd);
computeShader.SetInts("_ThreadOffset", xStart, 0, 0);
computeShader.SetTexture(CalculateGroundDirectIrradianceLUT, "TransmittanceLUT", TransmittanceLUT);
computeShader.SetTexture(CalculateGroundDirectIrradianceLUT, "GroundDirectIrradianceResult", target);
computeShader.Dispatch(CalculateGroundDirectIrradianceLUT, xEnd - xStart, lutConfig.irradianceSize.y / 32, 1);
}
public static void UpdateGroundIrradiance(
RenderTexture target,
RenderTexture singleRayleigh,
RenderTexture singleMie,
RenderTexture multiScattering,
int scatteringOrder,
AtmLutGenerateConfig lutConfig,
float start = 0.0f,
float end = 1.0f
) {
int xStart, xEnd;
NormalizeProgressPointer(start, end, lutConfig.irradianceSize.x / 32, out xStart, out xEnd);
computeShader.SetInts("_ThreadOffset", xStart, 0, 0);
computeShader.SetInt("ScatteringOrder", scatteringOrder);
computeShader.SetTexture(CalculateGroundIndirectIrradianceLUT, "SingleRayleighScatteringLUT", singleRayleigh);
computeShader.SetTexture(CalculateGroundIndirectIrradianceLUT, "SingleMieScatteringLUT", singleMie);
computeShader.SetTexture(CalculateGroundIndirectIrradianceLUT, "MultipleScatteringLUT", multiScattering);
computeShader.SetTexture(CalculateGroundIndirectIrradianceLUT, "GroundIndirectIrradianceResult", target);
computeShader.Dispatch(CalculateGroundIndirectIrradianceLUT, xEnd - xStart, lutConfig.irradianceSize.y / 32, 1);
}
public static void UpdateMultiScatteringDensity(
RenderTexture target,
RenderTexture TransmittanceLUT,
RenderTexture SingleScatteringLUTRayleigh,
RenderTexture SingleScatteringLUTMie,
RenderTexture MultiScatteringOfLastOrder,
RenderTexture GroundDirectIrradianceLUT,
int scatteringOrder,
AtmLutGenerateConfig lutConfig,
float start = 0.0f,
float end = 1.0f
) {
int xStart, xEnd;
NormalizeProgressPointer(start, end, lutConfig.scatteringSize.x / 8, out xStart, out xEnd);
computeShader.SetInts("_ThreadOffset", xStart, 0, 0);
computeShader.SetTexture(CalculateMultipleScatteringDensityLUT, "TransmittanceLUT", TransmittanceLUT);
computeShader.SetTexture(CalculateMultipleScatteringDensityLUT, "SingleRayleighScatteringLUT", SingleScatteringLUTRayleigh);
computeShader.SetTexture(CalculateMultipleScatteringDensityLUT, "SingleMieScatteringLUT", SingleScatteringLUTMie);
computeShader.SetTexture(CalculateMultipleScatteringDensityLUT, "IrradianceLUT", GroundDirectIrradianceLUT);
computeShader.SetTexture(CalculateMultipleScatteringDensityLUT, "MultipleScatteringLUT", MultiScatteringOfLastOrder);
computeShader.SetInt("ScatteringOrder", scatteringOrder);
computeShader.SetTexture(CalculateMultipleScatteringDensityLUT, "MultipleScatteringDensityResult", target);
computeShader.Dispatch(CalculateMultipleScatteringDensityLUT, xEnd - xStart, lutConfig.scatteringSize.y / 8, lutConfig.scatteringSize.z / 8);
}
public static void UpdateMultiScatteringCombineDensity(
RenderTexture target,
RenderTexture TransmittanceLUT,
RenderTexture multipleScatteringDensity,
AtmLutGenerateConfig lutConfig,
float start = 0.0f,
float end = 1.0f
) {
int xStart, xEnd;
NormalizeProgressPointer(start, end, lutConfig.scatteringSize.x / 8, out xStart, out xEnd);
computeShader.SetInts("_ThreadOffset", xStart, 0, 0);
computeShader.SetTexture(CalculateMultipleScatteringLUT, "TransmittanceLUT", TransmittanceLUT);
computeShader.SetTexture(CalculateMultipleScatteringLUT, "MultipleScatteringDensityLUT", multipleScatteringDensity);
computeShader.SetTexture(CalculateMultipleScatteringLUT, "MultipleScatteringResult", target);
computeShader.Dispatch(CalculateMultipleScatteringLUT, xEnd - xStart, lutConfig.scatteringSize.y / 8, lutConfig.scatteringSize.z / 8);
}
public static void ClearFinalCombinedMultiScatter(
RenderTexture multiScatteringTarget,
AtmLutGenerateConfig lutConfig
) {
computeShader.SetTexture(ClearCombineMultipleScatteringLUT, "ScatteringSumTarget", multiScatteringTarget);
computeShader.Dispatch(ClearCombineMultipleScatteringLUT, lutConfig.scatteringSize.x / 8, lutConfig.scatteringSize.y / 8, lutConfig.scatteringSize.z / 8);
}
public static void UpdateFinalCombinedMultiScatter(
RenderTexture multiScatteringTarget,
RenderTexture multiScatteringOfSingleOrder,
AtmLutGenerateConfig lutConfig
) {
computeShader.SetTexture(SumMultipleScatteringLUT, "ScatteringSumTarget", multiScatteringTarget);
computeShader.SetTexture(SumMultipleScatteringLUT, "ScatteringSumAdd", multiScatteringOfSingleOrder);
computeShader.Dispatch(SumMultipleScatteringLUT, lutConfig.scatteringSize.x / 8, lutConfig.scatteringSize.y / 8, lutConfig.scatteringSize.z / 8);
}
public static void ClearFinalCombinedIrradiance(
RenderTexture target,
AtmLutGenerateConfig lutConfig
) {
computeShader.SetTexture(ClearCombineGroundIrradianceLUT, "GroundIrradianceSumTarget", target);
computeShader.Dispatch(ClearCombineGroundIrradianceLUT, lutConfig.irradianceSize.x / 32, lutConfig.irradianceSize.y / 32, 1);
}
public static void UpdateFinalCombinedIrradiance(
RenderTexture target,
RenderTexture irradianceOfSingleOrder,
AtmLutGenerateConfig lutConfig
) {
computeShader.SetTexture(SumGroundIrradianceLUT, "GroundIrradianceSumTarget", target);
computeShader.SetTexture(SumGroundIrradianceLUT, "GroundIrradianceSumAdder", irradianceOfSingleOrder);
computeShader.Dispatch(SumGroundIrradianceLUT, lutConfig.irradianceSize.x / 32, lutConfig.irradianceSize.y / 32, 1);
}
/// <summary>
/// Calculate camera frustrum aligned volume.
/// See frostbite slider for more.
/// </summary>
/// <param name="transmittanceTarget">Target to store transmittance</param>
/// <param name="scatteringTarget">Target to store scattering</param>
/// <param name="volumeSize">Volume tex size, used to determine dispatch call params</param>
/// <param name="cameraPos">Camera world pos</param>
/// <param name="sunDirection">Sun direction(pointing towards sun)</param>
/// <param name="frustrumCorners">four corners of camera frustrum(bl, br, tl, tr). We can't use projection matrix since we divide depth equal range, so we manually interpolate uvw using these corners and near/far plane</param>
/// <param name="nearFarPlane">Near and far plane distance</param>
public static void UpdateCameraVolume(
RenderTexture transmittanceTarget,
RenderTexture scatteringTarget,
Vector3Int volumeSize,
Vector3 cameraPos,
Vector3 sunDirection,
Vector3[] frustrumCorners,
Vector2 nearFarPlane
) {
//Here we need calculated lerpable luts. This kinda break the code sepration. Any better idea?
AtmosphereScatteringLutManager.instance.UpdateComputeShaderValueForLerpedAp(computeShader, CalculateCameraScatteringVolume);
computeShader.SetTexture(CalculateCameraScatteringVolume, "CameraVolumeTransmittance", transmittanceTarget);
computeShader.SetTexture(CalculateCameraScatteringVolume, "CameraVolumeScattering", scatteringTarget);
computeShader.SetVector("_CameraPos", cameraPos);
computeShader.SetVector("_SunDir", sunDirection);
computeShader.SetVector("_CamBotLeft", frustrumCorners[0]);
computeShader.SetVector("_CamBotRight", frustrumCorners[1]);
computeShader.SetVector("_CamTopLeft", frustrumCorners[2]);
computeShader.SetVector("_CamTopRight", frustrumCorners[3]);
computeShader.SetVector("_NearFarPlane", nearFarPlane);
computeShader.Dispatch(CalculateCameraScatteringVolume, volumeSize.x / 8, volumeSize.y / 8, volumeSize.z / 8);
}
}
}

View file

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 31d43eddaa5ab52468dfdf0df4f69d6a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,111 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Yangrc.AtmosphereScattering {
[CreateAssetMenu]
public class AtmosphereConfig : ScriptableObject {
static readonly Vector3 OZoneConst = 6e-7f * new Vector3(3.426f, 8.298f, 0.356f);
static readonly Vector3 RayleighScatteringConst = 1e-6f * new Vector3(5.8f, 13.5f, 33.1f);
static readonly float MieScatteringConst = 2e-6f;
private static class Keys {
public static int atmosphere_top_radius = Shader.PropertyToID("atmosphere_top_radius");
public static int atmosphere_bot_radius = Shader.PropertyToID("atmosphere_bot_radius");
public static int atmosphere_sun_angular_radius = Shader.PropertyToID("atmosphere_sun_angular_radius");
public static int rayleigh_scattering = Shader.PropertyToID("rayleigh_scattering");
public static int rayleigh_scale_height = Shader.PropertyToID("rayleigh_scale_height");
public static int mie_scattering = Shader.PropertyToID("mie_scattering");
public static int mie_extinction = Shader.PropertyToID("mie_extinction");
public static int mie_scale_height = Shader.PropertyToID("mie_scale_height");
public static int mie_phase_function_g = Shader.PropertyToID("mie_phase_function_g");
public static int absorption_extinction = Shader.PropertyToID("absorption_extinction");
public static int absorption_extinction_scale_height = Shader.PropertyToID("absorption_extinction_scale_height");
public static int lightingScale = Shader.PropertyToID("_LightScale");
public static int sunIrradianceOnAtm = Shader.PropertyToID("_SunIrradianceOnAtm");
}
public void Apply(Material mat) {
Shader.SetGlobalFloat(Keys.atmosphere_top_radius, atmosphere_top_radius);
Shader.SetGlobalFloat(Keys.atmosphere_bot_radius, atmosphere_bot_radius);
Shader.SetGlobalFloat(Keys.atmosphere_sun_angular_radius, atmosphere_sun_angular_radius);
Shader.SetGlobalVector(Keys.rayleigh_scattering, rayleigh_scattering_spectrum);
Shader.SetGlobalFloat(Keys.rayleigh_scale_height, rayleigh_scale_height);
Shader.SetGlobalFloat(Keys.mie_scattering, atmosphereDensity * mie_scattering * MieScatteringConst);
Shader.SetGlobalFloat(Keys.mie_extinction, mie_extinction_spectrum);
Shader.SetGlobalFloat(Keys.mie_scale_height, mie_scale_height);
Shader.SetGlobalFloat(Keys.mie_phase_function_g, mie_phase_function_g);
Shader.SetGlobalVector(Keys.absorption_extinction, ozone_extinction_spectrum);
Shader.SetGlobalFloat(Keys.absorption_extinction_scale_height, ozone_scale_height);
Shader.SetGlobalFloat(Keys.lightingScale, LightingScale);
Shader.SetGlobalVector(Keys.sunIrradianceOnAtm, sunIrradianceOnAtmosphere);
}
public void Apply(ComputeShader shader) {
shader.SetFloat(Keys.atmosphere_top_radius, atmosphere_top_radius);
shader.SetFloat(Keys.atmosphere_bot_radius, atmosphere_bot_radius);
shader.SetFloat(Keys.atmosphere_sun_angular_radius, atmosphere_sun_angular_radius);
shader.SetVector(Keys.rayleigh_scattering, rayleigh_scattering_spectrum);
shader.SetFloat(Keys.rayleigh_scale_height, rayleigh_scale_height);
shader.SetFloat(Keys.mie_scattering, atmosphereDensity * mie_scattering * MieScatteringConst);
shader.SetFloat(Keys.mie_extinction, mie_extinction_spectrum);
shader.SetFloat(Keys.mie_scale_height, mie_scale_height);
shader.SetFloat(Keys.mie_phase_function_g, mie_phase_function_g);
shader.SetVector(Keys.absorption_extinction, ozone_extinction_spectrum);
shader.SetFloat(Keys.absorption_extinction_scale_height, ozone_scale_height);
shader.SetVector(Keys.sunIrradianceOnAtm, sunIrradianceOnAtmosphere);
}
public float atmosphereDensity = 1.0f;
public Vector3 sunIrradianceOnAtmosphere = new Vector3(1.0f, 1.0f, 1.0f);
public float LightingScale = 2.0f * 3.1415926f;
public float atmosphere_top_radius = 6.36e6f + 6e4f;
public float atmosphere_bot_radius = 6.36e6f;
public float atmosphere_sun_angular_radius = 0.0087f;
public float rayleigh_scattering = 1.0f;
public float rayleigh_scale_height = 8000.0f;
public Vector3 rayleigh_scattering_spectrum {
get {
return atmosphereDensity * rayleigh_scattering * RayleighScatteringConst;
}
}
public Vector3 ozone_extinction_spectrum {
get {
return atmosphereDensity * OZoneConst * ozone_extinction;
}
}
public float mie_scattering = 1.0f;
public float mie_extinction {
get {
return mie_scattering * 1.1f;
}
}
public float mie_extinction_spectrum {
get {
return atmosphereDensity * mie_extinction * MieScatteringConst;
}
}
public float mie_scale_height = 1200.0f;
public float mie_phase_function_g = 0.8f;
public float ozone_extinction = 1.0f;
public float ozone_scale_height = 1000.0f;
public void CopyDataFrom(AtmosphereConfig config) {
this.atmosphereDensity = config.atmosphereDensity;
this.LightingScale = config.LightingScale;
this.sunIrradianceOnAtmosphere = config.sunIrradianceOnAtmosphere;
this.atmosphere_top_radius = config.atmosphere_top_radius;
this.atmosphere_bot_radius = config.atmosphere_bot_radius;
this.atmosphere_sun_angular_radius = config.atmosphere_sun_angular_radius;
this.rayleigh_scattering = config.rayleigh_scattering;
this.rayleigh_scale_height = config.rayleigh_scale_height;
this.mie_scattering = config.mie_scattering;
this.mie_scale_height = config.mie_scale_height;
this.mie_phase_function_g = config.mie_phase_function_g;
this.ozone_extinction = config.ozone_extinction;
this.ozone_scale_height = config.ozone_scale_height;
}
}
}

View file

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a909801085fa7db47939f4858f8f7a1f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,252 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
namespace Yangrc.AtmosphereScattering {
[ExecuteInEditMode]
public class AtmosphereScatteringLutManager : MonoBehaviour , ProgressiveLutUpdater.ITimeLogger{
public static AtmosphereScatteringLutManager instance {
get {
return _instance;
}
}
private static AtmosphereScatteringLutManager _instance;
public bool progressiveUpdate;
[SerializeField]
private ComputeShader computeShader;
[SerializeField]
private bool outputDebug = false;
public AtmLutGenerateConfig lutConfig;
public AtmosphereConfig atmosphereConfig;
[System.NonSerialized]
public Material skyboxMaterial;
//We prepare 3 updater, the 0-index one is "currently updating", 1-index is "just updated", and 2-index is the oldest one.
//During rendering, we interpolate 1 and 2, and updating 0.
private ProgressiveLutUpdater[] pingPongUpdaters = new ProgressiveLutUpdater[3];
public ProgressiveLutUpdater newestLut { get {
return pingPongUpdaters[1];
} }
public ProgressiveLutUpdater oldLut {
get {
return pingPongUpdaters[2];
}
}
//Shift all updater to one right.
private void RotatePingpongUpdater() {
var temp = pingPongUpdaters[pingPongUpdaters.Length-1];
for (int i = pingPongUpdaters.Length - 1; i > 0; i--) {
pingPongUpdaters[i] = pingPongUpdaters[i - 1];
}
pingPongUpdaters[0] = temp;
}
private void Awake() {
if (_instance != null) {
throw new System.InvalidOperationException("AtmosphereScatteringLutManager already exists!");
}
}
private void OnEnable() {
if (computeShader == null) {
throw new System.InvalidOperationException("Compute shader not set!");
}
_instance = this;
AtmLutHelper.Init(computeShader);
for (int i = 0; i < pingPongUpdaters.Length; i++) {
pingPongUpdaters[i] = new ProgressiveLutUpdater(null, lutConfig, this);
pingPongUpdaters[i].name = "Updater " + i;
}
//Quickly complete two set luts.
for (int i = 1; i <= 2; i++) {
pingPongUpdaters[i].atmConfigToUse = atmosphereConfig;
var t = pingPongUpdaters[i].UpdateCoroutine();
while (t.MoveNext()) ;
}
UpdateSkyboxMaterial(pingPongUpdaters[1], pingPongUpdaters[2]);
KickOffUpdater(pingPongUpdaters[0]);
}
private void KickOffUpdater(ProgressiveLutUpdater updater) {
updater.atmConfigToUse = atmosphereConfig;
StartCoroutine(updater.UpdateCoroutine());
}
private float lerpValue = 0.0f;
private void Update() {
if (!pingPongUpdaters[0].working && progressiveUpdate) {
//Use the finished luts.
UpdateSkyboxMaterial(pingPongUpdaters[0], pingPongUpdaters[1]);
lerpValue = 0.0f;
//Rotate to right.
RotatePingpongUpdater();
//Next updater.
KickOffUpdater(pingPongUpdaters[0]);
}
UpdateLerpValue();
}
private void UpdateLerpValue() {
//We now require 19 frames to update
lerpValue += 1.0f / 19.0f;
if (skyboxMaterial != null)
Shader.SetGlobalFloat("_LerpValue", lerpValue);
}
private void OnDisable() {
for (int i = 0; i < pingPongUpdaters.Length; i++) {
pingPongUpdaters[i].Cleanup();
}
}
public void UpdateComputeShaderValueForLerpedAp(ComputeShader shader, int kernelId) {
newestLut.atmConfigUsedToUpdate.Apply(shader);
shader.SetTexture(kernelId, "_SingleRayleigh_1", oldLut.singleRayleigh);
shader.SetTexture(kernelId, "_SingleMie_1", oldLut.singleMie);
shader.SetTexture(kernelId, "_SingleRayleigh_2", newestLut.singleRayleigh);
shader.SetTexture(kernelId, "_SingleMie_2", newestLut.singleMie);
shader.SetTexture(kernelId, "_MultipleScattering_1", oldLut.multiScatteringCombine);
shader.SetTexture(kernelId, "_MultipleScattering_2", newestLut.multiScatteringCombine);
shader.SetTexture(kernelId, "_Transmittance_1", oldLut.transmittance);
shader.SetTexture(kernelId, "_Transmittance_2", newestLut.transmittance);
shader.SetTexture(kernelId, "_GroundIrradiance_1", oldLut.groundIrradianceCombine);
shader.SetTexture(kernelId, "_GroundIrradiance_2", newestLut.groundIrradianceCombine);
shader.SetVector("_ScatteringSize", (Vector3)lutConfig.scatteringSize);
shader.SetVector("_GroundIrradianceSize", (Vector2)lutConfig.irradianceSize);
shader.SetVector("_TransmittanceSize", (Vector2)lutConfig.transmittanceSize);
}
public void UpdateSkyboxMaterial(ProgressiveLutUpdater updater, ProgressiveLutUpdater oldUpdater) {
if (this.skyboxMaterial==null)
this.skyboxMaterial = new Material(Shader.Find("Skybox/AtmosphereScatteringPrecomputed"));
updater.atmConfigUsedToUpdate.Apply(skyboxMaterial);
Shader.SetGlobalTexture("_SingleRayleigh_1", oldUpdater.singleRayleigh);
Shader.SetGlobalTexture("_SingleMie_1", oldUpdater.singleMie);
Shader.SetGlobalTexture("_SingleRayleigh_2", updater.singleRayleigh);
Shader.SetGlobalTexture("_SingleMie_2", updater.singleMie);
Shader.SetGlobalTexture("_MultipleScattering_1", oldUpdater.multiScatteringCombine);
Shader.SetGlobalTexture("_MultipleScattering_2", updater.multiScatteringCombine);
Shader.SetGlobalTexture("_Transmittance_1", oldUpdater.transmittance);
Shader.SetGlobalTexture("_Transmittance_2", updater.transmittance);
Shader.SetGlobalTexture("_GroundIrradiance_1", oldUpdater.groundIrradianceCombine);
Shader.SetGlobalTexture("_GroundIrradiance_2", updater.groundIrradianceCombine);
Shader.SetGlobalVector("_ScatteringSize", (Vector3)lutConfig.scatteringSize);
Shader.SetGlobalVector("_GroundIrradianceSize", (Vector2)lutConfig.irradianceSize);
Shader.SetGlobalVector("_TransmittanceSize", (Vector2)lutConfig.transmittanceSize);
RenderSettings.skybox = this.skyboxMaterial;
}
public void Log(string itemName) {
if (outputDebug)
Debug.Log(itemName);
}
public Vector3 GetRadianceAt(float mu_s, Vector3 basePosition) {
var t = atmosphereConfig.sunIrradianceOnAtmosphere;
var r = basePosition + new Vector3(0.0f, atmosphereConfig.atmosphere_bot_radius, 0.0f);
var transmittance = TransmittanceCalculate.GetTransmittanceToSun(atmosphereConfig, r.magnitude, mu_s);
t.Scale(transmittance);
return t;
}
}
public static class TransmittanceCalculate {
static float ClampCosine(float mu) {
return Mathf.Clamp(mu, -1.0f, 1.0f);
}
static float ClampDistance(float d) {
return Mathf.Max(d, 0.0f);
}
static float ClampRadius(AtmosphereConfig atmosphere, float r) {
return Mathf.Clamp(r, atmosphere.atmosphere_bot_radius, atmosphere.atmosphere_top_radius);
}
static float SafeSqrt(float a) {
return Mathf.Sqrt(Mathf.Max(a, 0.0f));
}
static float DistanceToTopAtmosphereBoundary(AtmosphereConfig atmosphere,
float r, float mu) {
float discriminant = r * r * (mu * mu - 1.0f) +
atmosphere.atmosphere_top_radius * atmosphere.atmosphere_top_radius;
return ClampDistance(-r * mu + SafeSqrt(discriminant));
}
static float GetScaleHeight(float altitude, float scale_height) {
return Mathf.Exp(-altitude / scale_height);
}
static float ComputeOpticalLengthToTopAtmosphereBoundary(
AtmosphereConfig atmosphere, float r, float mu, float scale_height) {
// Number of intervals for the numerical integration.
const int SAMPLE_COUNT = 500;
// The integration step, i.e. the length of each integration interval.
float dx =
DistanceToTopAtmosphereBoundary(atmosphere, r, mu) / (float)SAMPLE_COUNT;
// Integration loop.
float result = 0.0f;
for (int i = 0; i <= SAMPLE_COUNT; ++i) {
float d_i = (float)i * dx;
// Distance between the current sample point and the planet center.
float r_i = Mathf.Sqrt(d_i * d_i + 2.0f * r * mu * d_i + r * r);
// Number density at the current sample point (divided by the number density
// at the bottom of the atmosphere, yielding a dimensionless number).
float y_i = GetScaleHeight(r_i - atmosphere.atmosphere_bot_radius, scale_height);
// Sample weight (from the trapezoidal rule).
float weight_i = i == 0 || i == SAMPLE_COUNT ? 0.5f : 1.0f;
result += y_i * weight_i * dx;
}
return result;
}
public static Vector3 ComputeTransmittanceToTopAtmosphereBoundary(
AtmosphereConfig atmosphere, float r, float mu) {
Vector3 rayleigh = atmosphere.rayleigh_scattering_spectrum *
ComputeOpticalLengthToTopAtmosphereBoundary(
atmosphere, r, mu, atmosphere.rayleigh_scale_height);
Vector3 mie = Vector3.one * atmosphere.mie_extinction_spectrum *
ComputeOpticalLengthToTopAtmosphereBoundary(
atmosphere, r, mu, atmosphere.mie_scale_height);
Vector3 ozone = atmosphere.ozone_extinction_spectrum *
ComputeOpticalLengthToTopAtmosphereBoundary(
atmosphere, r, mu, atmosphere.ozone_scale_height);
var sum = rayleigh + mie + ozone;
return new Vector3(
Mathf.Exp(-sum.x),
Mathf.Exp(-sum.y),
Mathf.Exp(-sum.z)
);
}
public static Vector3 GetTransmittanceToSun(
AtmosphereConfig atmosphere,
float r, float mu_s) {
float sin_theta_h = atmosphere.atmosphere_bot_radius / r;
float cos_theta_h = -Mathf.Sqrt(Mathf.Max(1.0f - sin_theta_h * sin_theta_h, 0.0f));
var transmittanceToCenter = ComputeTransmittanceToTopAtmosphereBoundary(
atmosphere, r, mu_s);
var lower_bound = -sin_theta_h * atmosphere.atmosphere_sun_angular_radius;
var upper_bound = sin_theta_h * atmosphere.atmosphere_sun_angular_radius;
var fraction = (mu_s - cos_theta_h - lower_bound) / (upper_bound - lower_bound);
fraction = Mathf.Clamp01(fraction);
return transmittanceToCenter * fraction;
}
}
}

View file

@ -1,14 +0,0 @@
fileFormatVersion: 2
guid: e16dd2ddbdfa7ea4f87a3cfb032ffd0f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- computeShader: {fileID: 7200000, guid: 2d4396a54b390d742b84d4bb4a122e54, type: 3}
- atmosphereConfig: {fileID: 11400000, guid: 8e73e89daf00b8447b2410427953df25, type: 2}
- skyboxMaterial: {instanceID: 0}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,46 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraControl : MonoBehaviour {
public float distance = 10.0f;
public Vector3 center;
private Vector2 lastFrameMouse;
public float scale = 1.0f;
public float distanceSpeed = .1f;
public float rotationSpeed = .1f;
private void Update() {
var mouseDelta = (Vector2)Input.mousePosition - lastFrameMouse;
lastFrameMouse = Input.mousePosition;
if (Input.GetMouseButton(2)) {
//Translate.
center += ((transform.right * mouseDelta.x) + (transform.up * mouseDelta.y)) * scale * distance;
}
if (Input.GetMouseButton(1)) {
distance += mouseDelta.x * distanceSpeed * Mathf.Max(1.0f, 0.1f * distance);
}
if (Input.GetMouseButton(0)) {
//Rotate.
var currentRotation = transform.rotation;
var currentYaw = currentRotation.eulerAngles.y;
var currentPitch = currentRotation.eulerAngles.x;
currentPitch -= mouseDelta.y * rotationSpeed;
currentYaw += mouseDelta.x * rotationSpeed;
currentPitch = Mathf.Max(0, currentPitch);
var newRotation = Quaternion.Euler(currentPitch, currentYaw, 0.0f);
transform.rotation = newRotation;
}
transform.position = transform.rotation * Vector3.forward * -distance + center;
}
}

View file

@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: 45d85419f2e23c540999c1a1fee6ed90
timeCreated: 1547180827
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,16 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraVolumeHelper : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}

View file

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 0e8391fcc2d8a5144ace172efd446a95
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,36 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Yangrc.AtmosphereScattering {
[RequireComponent(typeof(Light))]
public class SunIntensityController : MonoBehaviour {
private new Light light;
//This is the "base" position, used to sample transmittance to sun, and set a final intensity.
//
//In real-life, objects at different position are affected by different sun intensity.
//But in Unity all objects share the same sun.
//So we need to set a base position, and assume all objects are at this position when affected by sun.
public Vector3 basePosition = new Vector3(0.0f, 50.0f, 0.0f);
private void Awake() {
light = GetComponent<Light>();
}
// Update is called once per frame
void Update() {
var t = AtmosphereScatteringLutManager.instance;
if (t != null) {
//Sun-zenith cos.
var mu_s = Vector3.Dot(Vector3.down, transform.forward);
var radianceAtZero = t.GetRadianceAt(mu_s, basePosition);
light.intensity = radianceAtZero.magnitude / (2 * Mathf.PI);
var normalized = radianceAtZero.normalized;
light.color = new Color(normalized.x, normalized.y, normalized.z);
}
}
}
}

View file

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 325c269146dc2ac49b190f730a961573
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 5252171c9ff51e140b7d257eb101b9e4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,100 +0,0 @@
Shader "Hidden/Yangrc/AerialPerspective"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
// No culling or depth
Cull Off ZWrite Off ZTest Always
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "AerialPerspectiveHelper.cginc"
#include "Lighting.cginc"
float4 _ProjectionExtents;
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float4 scrPos: TEXCOORD1;
float2 vsray : TEXCOORD2;
};
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
o.scrPos = ComputeScreenPos(o.vertex);
o.vsray = (2.0 * v.uv - 1.0) * _ProjectionExtents.xy + _ProjectionExtents.zw;
return o;
}
sampler2D _MainTex;
sampler2D _CameraDepthTexture;
float _LightScale;
void CalculateRMuMusForDistancePoint(Length r, Number mu, Number mu_s, Number nu, Number d, OUT(Length) r_d, OUT(Number) mu_d, OUT(Number) mu_s_d);
void CalculateRMuMusFromPosViewdir(AtmosphereParameters atm, float3 pos, float3 view_ray, float3 sun_direction, OUT(float) mu, OUT(float) mu_s, OUT(float) nu);
float3 GetTransmittanceToTopAtmosphereBoundaryLerped(float r, float mu);
half4 frag (v2f i) : SV_Target
{
float3 vspos = float3(i.vsray, 1.0);
float4 worldPos = mul(unity_CameraToWorld, float4(vspos, 1.0));
worldPos /= worldPos.w;
half4 original = tex2D(_MainTex, i.uv);
AtmosphereParameters atm = GetAtmParameters();
float3 view_ray = normalize(worldPos.xyz - _WorldSpaceCameraPos);
float raw_depth = SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, i.scrPos);
float distance = LinearEyeDepth(raw_depth);
if (distance / _ProjectionParams.z > 0.999f) {
return original;
}
float depth = (distance - _ProjectionParams.x) / (_ProjectionParams.z - _ProjectionParams.x);
float3 pixel_pos = worldPos + distance * view_ray;
#if 1
float r, mu, mu_s, nu;
float r_d, mu_d, mu_s_d; //Current pixel on screen's info
CalculateRMuMusFromPosViewdir(atm, _WorldSpaceCameraPos, view_ray, _WorldSpaceLightPos0, r, mu, mu_s, nu);
float d1, d2;
bool ray_r_mu_intersects_ground = RayIntersectsGround(atm, r, mu, d1, d2);
CalculateRMuMusForDistancePoint(atm, r, mu, mu_s, nu, distance, r_d, mu_d, mu_s_d);
//Transmittance to target point.
float3 transmittanceToTarget = GetTransmittanceLerped(r, mu, distance, ray_r_mu_intersects_ground);
//Here the two ray (r, mu) and (r_d, mu_d) is pointing same direction.
//so ray_r_mu_intersects_ground should apply to both of them.
//If we do intersect calculation later, some precision problems might appear, causing glitches near horizontal view dir.
float3 scatteringBetween =
GetTotalScatteringLerped(r, mu, mu_s, nu, ray_r_mu_intersects_ground)
- GetTotalScatteringLerped(r_d, mu_d, mu_s_d, nu, ray_r_mu_intersects_ground) * transmittanceToTarget;
#else
float3 uvw = float3(i.uv, depth);
float3 transmittanceToTarget = GetTransmittanceWithCameraVolume(uvw);
float3 scatteringBetween = GetScatteringWithCameraVolume(uvw);
#endif
return half4(original * transmittanceToTarget + scatteringBetween, 1.0);
}
ENDCG
}
}
}

View file

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 312bffdb76c84374bb88d26526be3dae
ShaderImporter:
externalObjects: {}
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,148 +0,0 @@
#ifndef __AERIAL_PERSPECTIVE_HELPER__
#define __AERIAL_PERSPECTIVE_HELPER__
#include "Common.cginc"
#include "TransmittanceHelper.cginc"
#include "GroundHelper.cginc"
#include "MultipleScatteringHelper.cginc"
#include "SingleScatteringHelper.cginc"
#define LERP_TEXTURE(dim, name) \
sampler ## dim ## D name ## _1; \
sampler ## dim ## D name ## _2;
LERP_TEXTURE(2, _Transmittance)
LERP_TEXTURE(2, _GroundIrradiance)
LERP_TEXTURE(3, _SingleRayleigh)
LERP_TEXTURE(3, _SingleMie)
LERP_TEXTURE(3, _MultipleScattering)
float2 _TransmittanceSize;
float3 _ScatteringSize;
float2 _GroundIrradianceSize;
float3 _SunIrradianceOnAtm;
float _LerpValue;
float3 GetTransmittanceLerped(float r, float mu, float d, bool intersect_ground) {
AtmosphereParameters atm = GetAtmParameters();
float3 lerp1 = GetTransmittance(
atm, _Transmittance_1, _TransmittanceSize, r, mu, d, intersect_ground);
float3 lerp2 = GetTransmittance(
atm, _Transmittance_2, _TransmittanceSize, r, mu, d, intersect_ground);
return lerp(lerp1, lerp2, _LerpValue);
}
float3 GetTransmittanceToTopAtmosphereBoundaryLerped(float r, float mu) {
AtmosphereParameters atm = GetAtmParameters();
float3 lerp1 = GetTransmittanceToTopAtmosphereBoundary(
atm, _Transmittance_1, _TransmittanceSize, r, mu);
float3 lerp2 = GetTransmittanceToTopAtmosphereBoundary(
atm, _Transmittance_2, _TransmittanceSize, r, mu);
return lerp(lerp1, lerp2, _LerpValue);
}
void CalculateRMuMusFromPosViewdir(AtmosphereParameters atm, float3 pos, float3 view_ray, float3 sun_direction, OUT(float) r, OUT(float) mu, OUT(float) mu_s, OUT(float) nu) {
float3 camera = pos + float3(0, atm.bottom_radius, 0);
r = max(atm.bottom_radius + 0.5f, length(camera));
float rmu = dot(camera, view_ray);
mu = rmu / r;
mu_s = dot(camera, sun_direction) / r;
nu = dot(view_ray, sun_direction);
}
void CalculateRMuMusForDistancePoint(AtmosphereParameters atm, Length r, Number mu, Number mu_s, float nu, Number d, OUT(Length) r_d, OUT(Number) mu_d, OUT(Number) mu_s_d) {
r_d = ClampRadius(atm, sqrt(d * d + 2.0 * r * mu * d + r * r));
r_d = max(atm.bottom_radius + 0.5f, r_d);
mu_d = ClampCosine((r * mu + d) / r_d);
mu_s_d = ClampCosine((r * mu_s + d * nu) / r_d);
}
float3 InternalGetRayleighLerped(AtmosphereParameters atm, float r, float mu, float mu_s, float nu, bool ray_r_mu_intersects_ground) {
return SampleScatteringLerped(atm,
_SingleRayleigh_1,
_SingleRayleigh_2,
_LerpValue,
_ScatteringSize,
r, mu, mu_s,
ray_r_mu_intersects_ground) *
RayleighPhaseFunction(nu);
}
float3 InternalGetMieLerped(AtmosphereParameters atm, float r, float mu, float mu_s, float nu, bool ray_r_mu_intersects_ground) {
return SampleScatteringLerped(atm,
_SingleMie_1,
_SingleMie_2,
_LerpValue,
_ScatteringSize,
r, mu, mu_s,
ray_r_mu_intersects_ground) *
MiePhaseFunction(atm.mie_phase_function_g, nu);
}
float3 InternalGetLerpedGroundIrradiance(AtmosphereParameters atm, float r, float mu, float mu_s) {
return lerp(GetIrradiance(atm, _GroundIrradiance_1, _GroundIrradianceSize, r, mu_s), GetIrradiance(atm, _GroundIrradiance_2, _GroundIrradianceSize, r, mu_s), _LerpValue);
}
float3 InternalGetMultipleLerped(AtmosphereParameters atm, float r, float mu, float mu_s, float nu, bool ray_r_mu_intersects_ground) {
return
SampleScatteringLerped(atm,
_MultipleScattering_1,
_MultipleScattering_2,
_LerpValue,
_ScatteringSize,
r, mu, mu_s,
ray_r_mu_intersects_ground);
}
void ComputeSingleScattering(
IN(AtmosphereParameters) atmosphere,
IN(TransmittanceTexture) transmittance_texture,
uint2 texture_size,
Length r, Number mu, Number mu_s, Number nu,
bool ray_r_mu_intersects_ground,
OUT(IrradianceSpectrum) rayleigh, OUT(IrradianceSpectrum) mie);
float3 GetTotalScatteringLerped(float r, float mu, float mu_s, float nu, bool ray_r_mu_intersects_ground) {
AtmosphereParameters atm = GetAtmParameters();
return
(InternalGetRayleighLerped(atm, r, mu, mu_s, nu, ray_r_mu_intersects_ground)
+ InternalGetMieLerped(atm, r, mu, mu_s, nu, ray_r_mu_intersects_ground)
+ InternalGetMultipleLerped(atm, r, mu, mu_s, nu, ray_r_mu_intersects_ground)) * _SunIrradianceOnAtm;
}
float3 GetTotalScatteringLerped(float r, float mu, float mu_s, float nu) {
AtmosphereParameters atm = GetAtmParameters();
bool ray_r_mu_intersects_ground = RayIntersectsGround(atm, r, mu);
return GetTotalScatteringLerped(r, mu, mu_s, nu, ray_r_mu_intersects_ground);
}
float3 EvaluateSunDiskRadianceOfUnitRadiance(AtmosphereParameters atm, float r, float mu, float nu) {
//Evaluate sun's solid angle by formula omega = 2 * PI * ( 1 - cos(sun_angular_radius)) (https://en.wikipedia.org/wiki/Solid_angle)
float cos_sun_angular_radius = cos(atm.sun_angular_radius);
float radianceTransmitted = max(0.0f, (nu - cos_sun_angular_radius) / (1.0f - cos_sun_angular_radius));
float solidAngle = 2 * 3.1415926 * (1 - cos_sun_angular_radius);
return _SunIrradianceOnAtm * radianceTransmitted / solidAngle / 500.0f; //Avoiding it blind your eye.
}
/*
===============================
Camera volume stuff.
===============================
*/
sampler3D _CameraVolumeTransmittance;
sampler3D _CameraVolumeScattering;
float3 GetTransmittanceWithCameraVolume(float3 uvw) {
return tex3Dlod(_CameraVolumeTransmittance, float4(uvw, 0.0f)).rgb * _SunIrradianceOnAtm;
}
float3 GetScatteringWithCameraVolume(float3 uvw) {
return tex3Dlod(_CameraVolumeScattering, float4(uvw, 0.0f)).rgb * _SunIrradianceOnAtm;
}
#endif

View file

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 689759fe522f7ce4eaa6fc304ca996c3
timeCreated: 1531897786
licenseType: Free
ShaderImporter:
externalObjects: {}
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,353 +0,0 @@

/*
Helper functions. See https://ebruneton.github.io/precomputed_atmospheric_scattering/atmosphere/functions.glsl.html#transmittance_computation
*/
//Convert (0.0, 1.0) to actual texel position.
#include "./TransmittanceHelper.cginc"
#include "SingleScatteringHelper.cginc"
#include "MultipleScatteringHelper.cginc"
#include "GroundHelper.cginc"
#pragma kernel CalculateTransmittanceLUT
#pragma kernel CalculateSingleScatteringLUT
#pragma kernel CalculateMultipleScatteringDensityLUT
#pragma kernel CalculateMultipleScatteringLUT
#pragma kernel CalculateGroundDirectIrradianceLUT
#pragma kernel CalculateGroundIndirectIrradianceLUT
#pragma kernel CombineGroundIrradianceLUT
#pragma kernel CombineMultipleScatteringLUT
#pragma kernel ClearCombineGroundIrradianceLUT
#pragma kernel ClearCombineMultipleScatteringLUT
#pragma kernel CalculateCameraScatteringVolume
/*
Common parameters.
*/
sampler2D TransmittanceLUT;
sampler3D SingleRayleighScatteringLUT;
sampler3D SingleMieScatteringLUT;
sampler3D MultipleScatteringDensityLUT;
sampler3D MultipleScatteringLUT;
sampler2D IrradianceLUT;
int2 TransmittanceSize;
int3 ScatteringSize;
int2 IrradianceSize;
int ScatteringOrder;
//When only part of results need to be computed, we offset some results.
uint3 _ThreadOffset;
/*
==================================
||Transmittance LUT calculation.||
==================================
*/
RWTexture2D<float3> TransmittanceLUTResult;
DimensionlessSpectrum ComputeTransmittanceToTopAtmosphereBoundaryTexture(
IN(AtmosphereParameters) atmosphere, IN(vec2) uv_coord, IN(vec2) tex_size) {
Length r;
Number mu;
GetRMuFromTransmittanceTextureUv(
atmosphere, uv_coord, r, mu, tex_size.x, tex_size.y);
return ComputeTransmittanceToTopAtmosphereBoundary(atmosphere, r, mu);
}
[numthreads(32, 32, 1)]
void CalculateTransmittanceLUT(uint3 id : SV_DispatchThreadID, uint3 groupid : SV_GroupThreadID)
{
id += _ThreadOffset * uint3(32, 32, 1);
uint w, h;
TransmittanceLUTResult.GetDimensions(w, h);
AtmosphereParameters atm = GetAtmParameters();
float2 uv = vec2((0.5f + id.x) / w, (0.5f + id.y) / h);
float r, mu;
GetRMuFromTransmittanceTextureUv(
atm, uv, r, mu, w, h);
float3 result = ComputeTransmittanceToTopAtmosphereBoundaryTexture(
atm, uv, vec2(w, h)
);
TransmittanceLUTResult[id.xy] = result;
}
/*
==================================
|| SingleScattering ||
==================================
*/
RWTexture3D<float3> SingleScatteringRayleighLUTResult;
RWTexture3D<float3> SingleScatteringMieLUTResult;
[numthreads(8, 8, 8)]
void CalculateSingleScatteringLUT(uint3 id : SV_DispatchThreadID, uint3 groupid : SV_GroupThreadID)
{
id += _ThreadOffset * uint3(8, 8, 8);
uint w, h, d;
SingleScatteringRayleighLUTResult.GetDimensions(w, h, d);
AtmosphereParameters atm = GetAtmParameters();
float3 uvw = vec3((0.5f + id.x) / w, (0.5f + id.y) / h, (0.5f + id.z) / d);
float3 rayleigh, mie;
ComputeSingleScatteringTexture(
atm, TransmittanceLUT, uint2(TransmittanceSize), uvw, uint3(ScatteringSize), rayleigh, mie
);
SingleScatteringMieLUTResult[id.xyz] = mie;
SingleScatteringRayleighLUTResult[id.xyz] = rayleigh;
}
/*
==========================================
|| Multiple Scattering Density ||
==========================================
*/
RWTexture3D<float3> MultipleScatteringDensityResult;
RadianceDensitySpectrum ComputeScatteringDensityTexture(
IN(AtmosphereParameters) atmosphere,
IN(TransmittanceTexture) transmittance_texture,
uint2 transmittance_size,
IN(ReducedScatteringTexture) single_rayleigh_scattering_texture,
IN(ReducedScatteringTexture) single_mie_scattering_texture,
IN(ScatteringTexture) multiple_scattering_texture,
uint3 scattering_size,
IN(IrradianceTexture) irradiance_texture,
uint2 irradiance_size,
IN(vec3) frag_coord, int scattering_order);
[numthreads(8,8,8)]
void CalculateMultipleScatteringDensityLUT(uint3 id : SV_DispatchThreadID, uint3 groupid : SV_GroupThreadID) {
id += _ThreadOffset * uint3(8, 8, 8);
uint w, h, d;
MultipleScatteringDensityResult.GetDimensions(w, h, d);
AtmosphereParameters atm = GetAtmParameters();
float3 uvw = vec3((0.5f + id.x) / w, (0.5f + id.y) / h, (0.5f + id.z) / d);
float3 density = ComputeScatteringDensityTexture(
atm, TransmittanceLUT, TransmittanceSize,
SingleRayleighScatteringLUT, SingleMieScatteringLUT, MultipleScatteringLUT, ScatteringSize,
IrradianceLUT, IrradianceSize,
uvw, ScatteringOrder
);
MultipleScatteringDensityResult[id.xyz] = density;
}
/*
==========================================
|| Multiple Scattering ||
==========================================
*/
RWTexture3D<float3> MultipleScatteringResult;
RadianceSpectrum ComputeMultipleScatteringTexture(
IN(AtmosphereParameters) atmosphere,
IN(TransmittanceTexture) transmittance_texture,
uint2 transmittance_size,
IN(ScatteringDensityTexture) scattering_density_texture,
uint3 scattering_size,
IN(vec3) frag_coord);
[numthreads(8, 8, 8)]
void CalculateMultipleScatteringLUT(uint3 id : SV_DispatchThreadID, uint3 groupid : SV_GroupThreadID) {
id += _ThreadOffset * uint3(8, 8, 8);
uint w, h, d;
MultipleScatteringResult.GetDimensions(w, h, d);
AtmosphereParameters atm = GetAtmParameters();
float3 uvw = vec3((0.5f + id.x) / w, (0.5f + id.y) / h, (0.5f + id.z) / d);
float3 scattering = ComputeMultipleScatteringTexture(atm, TransmittanceLUT, TransmittanceSize, MultipleScatteringDensityLUT, ScatteringSize, uvw);
MultipleScatteringResult[id.xyz] = scattering;
}
/*
==========================================
|| Ground Direct Irradiance ||
==========================================
*/
RWTexture2D<float3> GroundDirectIrradianceResult;
IrradianceSpectrum ComputeDirectIrradianceTexture(
IN(AtmosphereParameters) atmosphere,
IN(TransmittanceTexture) transmittance_texture,
uint2 transmittance_size,
IN(vec2) frag_coord,
uint2 irrdiance_size);
[numthreads(32, 32, 1)]
void CalculateGroundDirectIrradianceLUT(uint3 id : SV_DispatchThreadID, uint3 groupid : SV_GroupThreadID) {
id += _ThreadOffset * uint3(32, 32, 1);
uint w, h;
GroundDirectIrradianceResult.GetDimensions(w, h);
AtmosphereParameters atm = GetAtmParameters();
float2 uvw = vec2((0.5f + id.x) / w, (0.5f + id.y) / h);
float3 irradiance = ComputeDirectIrradianceTexture(atm, TransmittanceLUT, TransmittanceSize, uvw, IrradianceSize);
GroundDirectIrradianceResult[id.xy] = irradiance;
}
/*
==========================================
|| Ground Indirect Irradiance ||
==========================================
*/
RWTexture2D<float3> GroundIndirectIrradianceResult;
IrradianceSpectrum ComputeIndirectIrradianceTexture(
IN(AtmosphereParameters) atmosphere,
IN(ReducedScatteringTexture) single_rayleigh_scattering_texture,
IN(ReducedScatteringTexture) single_mie_scattering_texture,
IN(ScatteringTexture) multiple_scattering_texture,
uint3 scattering_size,
IN(vec2) frag_coord, int scattering_order, uint2 irrdiance_size);
[numthreads(32, 32, 1)]
void CalculateGroundIndirectIrradianceLUT(uint3 id : SV_DispatchThreadID, uint3 groupid : SV_GroupThreadID) {
id += _ThreadOffset * uint3(32, 32, 1);
uint w, h;
GroundIndirectIrradianceResult.GetDimensions(w, h);
AtmosphereParameters atm = GetAtmParameters();
float2 uvw = vec2((0.5f + id.x) / w, (0.5f + id.y) / h);
float3 irradiance = ComputeIndirectIrradianceTexture(atm,
SingleRayleighScatteringLUT, SingleMieScatteringLUT, MultipleScatteringLUT, ScatteringSize,
uvw, ScatteringOrder, uint2(w,h));
GroundIndirectIrradianceResult[id.xy] = irradiance;
}
/*
==========================================
|| Ground Irradiance Combine ||
==========================================
*/
RWTexture2D<float3> GroundIrradianceSumTarget;
RWTexture2D<float3> GroundIrradianceSumAdder;
[numthreads(32, 32, 1)]
void CombineGroundIrradianceLUT(uint3 id : SV_DispatchThreadID, uint3 groupid : SV_GroupThreadID) {
id += _ThreadOffset * uint3(32, 32, 1);
GroundIrradianceSumTarget[id.xy] += GroundIrradianceSumAdder[id.xy];
}
[numthreads(32, 32, 1)]
void ClearCombineGroundIrradianceLUT(uint3 id : SV_DispatchThreadID, uint3 groupid : SV_GroupThreadID) {
id += _ThreadOffset * uint3(32, 32, 1);
GroundIrradianceSumTarget[id.xy] = 0.0f;
}
/*
==========================================
|| Scattering Combine ||
==========================================
*/
RWTexture3D<float4> ScatteringSumTarget;
RWTexture3D<float4> ScatteringSumAdd;
[numthreads(8, 8, 8)]
void CombineMultipleScatteringLUT(uint3 id : SV_DispatchThreadID, uint3 groupid : SV_GroupThreadID) {
id += _ThreadOffset * uint3(8, 8, 8);
ScatteringSumTarget[id.xyz] += ScatteringSumAdd[id.xyz];
}
[numthreads(8, 8, 8)]
void ClearCombineMultipleScatteringLUT(uint3 id : SV_DispatchThreadID, uint3 groupid : SV_GroupThreadID) {
id += _ThreadOffset * uint3(8, 8, 8);
ScatteringSumTarget[id.xyz] = 0.0f;
}
/*
==========================================
|| Camera Volume Tex ||
==========================================
*/
#include "HLSLSupport.cginc"
#include "AerialPerspectiveHelper.cginc"
RWTexture3D<float3> CameraVolumeTransmittance;
RWTexture3D<float3> CameraVolumeScattering;
float4x4 Inverse_VP;
float3 _CameraPos;
float3 _SunDir;
float2 _NearFarPlane;
float3 _CamBotLeft;
float3 _CamBotRight;
float3 _CamTopLeft;
float3 _CamTopRight;
[numthreads(8, 8, 8)]
void CalculateCameraScatteringVolume(uint3 id : SV_DispatchThreadID, uint3 groupid : SV_GroupThreadID) {
id += _ThreadOffset * uint3(8, 8, 8);
uint3 whd;
CameraVolumeScattering.GetDimensions(whd.x, whd.y, whd.z);
float3 texelSize = 1.0f / whd;
//Get uvw from id.
float3 uvw = (id + 0.5f) * texelSize;
float3 viewDir;
//Get camera ray.
{
float3 t1 = lerp(_CamBotLeft, _CamBotRight, uvw.x);
float3 t2 = lerp(_CamTopLeft, _CamTopRight, uvw.x);
float3 ray_end = lerp(t1, t2, uvw.y);
viewDir = ray_end - _CameraPos;
}
float distance = lerp(_NearFarPlane.x, _NearFarPlane.y, uvw.z);
viewDir = normalize(viewDir);
AtmosphereParameters atm = GetAtmParameters();
float3 earthToCamera = _CameraPos + float3(0.0f, atm.bottom_radius, 0.0f);
float r, mu, mu_s, nu;
float r_d, mu_d, mu_s_d;
CalculateRMuMusFromPosViewdir(atm, _CameraPos, viewDir, _SunDir, r, mu, mu_s, nu);
float d1, d2;
bool ray_r_mu_intersects_ground = RayIntersectsGround(atm, r, mu, d1, d2);
CalculateRMuMusForDistancePoint(atm, r, mu, mu_s, nu, distance, r_d, mu_d, mu_s_d);
float3 transmittanceToTarget = GetTransmittanceLerped(
r, mu, distance, ray_r_mu_intersects_ground);
float3 scatteringBetween =
GetTotalScatteringLerped(r, mu, mu_s, nu, ray_r_mu_intersects_ground)
- GetTotalScatteringLerped(r_d, mu_d, mu_s_d, nu, ray_r_mu_intersects_ground) * transmittanceToTarget;
CameraVolumeTransmittance[id] = transmittanceToTarget;
CameraVolumeScattering[id] = scatteringBetween;
}

View file

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 2d4396a54b390d742b84d4bb4a122e54
ComputeShaderImporter:
externalObjects: {}
currentAPIMask: 4
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,276 +0,0 @@
#ifndef __COMMON_HELPER__
#define __COMMON_HELPER__
#define Length float
#define Wavelength float
#define Angle float
#define SolidAngle float
#define Power float
#define LuminousPower float
#define Number float
#define InverseLength float
#define Area float
#define Volume float
#define NumberDensity float
#define Irradiance float
#define Radiance float
#define SpectralPower float
#define SpectralIrradiance float
#define SpectralRadiance float
#define SpectralRadianceDensity float
#define ScatteringCoefficient float
#define InverseSolidAngle float
#define LuminousIntensity float
#define Luminance float
#define Illuminance float
// A generic function from Wavelength to some other type.
#define AbstractSpectrum vec3
// A function from Wavelength to Number.
#define DimensionlessSpectrum vec3
// A function from Wavelength to SpectralPower.
#define PowerSpectrum vec3
// A function from Wavelength to SpectralIrradiance.
#define IrradianceSpectrum vec3
// A function from Wavelength to SpectralRadiance.
#define RadianceSpectrum vec3
// A function from Wavelength to SpectralRadianceDensity.
#define RadianceDensitySpectrum vec3
// A function from Wavelength to ScaterringCoefficient.
#define ScatteringSpectrum vec3
// A position in 3D (3 length values).
#define Position vec3
// A unit direction vector in 3D (3 unitless values).
#define Direction vec3
// A vector of 3 luminance values.
#define Luminance3 half3
// A vector of 3 illuminance values.
#define Illuminance3 half3
#define TransmittanceTexture sampler2D
#define IrradianceTexture sampler2D
#define ScatteringTexture sampler3D
#define ScatteringDensityTexture sampler3D
#define ReducedScatteringTexture sampler3D
#define vec2 float2
#define vec3 float3
#define vec4 float4
#define IN(x) x
#define OUT(x) out x
#define assert(x) ;
static const Length m = 1.0f;
static const Wavelength nm = 1.0f;
static const Angle rad = 1.0f;
static const SolidAngle sr = 1.0;
static const Power watt = 1.0;
static const LuminousPower lm = 1.0;
static const float PI = 3.14159265358979323846;
static const Length km = 1000.0 * m;
static const Area m2 = m * m;
static const Volume m3 = m * m * m;
static const Angle pi = PI * rad;
static const Angle deg = pi / 180.0;
static const Irradiance watt_per_square_meter = watt / m2;
static const Radiance watt_per_square_meter_per_sr = watt / (m2 * sr);
static const SpectralIrradiance watt_per_square_meter_per_nm = watt / (m2 * nm);
static const SpectralRadiance watt_per_square_meter_per_sr_per_nm =
watt / (m2 * sr * nm);
static const SpectralRadianceDensity watt_per_cubic_meter_per_sr_per_nm =
watt / (m3 * sr * nm);
static const LuminousIntensity cd = lm / sr;
static const LuminousIntensity kcd = 1000.0 * cd;
static const Luminance cd_per_square_meter = cd / m2;
static const Luminance kcd_per_square_meter = kcd / m2;
struct AtmosphereParameters {
Length top_radius;
Length bottom_radius;
Number sun_angular_radius;
DimensionlessSpectrum rayleigh_scattering;
IrradianceSpectrum ground_albedo;
Number rayleigh_scale_height;
Number mie_scattering;
Number mie_extinction;
Number mie_scale_height;
DimensionlessSpectrum absorption_extinction;
Number absorption_extinction_scale_height;
Number solar_irradiance;
Number mu_s_min;
Number mie_phase_function_g;
};
AtmosphereParameters GetAtmosphereStruct(
float atmosphere_top_radius,
float atmosphere_bot_radius,
float atmosphere_sun_angular_radius,
DimensionlessSpectrum rayleigh_scattering,
Number rayleigh_scale_height,
Number mie_scattering,
Number mie_extinction,
Number mie_scale_height,
Number mie_phase_function_g,
DimensionlessSpectrum absorption_extinction,
Number absorption_extinction_scale_height
) {
AtmosphereParameters result;
result.top_radius = atmosphere_top_radius;
result.bottom_radius = atmosphere_bot_radius;
result.sun_angular_radius = atmosphere_sun_angular_radius;
result.rayleigh_scattering = rayleigh_scattering;
result.rayleigh_scale_height = rayleigh_scale_height;
result.mie_scattering = mie_scattering;
result.mie_extinction = mie_extinction;
result.mie_scale_height = mie_scale_height;
result.mie_phase_function_g = mie_phase_function_g;
result.absorption_extinction = absorption_extinction;
result.absorption_extinction_scale_height = absorption_extinction_scale_height;
result.solar_irradiance = 1.0f;
result.mu_s_min = -0.2f;
result.ground_albedo = float3(0.1, 0.1, 0.1);
return result;
}
Number ClampCosine(Number mu) {
return clamp(mu, Number(-1.0), Number(1.0));
}
Length ClampDistance(Length d) {
return max(d, 0.0);
}
Length ClampRadius(IN(AtmosphereParameters) atmosphere, Length r) {
return clamp(r, atmosphere.bottom_radius, atmosphere.top_radius);
}
Length SafeSqrt(Area a) {
return sqrt(max(a, 0.0));
}
Length DistanceToTopAtmosphereBoundary(IN(AtmosphereParameters) atmosphere,
Length r, Number mu) {
assert(r <= atmosphere.top_radius);
assert(mu >= -1.0 && mu <= 1.0);
Area discriminant = r * r * (mu * mu - 1.0) +
atmosphere.top_radius * atmosphere.top_radius;
return ClampDistance(-r * mu + SafeSqrt(discriminant));
}
Length DistanceToBottomAtmosphereBoundary(IN(AtmosphereParameters) atmosphere,
Length r, Number mu) {
assert(r >= atmosphere.bottom_radius);
assert(mu >= -1.0 && mu <= 1.0);
Area discriminant = r * r * (mu * mu - 1.0) +
atmosphere.bottom_radius * atmosphere.bottom_radius;
return ClampDistance(-r * mu - SafeSqrt(discriminant));
}
bool RayIntersectsGround(IN(AtmosphereParameters) atmosphere,
Length r, Number mu, OUT(Length) d_1, OUT(Length) d_2) {
assert(r >= atmosphere.bottom_radius);
assert(mu >= -1.0 && mu <= 1.0);
d_1 = 0.0;
d_2 = 0.0;
float discriminant = 4 * r * r * (mu * mu - 1.0) +
4 * atmosphere.bottom_radius * atmosphere.bottom_radius;
if (discriminant >= 0.0f) {
float sqDis = sqrt(discriminant);
d_1 = (-2.0f * r * mu - sqDis) / 2.0f;
d_2 = (-2.0f * r * mu + sqDis) / 2.0f;
}
return mu < 0.0 && discriminant >= 0.0;
}
bool RayIntersectsGround(IN(AtmosphereParameters) atmosphere,
Length r, Number mu) {
assert(r >= atmosphere.bottom_radius);
assert(mu >= -1.0 && mu <= 1.0);
return mu < 0.0 && r * r * (mu * mu - 1.0) +
atmosphere.bottom_radius * atmosphere.bottom_radius >= 0.0;
}
Number GetTextureCoordFromUnitRange(Number x, int texture_size) {
return 0.5 / Number(texture_size) + x * (1.0 - 1.0 / Number(texture_size));
}
Number GetUnitRangeFromTextureCoord(Number u, int texture_size) {
return (u - 0.5 / Number(texture_size)) / (1.0 - 1.0 / Number(texture_size));
}
Number GetScaleHeight(Length altitude, Length scale_height) {
return exp(-altitude / scale_height);
}
vec2 GetScaleHeight(Length altitude, vec2 scale_height_rayleigh_mie) {
return exp(-vec2(altitude, altitude) / scale_height_rayleigh_mie);
}
Length DistanceToNearestAtmosphereBoundary(IN(AtmosphereParameters) atmosphere,
Length r, Number mu, bool ray_r_mu_intersects_ground) {
if (ray_r_mu_intersects_ground) {
return DistanceToBottomAtmosphereBoundary(atmosphere, r, mu);
}
else {
return DistanceToTopAtmosphereBoundary(atmosphere, r, mu);
}
}
Number GetNuFromMuMus(float mu, float mu_s) {
return /*cos(a-b), where cos(a) == mu, cos(b) == mu_s*/ mu * mu_s + (1 - mu * mu) * (1 - mu_s * mu_s);
}
/*
Pass in variables.
*/
float atmosphere_top_radius;
float atmosphere_bot_radius;
float atmosphere_sun_angular_radius;
float3 rayleigh_scattering;
float rayleigh_scale_height;
float mie_scattering;
float mie_extinction;
float mie_scale_height;
float mie_phase_function_g;
float3 absorption_extinction;
float absorption_extinction_scale_height;
AtmosphereParameters GetAtmParameters() {
return GetAtmosphereStruct(
atmosphere_top_radius,
atmosphere_bot_radius,
atmosphere_sun_angular_radius,
rayleigh_scattering,
rayleigh_scale_height,
mie_scattering,
mie_extinction,
mie_scale_height,
mie_phase_function_g,
absorption_extinction,
absorption_extinction_scale_height
);
}
InverseSolidAngle RayleighPhaseFunction(Number nu) {
InverseSolidAngle k = 3.0 / (16.0 * PI * sr);
return k * (1.0 + nu * nu);
//return 0.8f * (1.4f + 0.5f * nu) / (4.0 * PI);
}
InverseSolidAngle AdhocRayleighPhaseFunction(Number nu) {
return 0.8f * (1.4f + 0.5f * nu) / (4.0 * PI * sr);
}
InverseSolidAngle MiePhaseFunction(Number g, Number nu) {
InverseSolidAngle k = 3.0 / (8.0 * PI * sr) * (1.0 - g * g) / (2.0 + g * g);
return k * (1.0 + nu * nu) / pow(abs(1.0 + g * g - 2.0 * g * nu), 1.5);
}
#endif

View file

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 498005b870bb3d74e8dafc015b3de52d
timeCreated: 1531897786
licenseType: Free
ShaderImporter:
externalObjects: {}
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,125 +0,0 @@
#ifndef __GROUND_HELPER__
#define __GROUND_HELPER__
#include "Common.cginc"
#include "TransmittanceHelper.cginc"
#include "MultipleScatteringHelper.cginc"
IrradianceSpectrum ComputeDirectIrradiance(
IN(AtmosphereParameters) atmosphere,
IN(TransmittanceTexture) transmittance_texture,
uint2 transmittance_size,
Length r, Number mu_s) {
assert(r >= atmosphere.bottom_radius && r <= atmosphere.top_radius);
assert(mu_s >= -1.0 && mu_s <= 1.0);
Number alpha_s = atmosphere.sun_angular_radius / rad;
// Approximate average of the cosine factor mu_s over the visible fraction of
// the Sun disc.
Number average_cosine_factor =
mu_s < -alpha_s ? 0.0 : (mu_s > alpha_s ? mu_s :
(mu_s + alpha_s) * (mu_s + alpha_s) / (4.0 * alpha_s));
return atmosphere.solar_irradiance *
GetTransmittanceToTopAtmosphereBoundary(
atmosphere, transmittance_texture, transmittance_size, r, mu_s) * average_cosine_factor;
}
IrradianceSpectrum ComputeIndirectIrradiance(
IN(AtmosphereParameters) atmosphere,
IN(ReducedScatteringTexture) single_rayleigh_scattering_texture,
IN(ReducedScatteringTexture) single_mie_scattering_texture,
IN(ScatteringTexture) multiple_scattering_texture,
uint3 scattering_size,
Length r, Number mu_s, int scattering_order) {
assert(r >= atmosphere.bottom_radius && r <= atmosphere.top_radius);
assert(mu_s >= -1.0 && mu_s <= 1.0);
assert(scattering_order >= 1);
const int SAMPLE_COUNT = 32;
const Angle dphi = pi / Number(SAMPLE_COUNT);
const Angle dtheta = pi / Number(SAMPLE_COUNT);
IrradianceSpectrum result =
IrradianceSpectrum(0.0, 0.0, 0.0);
vec3 omega_s = vec3(sqrt(1.0 - mu_s * mu_s), 0.0, mu_s);
for (int j = 0; j < SAMPLE_COUNT / 2; ++j) {
Angle theta = (Number(j) + 0.5) * dtheta;
for (int i = 0; i < 2 * SAMPLE_COUNT; ++i) {
Angle phi = (Number(i) + 0.5) * dphi;
vec3 omega =
vec3(cos(phi) * sin(theta), sin(phi) * sin(theta), cos(theta));
SolidAngle domega = (dtheta / rad) * (dphi / rad) * sin(theta) ;
Number nu = dot(omega, omega_s);
result += GetScattering(atmosphere, single_rayleigh_scattering_texture,
single_mie_scattering_texture, multiple_scattering_texture, scattering_size,
r, omega.z, mu_s, nu, false /* ray_r_theta_intersects_ground */,
scattering_order) *
omega.z * domega;
}
}
return result;
}
vec2 GetIrradianceTextureUvFromRMuS(IN(AtmosphereParameters) atmosphere,
Length r, Number mu_s, uint2 irradiance_size) {
assert(r >= atmosphere.bottom_radius && r <= atmosphere.top_radius);
assert(mu_s >= -1.0 && mu_s <= 1.0);
Number x_r = (r - atmosphere.bottom_radius) /
(atmosphere.top_radius - atmosphere.bottom_radius);
Number x_mu_s = mu_s * 0.5 + 0.5;
return vec2(GetTextureCoordFromUnitRange(x_mu_s, irradiance_size.x),
GetTextureCoordFromUnitRange(x_r, irradiance_size.y));
}
void GetRMuSFromIrradianceTextureUv(IN(AtmosphereParameters) atmosphere,
IN(vec2) uv, OUT(Length) r, OUT(Number) mu_s, uint2 irradiance_size) {
assert(uv.x >= 0.0 && uv.x <= 1.0);
assert(uv.y >= 0.0 && uv.y <= 1.0);
Number x_mu_s = GetUnitRangeFromTextureCoord(uv.x, irradiance_size.x);
Number x_r = GetUnitRangeFromTextureCoord(uv.y, irradiance_size.y);
r = atmosphere.bottom_radius +
x_r * (atmosphere.top_radius - atmosphere.bottom_radius);
mu_s = ClampCosine(2.0 * x_mu_s - 1.0);
}
IrradianceSpectrum GetIrradiance(
IN(AtmosphereParameters) atmosphere,
IN(IrradianceTexture) irradiance_texture,
uint2 irradiance_size,
Length r, Number mu_s) {
vec2 uv = GetIrradianceTextureUvFromRMuS(atmosphere, r, mu_s, irradiance_size);
return IrradianceSpectrum(tex2Dlod(irradiance_texture, float4(uv,0.0, 0.0)).rgb);
}
IrradianceSpectrum ComputeDirectIrradianceTexture(
IN(AtmosphereParameters) atmosphere,
IN(TransmittanceTexture) transmittance_texture,
uint2 transmittance_size,
IN(vec2) uv,
uint2 irrdiance_size) {
Length r;
Number mu_s;
GetRMuSFromIrradianceTextureUv(
atmosphere, uv, r, mu_s, irrdiance_size);
return ComputeDirectIrradiance(atmosphere, transmittance_texture, transmittance_size, r, mu_s);
}
IrradianceSpectrum ComputeIndirectIrradianceTexture(
IN(AtmosphereParameters) atmosphere,
IN(ReducedScatteringTexture) single_rayleigh_scattering_texture,
IN(ReducedScatteringTexture) single_mie_scattering_texture,
IN(ScatteringTexture) multiple_scattering_texture,
uint3 scattering_size,
IN(vec2) uv, int scattering_order, uint2 irrdiance_size) {
Length r;
Number mu_s;
GetRMuSFromIrradianceTextureUv(
atmosphere, uv, r, mu_s, irrdiance_size);
return ComputeIndirectIrradiance(atmosphere,
single_rayleigh_scattering_texture, single_mie_scattering_texture,
multiple_scattering_texture, scattering_size, r, mu_s, scattering_order);
}
#endif

View file

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: edb2696599cfe204d9a12cfa587afc0f
timeCreated: 1531897786
licenseType: Free
ShaderImporter:
externalObjects: {}
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,209 +0,0 @@
#ifndef __MULTIPLE_SCATTERING_HELPER__
#define __MULTIPLE_SCATTERING_HELPER__
#include "Common.cginc"
#include "TransmittanceHelper.cginc"
#include "SingleScatteringHelper.cginc"
IrradianceSpectrum GetIrradiance(
IN(AtmosphereParameters) atmosphere,
IN(IrradianceTexture) irradiance_texture, uint2 irradiance_size,
Length r, Number mu_s);
RadianceDensitySpectrum ComputeScatteringDensity(
IN(AtmosphereParameters) atmosphere,
IN(TransmittanceTexture) transmittance_texture,
uint2 transmittance_size,
IN(ReducedScatteringTexture) single_rayleigh_scattering_texture,
IN(ReducedScatteringTexture) single_mie_scattering_texture,
IN(ScatteringTexture) multiple_scattering_texture,
uint3 scattering_size,
IN(IrradianceTexture) irradiance_texture,
uint2 irradiance_size,
Length r, Number mu, Number mu_s, Number nu, int scattering_order) {
assert(r >= atmosphere.bottom_radius && r <= atmosphere.top_radius);
assert(mu >= -1.0 && mu <= 1.0);
assert(mu_s >= -1.0 && mu_s <= 1.0);
assert(scattering_order >= 2);
// Compute unit direction vectors for the zenith, the view direction omega and
// and the sun direction omega_s, such that the cosine of the view-zenith
// angle is mu, the cosine of the sun-zenith angle is mu_s, and the cosine of
// the view-sun angle is nu. The goal is to simplify computations below.
vec3 zenith_direction = vec3(0.0, 0.0, 1.0);
vec3 omega = vec3(sqrt(1.0 - mu * mu), 0.0, mu);
Number sun_dir_x = omega.x == 0.0 ? 0.0 : (nu - mu * mu_s) / omega.x;
Number sun_dir_y = sqrt(max(1.0 - sun_dir_x * sun_dir_x - mu_s * mu_s, 0.0));
vec3 omega_s = vec3(sun_dir_x, sun_dir_y, mu_s);
const int SAMPLE_COUNT = 16;
const Angle dphi = pi / Number(SAMPLE_COUNT);
const Angle dtheta = pi / Number(SAMPLE_COUNT);
RadianceDensitySpectrum rayleigh_mie =
RadianceDensitySpectrum(0.0, 0.0, 0.0);
// Nested loops for the integral over all the incident directions omega_i.
for (int l = 0; l < SAMPLE_COUNT; ++l) {
Angle theta = (Number(l) + 0.5) * dtheta;
Number cos_theta = cos(theta);
Number sin_theta = sin(theta);
bool ray_r_theta_intersects_ground =
RayIntersectsGround(atmosphere, r, cos_theta);
// The distance and transmittance to the ground only depend on theta, so we
// can compute them in the outer loop for efficiency.
Length distance_to_ground = 0.0 * m;
DimensionlessSpectrum transmittance_to_ground = DimensionlessSpectrum(0.0, 0.0, 0.0);
DimensionlessSpectrum ground_albedo = DimensionlessSpectrum(0.0, 0.0, 0.0);
if (ray_r_theta_intersects_ground) {
distance_to_ground =
DistanceToBottomAtmosphereBoundary(atmosphere, r, cos_theta);
transmittance_to_ground =
GetTransmittance(atmosphere, transmittance_texture, transmittance_size, r, cos_theta,
distance_to_ground, true /* ray_intersects_ground */);
ground_albedo = atmosphere.ground_albedo;
}
for (int m = 0; m < 2 * SAMPLE_COUNT; ++m) {
Angle phi = (Number(m) + 0.5) * dphi;
vec3 omega_i =
vec3(cos(phi) * sin_theta, sin(phi) * sin_theta, cos_theta);
SolidAngle domega_i = (dtheta / rad) * (dphi / rad) * sin(theta) * sr;
// The radiance L_i arriving from direction omega_i after n-1 bounces is
// the sum of a term given by the precomputed scattering texture for the
// (n-1)-th order:
Number nu1 = dot(omega_s, omega_i);
RadianceSpectrum incident_radiance = GetScattering(atmosphere,
single_rayleigh_scattering_texture, single_mie_scattering_texture,
multiple_scattering_texture, scattering_size, r, omega_i.z, mu_s, nu1,
ray_r_theta_intersects_ground, scattering_order - 1);
// and of the contribution from the light paths with n-1 bounces and whose
// last bounce is on the ground. This contribution is the product of the
// transmittance to the ground, the ground albedo, the ground BRDF, and
// the irradiance received on the ground after n-2 bounces.
vec3 ground_normal =
normalize(zenith_direction * r + omega_i * distance_to_ground);
IrradianceSpectrum ground_irradiance = GetIrradiance(
atmosphere, irradiance_texture, irradiance_size, atmosphere.bottom_radius,
dot(ground_normal, omega_s));
incident_radiance += transmittance_to_ground *
ground_albedo * (1.0 / (PI * sr)) * ground_irradiance;
// The radiance finally scattered from direction omega_i towards direction
// -omega is the product of the incident radiance, the scattering
// coefficient, and the phase function for directions omega and omega_i
// (all this summed over all particle types, i.e. Rayleigh and Mie).
Number nu2 = dot(omega, omega_i);
Number rayleigh_density = GetScaleHeight(
r - atmosphere.bottom_radius, atmosphere.rayleigh_scale_height);
Number mie_density = GetScaleHeight(
r - atmosphere.bottom_radius, atmosphere.mie_scale_height);
rayleigh_mie += incident_radiance * (
atmosphere.rayleigh_scattering * rayleigh_density *
RayleighPhaseFunction(nu2) +
atmosphere.mie_scattering * mie_density *
MiePhaseFunction(atmosphere.mie_phase_function_g, nu2)) *
domega_i;
}
}
return rayleigh_mie;
}
RadianceSpectrum ComputeMultipleScattering(
IN(AtmosphereParameters) atmosphere,
IN(TransmittanceTexture) transmittance_texture,
uint2 transmittance_size,
IN(ScatteringDensityTexture) scattering_density_texture,
uint3 scattering_size,
Length r, Number mu, Number mu_s, Number nu,
bool ray_r_mu_intersects_ground) {
assert(r >= atmosphere.bottom_radius && r <= atmosphere.top_radius);
assert(mu >= -1.0 && mu <= 1.0);
assert(mu_s >= -1.0 && mu_s <= 1.0);
// Number of intervals for the numerical integration.
const int SAMPLE_COUNT = 50;
// The integration step, i.e. the length of each integration interval.
Length dx =
DistanceToNearestAtmosphereBoundary(
atmosphere, r, mu, ray_r_mu_intersects_ground) /
Number(SAMPLE_COUNT);
// Integration loop.
RadianceSpectrum rayleigh_mie_sum =
RadianceSpectrum(0.0, 0.0, 0.0);
for (int i = 0; i <= SAMPLE_COUNT; ++i) {
Length d_i = Number(i) * dx;
// The r, mu and mu_s parameters at the current integration point (see the
// single scattering section for a detailed explanation).
Length r_i =
ClampRadius(atmosphere, sqrt(d_i * d_i + 2.0 * r * mu * d_i + r * r));
Number mu_i = ClampCosine((r * mu + d_i) / r_i);
Number mu_s_i = ClampCosine((r * mu_s + d_i * nu) / r_i);
// The Rayleigh and Mie multiple scattering at the current sample point.
RadianceSpectrum rayleigh_mie_i =
SampleScattering(
atmosphere, scattering_density_texture, scattering_size, r_i, mu_i, mu_s_i,
ray_r_mu_intersects_ground) *
GetTransmittance(
atmosphere, transmittance_texture, transmittance_size, r, mu, d_i,
ray_r_mu_intersects_ground) *
dx;
// Sample weight (from the trapezoidal rule).
Number weight_i = (i == 0 || i == SAMPLE_COUNT) ? 0.5 : 1.0;
rayleigh_mie_sum += rayleigh_mie_i * weight_i;
}
return rayleigh_mie_sum;
}
RadianceDensitySpectrum ComputeScatteringDensityTexture(
IN(AtmosphereParameters) atmosphere,
IN(TransmittanceTexture) transmittance_texture,
uint2 transmittance_size,
IN(ReducedScatteringTexture) single_rayleigh_scattering_texture,
IN(ReducedScatteringTexture) single_mie_scattering_texture,
IN(ScatteringTexture) multiple_scattering_texture,
uint3 scattering_size,
IN(IrradianceTexture) irradiance_texture,
uint2 irradiance_size,
IN(vec3) frag_coord, int scattering_order) {
Length r;
Number mu;
Number mu_s;
Number nu;
bool ray_r_mu_intersects_ground;
GetRMuMuSNuFromScatteringTextureUvwz(atmosphere, frag_coord,
r, mu, mu_s, ray_r_mu_intersects_ground, scattering_size);
nu = GetNuFromMuMus(mu, mu_s);
return ComputeScatteringDensity(atmosphere, transmittance_texture, transmittance_size,
single_rayleigh_scattering_texture, single_mie_scattering_texture,
multiple_scattering_texture, scattering_size, irradiance_texture, irradiance_size, r, mu, mu_s, nu,
scattering_order);
}
RadianceSpectrum ComputeMultipleScatteringTexture(
IN(AtmosphereParameters) atmosphere,
IN(TransmittanceTexture) transmittance_texture,
uint2 transmittance_size,
IN(ScatteringDensityTexture) scattering_density_texture,
uint3 scattering_size,
IN(vec3) frag_coord) {
Length r;
Number mu;
Number mu_s;
Number nu;
bool ray_r_mu_intersects_ground;
GetRMuMuSNuFromScatteringTextureUvwz(atmosphere, frag_coord,
r, mu, mu_s, ray_r_mu_intersects_ground, scattering_size);
nu = GetNuFromMuMus(mu, mu_s);
return ComputeMultipleScattering(atmosphere, transmittance_texture, transmittance_size,
scattering_density_texture, scattering_size, r, mu, mu_s, nu,
ray_r_mu_intersects_ground);
}
#endif

View file

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 1d94410a36635724f887c5648062ed59
timeCreated: 1531897786
licenseType: Free
ShaderImporter:
externalObjects: {}
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,245 +0,0 @@
#ifndef __SINGLE_SCATTERING_HELPER__
#define __SINGLE_SCATTERING_HELPER__
#include "Common.cginc"
#include "TransmittanceHelper.cginc"
void ComputeSingleScatteringIntegrand(
IN(AtmosphereParameters) atmosphere,
IN(TransmittanceTexture) transmittance_texture,
uint2 texture_size,
Length r, Number mu, Number mu_s, Number nu, Length d,
bool ray_r_mu_intersects_ground,
OUT(DimensionlessSpectrum) rayleigh, OUT(DimensionlessSpectrum) mie) {
Length r_d = ClampRadius(atmosphere, sqrt(d * d + 2.0 * r * mu * d + r * r));
Number mu_s_d = ClampCosine((r * mu_s + d * nu) / r_d);
DimensionlessSpectrum transmittance =
GetTransmittance(
atmosphere, transmittance_texture, texture_size, r, mu, d,
ray_r_mu_intersects_ground) *
GetTransmittanceToSun(
atmosphere, transmittance_texture, texture_size, r_d, mu_s_d);
rayleigh = transmittance * GetScaleHeight(r_d - atmosphere.bottom_radius, atmosphere.rayleigh_scale_height);
mie = transmittance * GetScaleHeight(r_d - atmosphere.bottom_radius, atmosphere.rayleigh_scale_height);
}
void ComputeSingleScattering(
IN(AtmosphereParameters) atmosphere,
IN(TransmittanceTexture) transmittance_texture,
uint2 texture_size,
Length r, Number mu, Number mu_s, Number nu,
bool ray_r_mu_intersects_ground,
OUT(IrradianceSpectrum) rayleigh, OUT(IrradianceSpectrum) mie) {
assert(r >= atmosphere.bottom_radius && r <= atmosphere.top_radius);
assert(mu >= -1.0 && mu <= 1.0);
assert(mu_s >= -1.0 && mu_s <= 1.0);
// Number of intervals for the numerical integration.
const int SAMPLE_COUNT = 50;
// The integration step, i.e. the length of each integration interval.
Length dx =
DistanceToNearestAtmosphereBoundary(atmosphere, r, mu,
ray_r_mu_intersects_ground) / Number(SAMPLE_COUNT);
// Integration loop.
DimensionlessSpectrum rayleigh_sum = DimensionlessSpectrum(0.0, 0.0, 0.0);
DimensionlessSpectrum mie_sum = DimensionlessSpectrum(0.0, 0.0, 0.0);
for (int i = 0; i <= SAMPLE_COUNT; ++i) {
Length d_i = Number(i) * dx;
// The Rayleigh and Mie single scattering at the current sample point.
DimensionlessSpectrum rayleigh_i;
DimensionlessSpectrum mie_i;
ComputeSingleScatteringIntegrand(atmosphere, transmittance_texture, texture_size,
r, mu, mu_s, nu, d_i, ray_r_mu_intersects_ground, rayleigh_i, mie_i);
// Sample weight (from the trapezoidal rule).
Number weight_i = (i == 0 || i == SAMPLE_COUNT) ? 0.5 : 1.0;
rayleigh_sum += rayleigh_i * weight_i;
mie_sum += mie_i * weight_i;
}
//Phase function terms are not added yet. See GetScattering.(And also, we need to store rayleigh and mie seprately, since they use different phase functions.)
rayleigh = rayleigh_sum * dx * atmosphere.solar_irradiance * atmosphere.rayleigh_scattering;
mie = mie_sum * dx * atmosphere.solar_irradiance * atmosphere.mie_scattering;
}
vec3 GetScatteringTextureUvwzFromRMuMuSNu(IN(AtmosphereParameters) atmosphere,
Length r, Number mu, Number mu_s, uint3 texture_size,
bool ray_r_mu_intersects_ground) {
assert(r >= atmosphere.bottom_radius && r <= atmosphere.top_radius);
assert(mu >= -1.0 && mu <= 1.0);
assert(mu_s >= -1.0 && mu_s <= 1.0);
// Distance to top atmosphere boundary for a horizontal ray at ground level.
Length H = sqrt(atmosphere.top_radius * atmosphere.top_radius -
atmosphere.bottom_radius * atmosphere.bottom_radius);
// Distance to the horizon.
Length rho =
SafeSqrt(r * r - atmosphere.bottom_radius * atmosphere.bottom_radius);
Number u_r = GetTextureCoordFromUnitRange(rho / H, texture_size.z);
// Discriminant of the quadratic equation for the intersections of the ray
// (r,mu) with the ground (see RayIntersectsGround).
Length r_mu = r * mu;
Area discriminant =
r_mu * r_mu - r * r + atmosphere.bottom_radius * atmosphere.bottom_radius;
Number u_mu;
if (ray_r_mu_intersects_ground) {
// Distance to the ground for the ray (r,mu), and its minimum and maximum
// values over all mu - obtained for (r,-1) and (r,mu_horizon).
Length d = -r_mu - SafeSqrt(discriminant);
Length d_min = r - atmosphere.bottom_radius;
Length d_max = rho;
u_mu = 0.5 - 0.5 * GetTextureCoordFromUnitRange(d_max == d_min ? 0.0 :
(d - d_min) / (d_max - d_min), texture_size.y / 2);
}
else {
// Distance to the top atmosphere boundary for the ray (r,mu), and its
// minimum and maximum values over all mu - obtained for (r,1) and
// (r,mu_horizon).
Length d = -r_mu + SafeSqrt(discriminant + H * H);
Length d_min = atmosphere.top_radius - r;
Length d_max = rho + H;
u_mu = 0.5 + 0.5 * GetTextureCoordFromUnitRange(
(d - d_min) / (d_max - d_min), texture_size.y / 2);
}
Length d = DistanceToTopAtmosphereBoundary(
atmosphere, atmosphere.bottom_radius, mu_s);
Length d_min = atmosphere.top_radius - atmosphere.bottom_radius;
Length d_max = H;
Number a = (d - d_min) / (d_max - d_min);
Number A =
-2.0 * atmosphere.mu_s_min * atmosphere.bottom_radius / (d_max - d_min);
Number u_mu_s = GetTextureCoordFromUnitRange(
max(1.0 - a / A, 0.0) / (1.0 + a), texture_size.x);
return vec3(u_mu_s, u_mu, u_r);
}
void GetRMuMuSNuFromScatteringTextureUvwz(IN(AtmosphereParameters) atmosphere,
IN(vec3) uvwz, OUT(Length) r, OUT(Number) mu, OUT(Number) mu_s, OUT(bool) ray_r_mu_intersects_ground,
uint3 scattering_size
) {
assert(uvwz.x >= 0.0 && uvwz.x <= 1.0);
assert(uvwz.y >= 0.0 && uvwz.y <= 1.0);
assert(uvwz.z >= 0.0 && uvwz.z <= 1.0);
// Distance to top atmosphere boundary for a horizontal ray at ground level.
Length H = sqrt(atmosphere.top_radius * atmosphere.top_radius -
atmosphere.bottom_radius * atmosphere.bottom_radius);
// Distance to the horizon.
Length rho =
H * GetUnitRangeFromTextureCoord(uvwz.z, scattering_size.z);
r = sqrt(rho * rho + atmosphere.bottom_radius * atmosphere.bottom_radius);
if (uvwz.y < 0.5) {
// Distance to the ground for the ray (r,mu), and its minimum and maximum
// values over all mu - obtained for (r,-1) and (r,mu_horizon) - from which
// we can recover mu:
Length d_min = r - atmosphere.bottom_radius;
Length d_max = rho;
Length d = d_min + (d_max - d_min) * GetUnitRangeFromTextureCoord(
1.0 - 2.0 * uvwz.y, scattering_size.y / 2);
mu = d == 0.0 * m ? Number(-1.0) :
ClampCosine(-(rho * rho + d * d) / (2.0 * r * d));
ray_r_mu_intersects_ground = true;
}
else {
// Distance to the top atmosphere boundary for the ray (r,mu), and its
// minimum and maximum values over all mu - obtained for (r,1) and
// (r,mu_horizon) - from which we can recover mu:
Length d_min = atmosphere.top_radius - r;
Length d_max = rho + H;
Length d = d_min + (d_max - d_min) * GetUnitRangeFromTextureCoord(
2.0 * uvwz.y - 1.0, scattering_size.y / 2);
mu = d == 0.0 * m ? Number(1.0) :
ClampCosine((H * H - rho * rho - d * d) / (2.0 * r * d));
ray_r_mu_intersects_ground = false;
}
Number x_mu_s =
GetUnitRangeFromTextureCoord(uvwz.x, scattering_size.x);
Length d_min = atmosphere.top_radius - atmosphere.bottom_radius;
Length d_max = H;
Number A =
-2.0 * atmosphere.mu_s_min * atmosphere.bottom_radius / (d_max - d_min);
Number a = (A - x_mu_s * A) / (1.0 + x_mu_s * A);
Length d = d_min + min(a, A) * (d_max - d_min);
mu_s = d == 0.0 * m ? Number(1.0) :
ClampCosine((H * H - d * d) / (2.0 * atmosphere.bottom_radius * d));
}
void ComputeSingleScatteringTexture(IN(AtmosphereParameters) atmosphere,
IN(TransmittanceTexture) transmittance_texture,
uint2 transmittance_size,
IN(vec3) gl_frag_coord,
uint3 scattering_size,
OUT(IrradianceSpectrum) rayleigh,
OUT(IrradianceSpectrum) mie) {
Length r;
Number mu;
Number mu_s;
bool ray_r_mu_intersects_ground;
GetRMuMuSNuFromScatteringTextureUvwz(atmosphere, gl_frag_coord,
r, mu, mu_s, ray_r_mu_intersects_ground, scattering_size);
Number nu = GetNuFromMuMus(mu, mu_s);
ComputeSingleScattering(atmosphere, transmittance_texture, transmittance_size,
r, mu, mu_s, nu, ray_r_mu_intersects_ground, rayleigh, mie);
}
RadianceSpectrum SampleScattering(
IN(AtmosphereParameters) atmosphere,
IN(ScatteringTexture) scattering_texture,
uint3 texture_size,
Length r, Number mu, Number mu_s, bool ray_r_mu_intersects_ground
) {
vec3 uvwz = GetScatteringTextureUvwzFromRMuMuSNu(
atmosphere, r, mu, mu_s, texture_size, ray_r_mu_intersects_ground);
return tex3Dlod(scattering_texture, float4(uvwz, 0.0)).rgb;
}
RadianceSpectrum SampleScatteringLerped(
IN(AtmosphereParameters) atmosphere,
IN(ScatteringTexture) scattering_texture,
IN(ScatteringTexture) scattering_texture_2,
float lerpValue,
uint3 texture_size,
Length r, Number mu, Number mu_s, bool ray_r_mu_intersects_ground
) {
vec3 uvwz = GetScatteringTextureUvwzFromRMuMuSNu(
atmosphere, r, mu, mu_s, texture_size, ray_r_mu_intersects_ground);
return lerp(tex3Dlod(scattering_texture, float4(uvwz, 0.0)).rgb, tex3Dlod(scattering_texture_2, float4(uvwz, 0.0)).rgb, lerpValue);
}
RadianceSpectrum GetScattering(
IN(AtmosphereParameters) atmosphere,
IN(ReducedScatteringTexture) single_rayleigh_scattering_texture,
IN(ReducedScatteringTexture) single_mie_scattering_texture,
IN(ScatteringTexture) multiple_scattering_texture,
uint3 texture_size,
Length r, Number mu, Number mu_s, Number nu,
bool ray_r_mu_intersects_ground,
int scattering_order
) {
if (scattering_order == 1) {
IrradianceSpectrum rayleigh = SampleScattering(
atmosphere, single_rayleigh_scattering_texture, texture_size, r, mu, mu_s,
ray_r_mu_intersects_ground);
IrradianceSpectrum mie = SampleScattering(
atmosphere, single_mie_scattering_texture, texture_size, r, mu, mu_s,
ray_r_mu_intersects_ground);
return rayleigh * RayleighPhaseFunction(nu) +
mie * MiePhaseFunction(atmosphere.mie_phase_function_g, nu);
}
else {
return SampleScattering(
atmosphere, multiple_scattering_texture, texture_size, r, mu, mu_s,
ray_r_mu_intersects_ground);
}
}
#endif

View file

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 2ef315dd659e48f49ab150ef0aed889b
timeCreated: 1531897786
licenseType: Free
ShaderImporter:
externalObjects: {}
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,108 +0,0 @@
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
Shader "Skybox/AtmosphereScatteringPrecomputed"
{
Properties
{
}
SubShader
{
// No culling or depth
Cull Off
ZWrite Off
Tags{
"PreviewType" = "Skybox"
}
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "Lighting.cginc"
#include "MultipleScatteringHelper.cginc"
#include "AerialPerspectiveHelper.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float4 worldPos : TEXCOORD1;
};
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
o.worldPos = mul(unity_ObjectToWorld, v.vertex);
return o;
}
float _LightScale;
RadianceSpectrum GetScattering(
IN(AtmosphereParameters) atmosphere,
IN(ScatteringTexture) scattering_texture,
uint3 texture_size,
Length r, Number mu, Number mu_s, bool ray_r_mu_intersects_ground
);
void ComputeSingleScattering(
IN(AtmosphereParameters) atmosphere,
IN(TransmittanceTexture) transmittance_texture,
uint2 texture_size,
Length r, Number mu, Number mu_s, Number nu,
bool ray_r_mu_intersects_ground,
OUT(IrradianceSpectrum) rayleigh, OUT(IrradianceSpectrum) mie);
half4 frag (v2f i) : SV_Target
{
i.worldPos /= i.worldPos.w;
float3 view_ray = normalize(i.worldPos.xyz - _WorldSpaceCameraPos);
float3 sun_direction = normalize(_WorldSpaceLightPos0.xyz);
AtmosphereParameters atm = GetAtmParameters();
float3 camera = _WorldSpaceCameraPos + float3(0, atm.bottom_radius, 0);
float r = length(camera);
r = max(r, atm.bottom_radius + 1.0f); //r below bottom_radius causes glitch.
Length rmu = dot(camera, view_ray);
Length distance_to_top_atmosphere_boundary = -rmu -
sqrt(rmu * rmu - r * r + atm.top_radius * atm.top_radius);
if (distance_to_top_atmosphere_boundary > 0.0 ) {
camera = camera + view_ray * distance_to_top_atmosphere_boundary;
r = atm.top_radius;
rmu += distance_to_top_atmosphere_boundary;
}
else if (r > atm.top_radius) {
// If the view ray does not intersect the atmosphere, simply return 0.
return 0.0f;
}
// Compute the r, mu, mu_s and nu parameters needed for the texture lookups.
Number mu = rmu / r;
Number mu_s = dot(camera, sun_direction) / r;
Number nu = dot(view_ray, sun_direction);
bool ray_r_mu_intersects_ground = RayIntersectsGround(atm, r, mu);
float3 transmittance = GetTransmittanceToTopAtmosphereBoundaryLerped(r, mu) * (ray_r_mu_intersects_ground ? 0.0f : 1.0f);
float3 direct_sun_strength = 0.0f;
if (!ray_r_mu_intersects_ground)
{
direct_sun_strength = EvaluateSunDiskRadianceOfUnitRadiance(atm, r, mu, nu) * transmittance;
}
return half4((direct_sun_strength + GetTotalScatteringLerped(r, mu, mu_s, nu, ray_r_mu_intersects_ground)), 0.0f);
}
ENDCG
}
}
}

View file

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: e2088dd19a71d1244976cd0de1ff68a7
timeCreated: 1531897513
licenseType: Free
ShaderImporter:
externalObjects: {}
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,144 +0,0 @@
#ifndef __TRANSMITTANCE_HELPER__
#define __TRANSMITTANCE_HELPER__
#include "Common.cginc"
vec2 GetTransmittanceTextureUvFromRMu(IN(AtmosphereParameters) atmosphere,
Length r, Number mu, uint2 texture_size) {
// Distance to top atmosphere boundary for a horizontal ray at ground level.
Length H = sqrt(atmosphere.top_radius * atmosphere.top_radius -
atmosphere.bottom_radius * atmosphere.bottom_radius);
// Distance to the horizon.
Length rho =
SafeSqrt(r * r - atmosphere.bottom_radius * atmosphere.bottom_radius);
// Distance to the top atmosphere boundary for the ray (r,mu), and its minimum
// and maximum values over all mu - obtained for (r,1) and (r,mu_horizon).
Length d = DistanceToTopAtmosphereBoundary(atmosphere, r, mu);
Length d_min = atmosphere.top_radius - r;
Length d_max = rho + H;
Number x_mu = (d - d_min) / (d_max - d_min);
Number x_r = rho / H;
return vec2(GetTextureCoordFromUnitRange(x_mu, texture_size.x),
GetTextureCoordFromUnitRange(x_r, texture_size.y));
}
void GetRMuFromTransmittanceTextureUv(IN(AtmosphereParameters) atmosphere,
IN(vec2) uv, OUT(Length) r, OUT(Number) mu, int TRANSMITTANCE_TEXTURE_WIDTH, int TRANSMITTANCE_TEXTURE_HEIGHT) {
assert(uv.x >= 0.0 && uv.x <= 1.0);
assert(uv.y >= 0.0 && uv.y <= 1.0);
Number x_mu = GetUnitRangeFromTextureCoord(uv.x, TRANSMITTANCE_TEXTURE_WIDTH);
Number x_r = GetUnitRangeFromTextureCoord(uv.y, TRANSMITTANCE_TEXTURE_HEIGHT);
// Distance to top atmosphere boundary for a horizontal ray at ground level.
Length H = sqrt(atmosphere.top_radius * atmosphere.top_radius -
atmosphere.bottom_radius * atmosphere.bottom_radius);
// Distance to the horizon, from which we can compute r:
Length rho = H * x_r;
r = sqrt(rho * rho + atmosphere.bottom_radius * atmosphere.bottom_radius);
// Distance to the top atmosphere boundary for the ray (r,mu), and its minimum
// and maximum values over all mu - obtained for (r,1) and (r,mu_horizon) -
// from which we can recover mu:
Length d_min = atmosphere.top_radius - r;
Length d_max = rho + H;
Length d = d_min + x_mu * (d_max - d_min);
mu = d == 0.0 ? Number(1.0) : (H * H - rho * rho - d * d) / (2.0 * r * d);
mu = ClampCosine(mu);
}
DimensionlessSpectrum GetTransmittanceToTopAtmosphereBoundary(
IN(AtmosphereParameters) atmosphere,
IN(TransmittanceTexture) transmittance_texture,
uint2 texture_size,
Length r, Number mu) {
assert(r >= atmosphere.bottom_radius && r <= atmosphere.top_radius);
vec2 uv = GetTransmittanceTextureUvFromRMu(atmosphere, r, mu, texture_size);
return DimensionlessSpectrum(tex2Dlod(transmittance_texture, float4(uv, 0, 0)).rgb);
}
DimensionlessSpectrum GetTransmittanceToSun(
IN(AtmosphereParameters) atmosphere,
IN(TransmittanceTexture) transmittance_texture,
uint2 texture_size,
Length r, Number mu_s) {
Number sin_theta_h = atmosphere.bottom_radius / r;
Number cos_theta_h = -sqrt(max(1.0 - sin_theta_h * sin_theta_h, 0.0));
return GetTransmittanceToTopAtmosphereBoundary(
atmosphere, transmittance_texture, texture_size, r, mu_s) *
smoothstep(-sin_theta_h * atmosphere.sun_angular_radius / rad,
sin_theta_h * atmosphere.sun_angular_radius / rad,
mu_s - cos_theta_h);
}
Length ComputeOpticalLengthToTopAtmosphereBoundary(
IN(AtmosphereParameters) atmosphere, Length r, Number mu, Length scale_height) {
assert(r >= atmosphere.bottom_radius && r <= atmosphere.top_radius);
assert(mu >= -1.0 && mu <= 1.0);
// Number of intervals for the numerical integration.
const int SAMPLE_COUNT = 500;
// The integration step, i.e. the length of each integration interval.
Length dx =
DistanceToTopAtmosphereBoundary(atmosphere, r, mu) / Number(SAMPLE_COUNT);
// Integration loop.
Length result = 0.0;
for (int i = 0; i <= SAMPLE_COUNT; ++i) {
Length d_i = Number(i) * dx;
// Distance between the current sample point and the planet center.
Length r_i = sqrt(d_i * d_i + 2.0 * r * mu * d_i + r * r);
// Number density at the current sample point (divided by the number density
// at the bottom of the atmosphere, yielding a dimensionless number).
Number y_i = GetScaleHeight(r_i - atmosphere.bottom_radius, scale_height);
// Sample weight (from the trapezoidal rule).
Number weight_i = i == 0 || i == SAMPLE_COUNT ? 0.5 : 1.0;
result += y_i * weight_i * dx;
}
return result;
}
DimensionlessSpectrum ComputeTransmittanceToTopAtmosphereBoundary(
IN(AtmosphereParameters) atmosphere, Length r, Number mu) {
assert(r >= atmosphere.bottom_radius && r <= atmosphere.top_radius);
assert(mu >= -1.0 && mu <= 1.0);
return exp(-(
atmosphere.rayleigh_scattering *
ComputeOpticalLengthToTopAtmosphereBoundary(
atmosphere, r, mu, atmosphere.rayleigh_scale_height) +
atmosphere.mie_extinction *
ComputeOpticalLengthToTopAtmosphereBoundary(
atmosphere, r, mu, atmosphere.mie_scale_height) +
atmosphere.absorption_extinction *
ComputeOpticalLengthToTopAtmosphereBoundary(
atmosphere, r, mu, atmosphere.absorption_extinction_scale_height)
)
);
}
DimensionlessSpectrum GetTransmittance(
IN(AtmosphereParameters) atmosphere,
IN(TransmittanceTexture) transmittance_texture,
uint2 texture_size,
Length r, Number mu, Length d, bool ray_r_mu_intersects_ground) {
assert(r >= atmosphere.bottom_radius && r <= atmosphere.top_radius);
assert(mu >= -1.0 && mu <= 1.0);
assert(d >= 0.0 * m);
Length r_d = ClampRadius(atmosphere, sqrt(d * d + 2.0 * r * mu * d + r * r));
Number mu_d = ClampCosine((r * mu + d) / r_d);
if (ray_r_mu_intersects_ground) {
return min(
GetTransmittanceToTopAtmosphereBoundary(
atmosphere, transmittance_texture, texture_size, r_d, -mu_d) /
GetTransmittanceToTopAtmosphereBoundary(
atmosphere, transmittance_texture, texture_size, r, -mu),
DimensionlessSpectrum(1.0, 1.0, 1.0));
}
else {
return min(
GetTransmittanceToTopAtmosphereBoundary(
atmosphere, transmittance_texture, texture_size, r, mu) /
GetTransmittanceToTopAtmosphereBoundary(
atmosphere, transmittance_texture, texture_size, r_d, mu_d),
DimensionlessSpectrum(1.0, 1.0, 1.0));
}
}
#endif

View file

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: c7015e6cfed6e2e46992e2af76282301
timeCreated: 1531897786
licenseType: Free
ShaderImporter:
externalObjects: {}
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,58 +0,0 @@
Shader "Unlit/VolumeTexturePreview"
{
Properties
{
_MainTex ("Texture", 3D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
float4 worldPos : TEXCOORD1;
};
sampler3D _MainTex;
float4 _MainTex_ST;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.worldPos = mul(unity_ObjectToWorld, v.vertex);
UNITY_TRANSFER_FOG(o,o.vertex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
// sample the texture
fixed4 col = tex3D(_MainTex, i.worldPos / i.worldPos.w);
return col;
}
ENDCG
}
}
}

View file

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: e6e68121d3504774dbf546d1f331c83a
ShaderImporter:
externalObjects: {}
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 37b0cb2f245dc7b4cb3dda322844678e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,526 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 8
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.17984006, g: 0.22517684, b: 0.3066335, a: 1}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 0
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 9
m_Resolution: 2
m_BakeResolution: 40
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVRFilteringMode: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &7102893
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 7102896}
- component: {fileID: 7102895}
- component: {fileID: 7102894}
- component: {fileID: 7102898}
- component: {fileID: 7102897}
- component: {fileID: 7102899}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &7102894
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 7102893}
m_Enabled: 1
--- !u!20 &7102895
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 7102893}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 10000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 0
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &7102896
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 7102893}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -172.5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &7102897
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 7102893}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ff26db721962cdf4a8edcdfa9a767d2a, type: 3}
m_Name:
m_EditorClassIdentifier:
profile: {fileID: 11400000, guid: 16ee1eaff8bdab6429f048d7a5b1d15f, type: 2}
--- !u!114 &7102898
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 7102893}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 45d85419f2e23c540999c1a1fee6ed90, type: 3}
m_Name:
m_EditorClassIdentifier:
distance: 10
center: {x: 0, y: 0, z: 0}
scale: 1
distanceSpeed: 0.1
rotationSpeed: 0.1
--- !u!114 &7102899
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 7102893}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b535dacf702e20c4b9ef528e42081835, type: 3}
m_Name:
m_EditorClassIdentifier:
volumeTexSize: {x: 128, y: 128, z: 32}
--- !u!1 &74323546
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 74323548}
- component: {fileID: 74323547}
- component: {fileID: 74323549}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &74323547
Light:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 74323546}
m_Enabled: 1
serializedVersion: 8
m_Type: 1
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 4
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &74323548
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 74323546}
m_LocalRotation: {x: 0.43573615, y: -0, z: -0, w: 0.9000745}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 51.664, y: 0, z: 0}
--- !u!114 &74323549
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 74323546}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 325c269146dc2ac49b190f730a961573, type: 3}
m_Name:
m_EditorClassIdentifier:
basePosition: {x: 0, y: 50, z: 0}
--- !u!1 &297555710
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 297555712}
- component: {fileID: 297555711}
m_Layer: 0
m_Name: LutManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &297555711
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 297555710}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e16dd2ddbdfa7ea4f87a3cfb032ffd0f, type: 3}
m_Name:
m_EditorClassIdentifier:
computeShader: {fileID: 7200000, guid: 2d4396a54b390d742b84d4bb4a122e54, type: 3}
outputDebug: 0
lutConfig:
transmittanceSize: {x: 256, y: 128}
scatteringSize: {x: 32, y: 128, z: 32}
irradianceSize: {x: 64, y: 32}
cameraVolumeSize: {x: 128, y: 128, z: 32}
atmosphereConfig: {fileID: 11400000, guid: 8e73e89daf00b8447b2410427953df25, type: 2}
skyboxMaterial: {fileID: 0}
--- !u!4 &297555712
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 297555710}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 2.736024, y: 2.8123064, z: -0.70711327}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &563571916
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 563571920}
- component: {fileID: 563571919}
- component: {fileID: 563571918}
- component: {fileID: 563571917}
m_Layer: 0
m_Name: Opaque
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!23 &563571917
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 563571916}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 2100000, guid: 222fb78855dcd5c42b991cd095da28fa, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!65 &563571918
BoxCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 563571916}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!33 &563571919
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 563571916}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &563571920
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 563571916}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 2484, y: 1, z: -4.01}
m_LocalScale: {x: 1655.8981, y: 82.79491, z: 1655.8981}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1764631964
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1764631968}
- component: {fileID: 1764631967}
- component: {fileID: 1764631966}
- component: {fileID: 1764631965}
m_Layer: 0
m_Name: Transparent
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!23 &1764631965
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1764631964}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 2100000, guid: b928a4c54f20eaa458c853f105a16f9a, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!65 &1764631966
BoxCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1764631964}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!33 &1764631967
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1764631964}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1764631968
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1764631964}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -4.01}
m_LocalScale: {x: 1655.8981, y: 82.79491, z: 1655.8981}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View file

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 694a3c0c25cb46646891cc9878b1ee07
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,76 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Opaque
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0, g: 0, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View file

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 222fb78855dcd5c42b991cd095da28fa
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,76 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Transparent-Ap
m_Shader: {fileID: 4800000, guid: 7060206adfb8023499f89d502c3431fa, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0, g: 0, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View file

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: b928a4c54f20eaa458c853f105a16f9a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,100 +0,0 @@
Shader "Ap/TransparentExample" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader {
Tags {
"RenderType"="Transparent"
"Queue" = "Transparent"
}
LOD 200
CGPROGRAM
//We enable alpha to use transparent
//Use finalcolor modifier to add ap to final result.
//And we need custom vs to calculate ap info on every vertex.
#pragma surface surf Standard fullforwardshadows alpha finalcolor:aerialPerspective vertex:vert
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
//Declare these values to use later.
float3 _SunIrradianceOnAtm;
sampler3D _CameraVolumeTransmittance;
sampler3D _CameraVolumeScattering;
float3 GetTransmittanceWithCameraVolume(float3 uvw) {
return tex3Dlod(_CameraVolumeTransmittance, float4(uvw, 0.0f)).rgb;
}
float3 GetScatteringWithCameraVolume(float3 uvw) {
return tex3Dlod(_CameraVolumeScattering, float4(uvw, 0.0f)).rgb;
}
struct Input {
float2 uv_MainTex;
//Add these two to interpolate. Sample them from 3d volume in vertex shader.
float3 ap_transmittance;
float3 ap_scattering;
};
void vert(inout appdata_full v, out Input o) {
UNITY_INITIALIZE_OUTPUT(Input, o);
//Get uv using clip pos.
float4 hpos = UnityObjectToClipPos(v.vertex);
float3 ap_volume_uvw = float3(hpos.xy / hpos.w, 0.0f);
ap_volume_uvw.xy = (ap_volume_uvw + 1.0f) / 2.0f;
//Get w using view pos.
float3 view_pos = UnityObjectToViewPos(v.vertex);
view_pos.z *= -1;
ap_volume_uvw.z = (view_pos.z - _ProjectionParams.y) / (_ProjectionParams.z - _ProjectionParams.y);
//Set them to output.
o.ap_transmittance = GetTransmittanceWithCameraVolume(ap_volume_uvw);
o.ap_scattering = GetScatteringWithCameraVolume(ap_volume_uvw);
}
void aerialPerspective(Input IN, SurfaceOutputStandard o, inout fixed4 color)
{
//Edit final color using following formular.
color.xyz = color.xyz * IN.ap_transmittance + color.a * IN.ap_scattering * _SunIrradianceOnAtm;
//I'm not pretty familiar with how Unity deal with Transparent and alpha, but it seems to be correct to mult scattering with color.a
}
//========================================================================
//Following are default standard shader setup. Nothing changed.
//========================================================================
sampler2D _MainTex;
half _Glossiness;
half _Metallic;
fixed4 _Color;
// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
// #pragma instancing_options assumeuniformscaling
UNITY_INSTANCING_BUFFER_START(Props)
// put more per-instance properties here
UNITY_INSTANCING_BUFFER_END(Props)
void surf (Input IN, inout SurfaceOutputStandard o) {
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
// Metallic and smoothness come from slider variables
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}

View file

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 7060206adfb8023499f89d502c3431fa
ShaderImporter:
externalObjects: {}
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: f7a5905754299444c8c54e4e59668749
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: a5355ed4c7ace6e4194bb0c52fd10fc3
folderAsset: yes
timeCreated: 1521966588
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: ff23f3c539d9073408464e0039314ed5
timeCreated: 1521972532
licenseType: Free
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,141 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System;
namespace Yangrc.VolumeCloud {
public class VolumeCloudWindowEditor : EditorWindow {
private VolumeCloudWindowConfigurations config {
get {
if (_config == null) {
_config = AssetDatabase.LoadAssetAtPath<VolumeCloudWindowConfigurations>("Assets/VolumeCloud/Editor/Config.asset");
if (_config == null) {
var newConfig = ScriptableObject.CreateInstance<VolumeCloudWindowConfigurations>();
AssetDatabase.CreateAsset(newConfig, "Assets/VolumeCloud/Editor/Config.asset");
// AssetDatabase.IsValidFolder(
this._config = newConfig;
}
}
return _config;
}
}
private VolumeCloudWindowConfigurations _config;
private SerializedObject configSO {
get {
return _configSO ?? (_configSO = new SerializedObject(config));
}
}
private SerializedObject _configSO;
private Texture2D testTexPreview;
private Texture2D firstTexPreview;
private Texture2D secondTexPreview;
private Vector2 scrollPos;
// Add menu named "My Window" to the Window menu
[MenuItem("Window/VolumeCloud")]
static void Init() {
// Get existing open window or if none, make a new one:
VolumeCloudWindowEditor window = (VolumeCloudWindowEditor)EditorWindow.GetWindow(typeof(VolumeCloudWindowEditor));
window.Show();
}
private void OnGUI() {
EditorGUI.BeginChangeCheck();
scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(position.width), GUILayout.Height(position.height));
//Test only.
EditorGUILayout.BeginHorizontal();//Second 3d tex.
{
EditorGUILayout.BeginVertical();
{ //Config area.
EditorGUILayout.PropertyField(configSO.FindProperty("testGenerator"), true);
if (GUILayout.Button("Save tex")) {
var texture = Utils.GetTex(config.testGenerator, 128, TextureFormat.RGB24);
AssetDatabase.CreateAsset(texture, "Assets/VolumeCloud/" + "TestTex" + ".asset");
AssetDatabase.SaveAssets();
}
}
EditorGUILayout.EndVertical();
if (configSO.FindProperty("testGenerator").isExpanded) {
EditorGUILayout.BeginVertical(GUILayout.Width(256.0f)); //Preview Area
{
if (GUILayout.Button("Preview")) {
testTexPreview = Utils.GetPreviewTex(config.testGenerator, 128, TextureFormat.RGFloat);
}
if (GUILayout.Button("Save preview")) {
AssetDatabase.CreateAsset(testTexPreview, "Assets/VolumeCloud/" + "curlNoise" + ".asset");
AssetDatabase.SaveAssets();
}
if (testTexPreview != null) {
GUI.DrawTexture(EditorGUILayout.GetControlRect(false, GUILayout.Width(256.0f), GUILayout.Height(256.0f)), testTexPreview);
}
}
EditorGUILayout.EndVertical();
}
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();// First 3d texture.
{
EditorGUILayout.BeginVertical();
{ //Config area.
EditorGUILayout.PropertyField(configSO.FindProperty("first3DTexGenerator"), true);
if (configSO.FindProperty("first3DTexGenerator").isExpanded) {
EditorGUILayout.PropertyField(configSO.FindProperty("first3DTexSaveName"));
if (GUILayout.Button("Save tex")) {
var texture = Utils.GetTex(config.first3DTexGenerator, config.first3DTexGenerator.texResolution);
AssetDatabase.CreateAsset(texture, "Assets/VolumeCloud/" + config.first3DTexSaveName + ".asset");
AssetDatabase.SaveAssets();
}
}
}
EditorGUILayout.EndVertical();
EditorGUILayout.BeginVertical(GUILayout.Width(256.0f)); ;
{
if (GUILayout.Button("Preview"))
firstTexPreview = Utils.GetPreviewTex(config.first3DTexGenerator, config.first3DTexGenerator.texResolution);
if (firstTexPreview != null)
GUI.DrawTexture(EditorGUILayout.GetControlRect(false, GUILayout.Width(256.0f), GUILayout.Height(256.0f)), firstTexPreview);
}
EditorGUILayout.EndVertical();
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();//Second 3d tex.
{
EditorGUILayout.BeginVertical();
{ //Config area.
EditorGUILayout.PropertyField(configSO.FindProperty("second3DTexGenerator"), true);
if (configSO.FindProperty("second3DTexGenerator").isExpanded) {
EditorGUILayout.PropertyField(configSO.FindProperty("second3DTexSaveName"));
if (GUILayout.Button("Save tex")) {
var texture = Utils.GetTex(config.second3DTexGenerator, config.second3DTexGenerator.texResolution, TextureFormat.RGB24);
AssetDatabase.CreateAsset(texture, "Assets/VolumeCloud/" + config.second3DTexSaveName + ".asset");
AssetDatabase.SaveAssets();
}
}
}
EditorGUILayout.EndVertical();
EditorGUILayout.BeginVertical(GUILayout.Width(256.0f)); //Preview Area
{
if (GUILayout.Button("Preview")) {
secondTexPreview = Utils.GetPreviewTex(config.second3DTexGenerator, config.second3DTexGenerator.texResolution);
}
if (secondTexPreview != null) {
GUI.DrawTexture(EditorGUILayout.GetControlRect(false, GUILayout.Width(256.0f), GUILayout.Height(256.0f)), secondTexPreview);
}
}
EditorGUILayout.EndVertical();
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.EndScrollView();
if (EditorGUI.EndChangeCheck()) {
configSO.ApplyModifiedProperties();
}
}
}
}

View file

@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: 7adc29af50ded2b4a90b86b7df94be23
timeCreated: 1521969753
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 2cc7484e5816b124a98120309af6a4e7
folderAsset: yes
timeCreated: 1530938310
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 4aad6993da61d5549913dd868a11e328
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,594 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 1432092516}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 49040651}
m_IndirectSpecularColor: {r: 0.019927999, g: 0.037775546, b: 0.06939693, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 0
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 500
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 2
m_PVRDenoiserTypeDirect: 0
m_PVRDenoiserTypeIndirect: 0
m_PVRDenoiserTypeAO: 0
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 0
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &49040650
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 49040652}
- component: {fileID: 49040651}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &49040651
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 49040650}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 0.95686275, g: 0.6813293, b: 0.3865726, a: 1}
m_Intensity: 2.02
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &49040652
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 49040650}
m_LocalRotation: {x: -0.9797308, y: -0.13232979, z: 0.05140217, w: -0.1413304}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 523.11, y: -716.206, z: -14.820984}
--- !u!1 &636899334
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 636899336}
- component: {fileID: 636899335}
- component: {fileID: 636899337}
m_Layer: 8
m_Name: AtmManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &636899335
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 636899334}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e16dd2ddbdfa7ea4f87a3cfb032ffd0f, type: 3}
m_Name:
m_EditorClassIdentifier:
progressiveUpdate: 0
computeShader: {fileID: 7200000, guid: 2d4396a54b390d742b84d4bb4a122e54, type: 3}
outputDebug: 0
lutConfig:
transmittanceSize: {x: 512, y: 512}
scatteringSize: {x: 32, y: 32, z: 128}
irradianceSize: {x: 32, y: 32}
cameraVolumeSize: {x: 128, y: 128, z: 32}
atmosphereConfig: {fileID: 11400000, guid: 8e73e89daf00b8447b2410427953df25, type: 2}
--- !u!4 &636899336
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 636899334}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &636899337
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 636899334}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8b9a305e18de0c04dbd257a21cd47087, type: 3}
m_Name:
m_EditorClassIdentifier:
sharedProfile: {fileID: 11400000, guid: fb5c6f5333d1578418cdc5074b1c900e, type: 2}
isGlobal: 1
blendDistance: 0
weight: 1
priority: 0
--- !u!21 &1432092516
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Skybox/AtmosphereScatteringPrecomputed
m_Shader: {fileID: 4800000, guid: e2088dd19a71d1244976cd0de1ff68a7, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs: []
m_Floats: []
m_Colors: []
--- !u!1 &1662884154
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1662884158}
- component: {fileID: 1662884157}
- component: {fileID: 1662884156}
- component: {fileID: 1662884155}
m_Layer: 0
m_Name: Sphere
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!135 &1662884155
SphereCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1662884154}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Radius: 0.5
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1662884156
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1662884154}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &1662884157
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1662884154}
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1662884158
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1662884154}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -11124, y: -397, z: 5874}
m_LocalScale: {x: 7556.414, y: 7556.414, z: 7556.414}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1748146228
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1748146232}
- component: {fileID: 1748146231}
- component: {fileID: 1748146229}
- component: {fileID: 1748146234}
- component: {fileID: 1748146230}
- component: {fileID: 1748146236}
- component: {fileID: 1748146235}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1748146229
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 1
--- !u!114 &1748146230
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3}
m_Name:
m_EditorClassIdentifier:
volumeTrigger: {fileID: 1748146232}
volumeLayer:
serializedVersion: 2
m_Bits: 256
stopNaNPropagation: 1
finalBlitToCameraTarget: 0
antialiasingMode: 3
temporalAntialiasing:
jitterSpread: 0.75
sharpness: 0.25
stationaryBlending: 0.95
motionBlending: 0.85
subpixelMorphologicalAntialiasing:
quality: 2
fastApproximateAntialiasing:
fastMode: 0
keepAlpha: 0
fog:
enabled: 1
excludeSkybox: 1
debugLayer:
lightMeter:
width: 512
height: 256
showCurves: 1
histogram:
width: 512
height: 256
channel: 3
waveform:
exposure: 0.12
height: 256
vectorscope:
size: 256
exposure: 0.12
overlaySettings:
linearDepth: 0
motionColorIntensity: 4
motionGridSize: 64
colorBlindnessType: 0
colorBlindnessStrength: 1
m_Resources: {fileID: 11400000, guid: d82512f9c8e5d4a4d938b575d47f88d4, type: 2}
m_ShowToolkit: 0
m_ShowCustomSorter: 0
breakBeforeColorGrading: 0
m_BeforeTransparentBundles: []
m_BeforeStackBundles: []
m_AfterStackBundles: []
--- !u!20 &1748146231
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 100
far clip plane: 10000
field of view: 75
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 0
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1748146232
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_LocalRotation: {x: 0.14780942, y: 0, z: 0, w: 0.9890159}
m_LocalPosition: {x: -10082, y: 4927.1, z: -2027}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 17, y: 0, z: 0}
--- !u!114 &1748146234
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9f1db61281524fb40bc9a1f6acce6baf, type: 3}
m_Name:
m_EditorClassIdentifier:
configuration: {fileID: 11400000, guid: a15886e93ac3e7847861da392782f13d, type: 2}
downSample: 0
quality: 2
allowCloudFrontObject: 1
useApSystem: 0
useHierarchicalHeightMap: 1
cloudShader: {fileID: 4800000, guid: 84e97169589c5e94e8521fe4deb2e3f8, type: 3}
heightPreprocessShader: {fileID: 7200000, guid: 40276bd53f35a694e8d4e025ca310775,
type: 3}
cloudHeightProcessShader: {fileID: 4800000, guid: b80bf04ca56d3d642a6b925cff3f5ddf,
type: 3}
--- !u!114 &1748146235
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0a9c4d2e823dfc247b2f6850f76ca2b6, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &1748146236
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b535dacf702e20c4b9ef528e42081835, type: 3}
m_Name:
m_EditorClassIdentifier:
volumeTexSize: {x: 128, y: 128, z: 32}

View file

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: e4a8c6ec9e196d241854a4ff221a28fd
timeCreated: 1521964013
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: fc2731fc466427a429629ea6bd19ebd5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: fb5c6f5333d1578418cdc5074b1c900e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: d8eb8b025c1be6d409d9e1745b9214dc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: e9b06b77cd78e5e4b95a6ca30e5f61e7
timeCreated: 1524043690
licenseType: Free
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,329 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 8
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 49040651}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 9
m_Resolution: 2
m_BakeResolution: 40
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 0
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVRFilteringMode: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &49040650
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 49040652}
- component: {fileID: 49040651}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &49040651
Light:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 49040650}
m_Enabled: 1
serializedVersion: 8
m_Type: 1
m_Color: {r: 1, g: 0.96572006, b: 0.9044118, a: 1}
m_Intensity: 1.2
m_Range: 10
m_SpotAngle: 30
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 4
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &49040652
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 49040650}
m_LocalRotation: {x: -0.52715605, y: 0.67356503, z: -0.4896874, w: -0.16918293}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 56.934002, y: 148.093, z: -93.717}
--- !u!1 &466916245
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 466916246}
m_Layer: 0
m_Name: GameObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &466916246
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 466916245}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -317.8709, y: 20000, z: -159.77051}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1748146228
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1748146232}
- component: {fileID: 1748146231}
- component: {fileID: 1748146229}
- component: {fileID: 1748146234}
- component: {fileID: 1748146233}
- component: {fileID: 1748146235}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1748146229
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 1
--- !u!20 &1748146231
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 2000
field of view: 75
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 0
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1748146232
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_LocalRotation: {x: -0.46222746, y: -0, z: -0, w: 0.8867614}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: -55.062004, y: 0, z: 0}
--- !u!114 &1748146233
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ff26db721962cdf4a8edcdfa9a767d2a, type: 3}
m_Name:
m_EditorClassIdentifier:
profile: {fileID: 11400000, guid: cdea7d3b49937774abb1b5ac066885fd, type: 2}
--- !u!114 &1748146234
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9f1db61281524fb40bc9a1f6acce6baf, type: 3}
m_Name:
m_EditorClassIdentifier:
configuration: {fileID: 11400000, guid: e9b06b77cd78e5e4b95a6ca30e5f61e7, type: 2}
downSample: 1
quality: 0
allowCloudFrontObject: 0
useApSystem: 0
useHierarchicalHeightMap: 1
cloudShader: {fileID: 4800000, guid: 84e97169589c5e94e8521fe4deb2e3f8, type: 3}
heightPreprocessShader: {fileID: 7200000, guid: 40276bd53f35a694e8d4e025ca310775,
type: 3}
cloudHeightProcessShader: {fileID: 4800000, guid: b80bf04ca56d3d642a6b925cff3f5ddf,
type: 3}
--- !u!114 &1748146235
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0a9c4d2e823dfc247b2f6850f76ca2b6, type: 3}
m_Name:
m_EditorClassIdentifier:

View file

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 205c2599ca8ee4044b11f8dc389561bb
timeCreated: 1521964013
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: bdd062e9efb56944aafb26f002f99adc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 5482a95b5c1b69341ba5938fccd5a25d
timeCreated: 1524043690
licenseType: Free
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,303 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 8
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 49040651}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 9
m_Resolution: 2
m_BakeResolution: 40
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 0
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVRFilteringMode: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &49040650
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 49040652}
- component: {fileID: 49040651}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &49040651
Light:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 49040650}
m_Enabled: 1
serializedVersion: 8
m_Type: 1
m_Color: {r: 1, g: 0.96572006, b: 0.9044118, a: 1}
m_Intensity: 1.2
m_Range: 10
m_SpotAngle: 30
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 4
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &49040652
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 49040650}
m_LocalRotation: {x: -0.1651658, y: -0.7798415, z: 0.17655866, w: -0.5774034}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 512.218, y: -792.172, z: -176.519}
--- !u!1 &1748146228
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1748146232}
- component: {fileID: 1748146231}
- component: {fileID: 1748146229}
- component: {fileID: 1748146234}
- component: {fileID: 1748146233}
- component: {fileID: 1748146235}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1748146229
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 1
--- !u!20 &1748146231
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 2000
field of view: 75
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 0
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1748146232
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_LocalRotation: {x: 0.22376823, y: 0.09239381, z: 0.021313809, w: -0.970019}
m_LocalPosition: {x: 1417, y: 0, z: -426}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: -25.980001, y: -370.882, z: 0}
--- !u!114 &1748146233
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ff26db721962cdf4a8edcdfa9a767d2a, type: 3}
m_Name:
m_EditorClassIdentifier:
profile: {fileID: 11400000, guid: cdea7d3b49937774abb1b5ac066885fd, type: 2}
--- !u!114 &1748146234
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9f1db61281524fb40bc9a1f6acce6baf, type: 3}
m_Name:
m_EditorClassIdentifier:
cloudShader: {fileID: 4800000, guid: 84e97169589c5e94e8521fe4deb2e3f8, type: 3}
configuration: {fileID: 11400000, guid: 5482a95b5c1b69341ba5938fccd5a25d, type: 2}
downSample: 1
quality: 0
allowCloudFrontObject: 1
useApSystem: 0
heightPreprocessShader: {fileID: 7200000, guid: 40276bd53f35a694e8d4e025ca310775,
type: 3}
cloudHeightProcessShader: {fileID: 4800000, guid: b80bf04ca56d3d642a6b925cff3f5ddf,
type: 3}
useHierarchicalHeightMap: 1
hiHeightLevelRange: {x: 0, y: 9}
heightLutTextureSize: {x: 512, y: 512}
--- !u!114 &1748146235
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0a9c4d2e823dfc247b2f6850f76ca2b6, type: 3}
m_Name:
m_EditorClassIdentifier:

View file

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 1096e391cf3fec74483d0a8036513046
timeCreated: 1521964013
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 014e650c7b694d6429dd42607d6e8fab
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,383 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 8
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 1953658193}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 49040651}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 9
m_Resolution: 2
m_BakeResolution: 40
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 0
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVRFilteringMode: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &49040650
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 49040652}
- component: {fileID: 49040651}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &49040651
Light:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 49040650}
m_Enabled: 1
serializedVersion: 8
m_Type: 1
m_Color: {r: 0.9558824, g: 0.6199663, b: 0.26005626, a: 1}
m_Intensity: 1.91
m_Range: 10
m_SpotAngle: 30
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 4
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &49040652
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 49040650}
m_LocalRotation: {x: -0.99103653, y: -0.12916742, z: 0.03387993, w: -0.0038055014}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 539.066, y: -716.206, z: -14.820984}
--- !u!1 &636899334
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 636899336}
- component: {fileID: 636899335}
m_Layer: 0
m_Name: AtmManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &636899335
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 636899334}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e16dd2ddbdfa7ea4f87a3cfb032ffd0f, type: 3}
m_Name:
m_EditorClassIdentifier:
progressiveUpdate: 0
computeShader: {fileID: 7200000, guid: 2d4396a54b390d742b84d4bb4a122e54, type: 3}
outputDebug: 0
lutConfig:
transmittanceSize: {x: 512, y: 512}
scatteringSize: {x: 32, y: 32, z: 128}
irradianceSize: {x: 32, y: 32}
cameraVolumeSize: {x: 128, y: 128, z: 32}
atmosphereConfig: {fileID: 11400000, guid: 8e73e89daf00b8447b2410427953df25, type: 2}
--- !u!4 &636899336
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 636899334}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1748146228
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1748146232}
- component: {fileID: 1748146231}
- component: {fileID: 1748146229}
- component: {fileID: 1748146234}
- component: {fileID: 1748146236}
- component: {fileID: 1748146233}
- component: {fileID: 1748146235}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1748146229
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 1
--- !u!20 &1748146231
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 2000
field of view: 75
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 0
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1748146232
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_LocalRotation: {x: 0.2475641, y: -0, z: -0, w: 0.9688715}
m_LocalPosition: {x: 0, y: 20000, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 28.667002, y: 0, z: 0}
--- !u!114 &1748146233
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ff26db721962cdf4a8edcdfa9a767d2a, type: 3}
m_Name:
m_EditorClassIdentifier:
profile: {fileID: 11400000, guid: cdea7d3b49937774abb1b5ac066885fd, type: 2}
--- !u!114 &1748146234
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9f1db61281524fb40bc9a1f6acce6baf, type: 3}
m_Name:
m_EditorClassIdentifier:
configuration: {fileID: 11400000, guid: a15886e93ac3e7847861da392782f13d, type: 2}
downSample: 1
quality: 0
allowCloudFrontObject: 0
useApSystem: 0
useHierarchicalHeightMap: 1
cloudShader: {fileID: 4800000, guid: 84e97169589c5e94e8521fe4deb2e3f8, type: 3}
heightPreprocessShader: {fileID: 7200000, guid: 40276bd53f35a694e8d4e025ca310775,
type: 3}
cloudHeightProcessShader: {fileID: 4800000, guid: b80bf04ca56d3d642a6b925cff3f5ddf,
type: 3}
--- !u!114 &1748146235
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0a9c4d2e823dfc247b2f6850f76ca2b6, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &1748146236
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1748146228}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b535dacf702e20c4b9ef528e42081835, type: 3}
m_Name:
m_EditorClassIdentifier:
volumeTexSize: {x: 128, y: 128, z: 32}
--- !u!21 &1953658193
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Skybox/AtmosphereScatteringPrecomputed
m_Shader: {fileID: 4800000, guid: e2088dd19a71d1244976cd0de1ff68a7, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs: []
m_Floats: []
m_Colors: []

View file

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 3c9b872431f71ab41b8b345a38554f92
timeCreated: 1521964013
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: d6ade06d74955e2478975558493d6d54
folderAsset: yes
timeCreated: 1522836299
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,16 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Yangrc.VolumeCloud.Sample {
public class MouseMovement: MonoBehaviour {
private void Update() {
float yaw = Input.GetAxis("Mouse X");
float pitch = -Input.GetAxis("Mouse Y");
var currAngle = transform.rotation.eulerAngles;
currAngle.x += pitch;
currAngle.y += yaw;
transform.rotation = Quaternion.Euler(currAngle);
}
}
}

View file

@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: 0a9c4d2e823dfc247b2f6850f76ca2b6
timeCreated: 1530937970
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 44271309eab254245a7f8e6479ee5fad
folderAsset: yes
timeCreated: 1523161001
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,10 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Yangrc.VolumeCloud {
public abstract class BaseNoiseGenerator : INoiseGenerator {
public int period = 16;
public abstract float Noise(Vector3 pos);
}
}

View file

@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: 374ff9f8fc4c1114b897fc5a6213d9ff
timeCreated: 1522028198
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,35 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Yangrc.VolumeCloud {
[System.Serializable]
public class CurlNoiseGenerator : ITextureGenerator {
public Texture2D perlinNoise;
public float brightness = 10.0f;
public float scale = 10.0f;
public PerlinNoiseGenerator perlin;
private float noise(float x, float y) {
return perlin.Noise(new Vector3(x, y));
}
public Color Sample(float x, float y) {
float eps = 1.0f / 128.0f;
float n1, n2, a, b;
n1 = noise(x, y + eps);
n2 = noise(x, y - eps);
a = (n1 - n2) / (2);
n1 = noise(x + eps, y);
n2 = noise(x - eps, y);
b = (n1 - n2) / (2);
Vector2 curl = new Vector2(a, -b);
return new Color(curl.x, curl.y, 0);
}
public Color Sample(Vector3 pos) {
return Sample(pos.x, pos.y);
}
}
}

View file

@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: f5c2ff57fc70e4346aa2667d13cce209
timeCreated: 1522740335
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,20 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Yangrc.VolumeCloud {
[System.Serializable]
public class CustomTexGenerator : INoiseGenerator {
public float channel1WorleyPercent = 0.5f;
public int channel1WorleyPeriod = 4;
public int channel1PerlinPeriod = 4;
public int worleyOcataves = 4;
public int perlinOctaves = 4;
public float Noise(Vector3 pos) {
return channel1WorleyPercent * WorleyNoiseGenerator.OctaveNoise(pos, channel1WorleyPeriod, worleyOcataves)
+ (1 - channel1WorleyPercent) * PerlinNoiseGenerator.OctaveNoise(pos, channel1PerlinPeriod, perlinOctaves);
}
}
}

View file

@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: ca47c3192075ced48b6f40850f6268ea
timeCreated: 1522037646
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,45 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Yangrc.VolumeCloud {
[System.Serializable]
public class First3DTexGenerator : ITextureGenerator {
public int texResolution = 32;
public int perlinOctaves = 4;
public int channel1PerlinPeriod = 16;
public int channel2WorleyPeriod = 16;
public int channel3WorleyPeriod = 32;
public int channel4WorleyPeriod = 64;
public Color Sample(Vector3 pos) {
Color res = new Color();
res.r = PerlinNoiseGenerator.OctaveNoise(pos, channel1PerlinPeriod, perlinOctaves);
res.g = WorleyNoiseGenerator.OctaveNoise(pos, channel2WorleyPeriod, 3);
res.b = WorleyNoiseGenerator.OctaveNoise(pos, channel3WorleyPeriod, 3);
res.a = WorleyNoiseGenerator.OctaveNoise(pos, channel4WorleyPeriod, 3);
return res;
}
}
[System.Serializable]
public class Second3DTexGenerator : ITextureGenerator {
public int texResolution = 32;
public int channel1WorleyFreq = 16;
public int channel2WorleyFreq = 32;
public int channel3WorleyFreq = 64;
public Color Noise(Vector3 pos) {
Color res = new Color();
res.r = WorleyNoiseGenerator.OctaveNoise(pos, channel1WorleyFreq, 3);
res.g = WorleyNoiseGenerator.OctaveNoise(pos, channel2WorleyFreq, 3);
res.b = WorleyNoiseGenerator.OctaveNoise(pos, channel3WorleyFreq, 3);
res.a = 1.0f;
return res;
}
public Color Sample(Vector3 pos) {
return Noise(pos);
}
}
}

View file

@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: ddef2f45efe7ed54c98ca379a97cc280
timeCreated: 1522028698
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,23 +0,0 @@
using System;
using UnityEngine;
namespace Yangrc.VolumeCloud {
public class NoiseTextureAdapter : ITextureGenerator {
private INoiseGenerator noiseGen;
public NoiseTextureAdapter(INoiseGenerator noiseGen) {
this.noiseGen = noiseGen;
}
public Color Sample(Vector3 pos) {
return noiseGen.Noise(pos) * Color.white;
}
}
public interface ITextureGenerator {
Color Sample(Vector3 pos);
}
public interface INoiseGenerator {
float Noise(Vector3 pos);
}
}

View file

@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: 36639cbbe3e718444b2f731daafe2ec5
timeCreated: 1522029916
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,97 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/*
* code from https://github.com/keijiro/PerlinNoise
* changed to make the noise tilable.
*/
namespace Yangrc.VolumeCloud {
[System.Serializable]
public class PerlinNoiseGenerator : BaseNoiseGenerator {
public int octaves = 4;
public override float Noise(Vector3 pos) {
return OctaveNoise(pos, period, octaves);
}
static float Fade(float t) {
return t * t * t * (t * (t * 6 - 15) + 10);
}
static float Lerp(float t, float a, float b) {
return a + t * (b - a);
}
static float Grad(int hash, float x, float y, float z) {
var h = hash & 15;
var u = h < 8 ? x : y;
var v = h < 4 ? y : (h == 12 || h == 14 ? x : z);
return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v);
}
static int[] perm = {
151,160,137,91,90,15,
131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,
190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,
88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166,
77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,
102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196,
135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123,
5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,
223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9,
129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228,
251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107,
49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254,
138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180,
151
};
private static int wrap(int n, int period) {
n++;
return period > 0 ? n % period : n;
}
public static float Noise(Vector3 pos, int period) {
pos *= period;
var x = pos.x;
var y = pos.y;
var z = pos.z;
var X = Mathf.FloorToInt(x) & 0xff;
var Y = Mathf.FloorToInt(y) & 0xff;
var Z = Mathf.FloorToInt(z) & 0xff;
x -= Mathf.Floor(x);
y -= Mathf.Floor(y);
z -= Mathf.Floor(z);
var u = Fade(x);
var v = Fade(y);
var w = Fade(z);
var A = (perm[wrap(X, period)] + Y) & 0xff;
var B = (perm[wrap(X + 1, period)] + Y) & 0xff;
var AA = (perm[wrap(A, period)] + Z) & 0xff;
var BA = (perm[wrap(B, period)] + Z) & 0xff;
var AB = (perm[wrap(A + 1, period)] + Z) & 0xff;
var BB = (perm[wrap(B + 1, period)] + Z) & 0xff;
var result = Lerp(w, Lerp(v, Lerp(u, Grad(perm[AA], x, y, z), Grad(perm[BA], x - 1, y, z)),
Lerp(u, Grad(perm[AB], x, y - 1, z), Grad(perm[BB], x - 1, y - 1, z))),
Lerp(v, Lerp(u, Grad(perm[AA + 1], x, y, z - 1), Grad(perm[BA + 1], x - 1, y, z - 1)),
Lerp(u, Grad(perm[AB + 1], x, y - 1, z - 1), Grad(perm[BB + 1], x - 1, y - 1, z - 1))));
return (result + 1.0f) / 2.0f;
}
public static float OctaveNoise(Vector3 pos, int period, int octaves, float persistence = 0.5f) {
float total = 0.0f;
float result = 0.0f;
float amp = .5f;
float freq = 1.0f;
for (int i = 0; i < octaves; i++) {
total += amp;
result += (Noise(pos, Mathf.RoundToInt(freq * period)) * 2.0f - 1.0f) * amp;
amp *= persistence;
freq *= 2.0f;
}
if (octaves == 0)
return 0.0f;
return (result / total + 1.0f) / 2.0f;
}
}
}

View file

@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: 73833a3529798be4ba6baa1db73dc2aa
timeCreated: 1521990941
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,39 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Yangrc.VolumeCloud {
public class Utils {
public static Texture3D GetTex(ITextureGenerator texGen, int textureResolution, TextureFormat format = TextureFormat.RGBA32) {
Texture3D result = new Texture3D(textureResolution, textureResolution, textureResolution, format, true);
Color[] colors = new Color[textureResolution * textureResolution * textureResolution];
for (int x = 0; x < textureResolution; x++) {
for (int y = 0; y < textureResolution; y++) {
for (int z = 0; z < textureResolution; z++) {
colors[x * textureResolution * textureResolution + y * textureResolution + z]
= texGen.Sample(new Vector3(x, y, z) / textureResolution);
}
}
}
result.SetPixels(colors);
result.wrapMode = TextureWrapMode.Repeat;
result.Apply();
return result;
}
public static Texture2D GetPreviewTex(ITextureGenerator texGen, int textureResolution, TextureFormat format = TextureFormat.RGBA32) {
Texture2D result = new Texture2D(textureResolution, textureResolution, format, true);
Color[] colors = new Color[textureResolution * textureResolution];
for (int x = 0; x < textureResolution; x++) {
for (int y = 0; y < textureResolution; y++) {
colors[x * textureResolution + y]
= texGen.Sample(new Vector3(x, y, 0) / textureResolution);
}
}
result.SetPixels(colors);
result.wrapMode = TextureWrapMode.Repeat;
result.Apply();
return result;
}
}
}

View file

@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: 7830b1199edb76145b042d63acddae71
timeCreated: 1522029782
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show more