runes
8 年前
当前提交
84860a17
共有 77 个文件被更改,包括 2323 次插入 和 1368 次删除
-
6Assets/ScriptableRenderPipeline/AdditionalLightData.cs
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/HDRenderPipelineDebug.cs
-
1Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/HDRenderPipelineDebug.cs.hlsl
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/Resources/DebugViewMaterialGBuffer.shader
-
7Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/Resources/DebugViewTiles.shader
-
154Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineInspector.cs
-
6Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/SceneSettingsManagementWindow.cs
-
125Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.asset
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.asset.meta
-
262Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop.cs
-
10Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Resources/Deferred.shader
-
13Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TileLightLoopProducer.cs
-
23Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/Resources/lightlistbuild-clustered.compute
-
9Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/Resources/shadeopaque.compute
-
166Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs.hlsl
-
16Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.hlsl
-
42Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePassLoop.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/Editor/LayeredLitUI.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLit.shader
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLitTessellation.shader
-
10Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Editor/BaseLitUI.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.cs.hlsl
-
46Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.shader
-
120Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl
-
1Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitProperties.hlsl
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.hlsl
-
3Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.shader
-
55Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/CombineSubsurfaceScattering.shader
-
13Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/ShaderPassDebugViewMaterial.hlsl
-
62Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderVariables.hlsl
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/Shadow/ShadowBase.cs.hlsl
-
5Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/ProceduralSky/ProceduralSkyRenderer.cs
-
18Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/ProceduralSky/Resources/AtmosphericScattering.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/ProceduralSky/Resources/SkyProcedural.shader
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/SkyManager.cs
-
15Assets/ScriptableRenderPipeline/HDRenderPipeline/Utilities.cs
-
80Assets/ScriptableRenderPipeline/ShaderLibrary/Common.hlsl
-
17Assets/ScriptableRenderPipeline/ShaderLibrary/PerPixelDisplacement.hlsl
-
1Assets/ScriptableRenderPipeline/common/TextureCache.cs
-
19Assets/ScriptableRenderPipeline/fptl/FptlLighting.cs
-
3Assets/ScriptableRenderPipeline/fptl/LightDefinitions.cs
-
1Assets/ScriptableRenderPipeline/fptl/LightDefinitions.cs.hlsl
-
5Assets/ScriptableRenderPipeline/fptl/TiledLightingTemplate.hlsl
-
17Assets/ScriptableRenderPipeline/fptl/TiledLightingUtils.hlsl
-
5Assets/ScriptableRenderPipeline/fptl/TiledReflectionTemplate.hlsl
-
23Assets/ScriptableRenderPipeline/fptl/lightlistbuild-clustered.compute
-
2Assets/TestScenes/FPTL/Materials/Custom_NewSurfaceShader.mat
-
4Assets/TestScenes/FPTL/Materials/gray.mat
-
112Assets/TestScenes/HDTest/CascadedShadowsTest.unity
-
9Assets/TestScenes/HDTest/CascadedShadowsTest/CommonSettings_Cascaded.asset
-
2Assets/TestScenes/HDTest/CascadedShadowsTest/CommonSettings_Cascaded.asset.meta
-
2Assets/TestScenes/HDTest/GraphicTest/Parallax Occlusion Mapping/Material/POM - Rock.mat
-
2Assets/TestScenes/HDTest/GraphicTest/Parallax Occlusion Mapping/Material/POM - Wood.mat
-
122Assets/TestScenes/fptl/Materials/FwdMat.mat
-
9ProjectSettings/GraphicsSettings.asset
-
718ProjectSettings/InputManager.asset
-
2ProjectSettings/ProjectVersion.txt
-
60Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/Resources/DebugDisplayLatlong.shader
-
10Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/Resources/DebugDisplayLatlong.shader.meta
-
300Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/SubsurfaceScatteringSettings.cs
-
8Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/SubsurfaceScatteringSettings.cs.meta
-
9Assets/ScriptableRenderPipeline/common/Camera.meta
-
136Assets/ScriptableRenderPipeline/common/Debugging.cs
-
12Assets/ScriptableRenderPipeline/common/Debugging.cs.meta
-
20Assets/TestScenes/HDTest/CascadedShadowsTest/HDRISkySettings_Cascaded.asset
-
9Assets/TestScenes/HDTest/CascadedShadowsTest/HDRISkySettings_Cascaded.asset.meta
-
108Assets/ScriptableRenderPipeline/common/Camera/CameraSwitcher.cs
-
12Assets/ScriptableRenderPipeline/common/Camera/CameraSwitcher.cs.meta
-
67Assets/ScriptableRenderPipeline/common/Camera/FreeCamera.cs
-
12Assets/ScriptableRenderPipeline/common/Camera/FreeCamera.cs.meta
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/SceneSettings/SubsurfaceScatteringParameters.cs.meta
-
509Assets/ScriptableRenderPipeline/HDRenderPipeline/SceneSettings/SubsurfaceScatteringParameters.cs
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!13 &1 |
|||
InputManager: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 2 |
|||
m_Axes: |
|||
- serializedVersion: 3 |
|||
m_Name: Horizontal |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: left |
|||
positiveButton: right |
|||
altNegativeButton: a |
|||
altPositiveButton: d |
|||
gravity: 3 |
|||
dead: .00100000005 |
|||
sensitivity: 3 |
|||
snap: 1 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Vertical |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: down |
|||
positiveButton: up |
|||
altNegativeButton: s |
|||
altPositiveButton: w |
|||
gravity: 3 |
|||
dead: .00100000005 |
|||
sensitivity: 3 |
|||
snap: 1 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Fire1 |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: left ctrl |
|||
altNegativeButton: |
|||
altPositiveButton: mouse 0 |
|||
gravity: 1000 |
|||
dead: .00100000005 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Fire2 |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: left alt |
|||
altNegativeButton: |
|||
altPositiveButton: mouse 1 |
|||
gravity: 1000 |
|||
dead: .00100000005 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Fire3 |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: left shift |
|||
altNegativeButton: |
|||
altPositiveButton: mouse 2 |
|||
gravity: 1000 |
|||
dead: .00100000005 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Jump |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: space |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 1000 |
|||
dead: .00100000005 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Mouse X |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 0 |
|||
dead: 0 |
|||
sensitivity: .100000001 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 1 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Mouse Y |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 0 |
|||
dead: 0 |
|||
sensitivity: .100000001 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 1 |
|||
axis: 1 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Mouse ScrollWheel |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 0 |
|||
dead: 0 |
|||
sensitivity: .100000001 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 1 |
|||
axis: 2 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Horizontal |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 0 |
|||
dead: .189999998 |
|||
sensitivity: 1 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 2 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Vertical |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 0 |
|||
dead: .189999998 |
|||
sensitivity: 1 |
|||
snap: 0 |
|||
invert: 1 |
|||
type: 2 |
|||
axis: 1 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Fire1 |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: joystick button 0 |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 1000 |
|||
dead: .00100000005 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Fire2 |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: joystick button 1 |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 1000 |
|||
dead: .00100000005 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Fire3 |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: joystick button 2 |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 1000 |
|||
dead: .00100000005 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Jump |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: joystick button 3 |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 1000 |
|||
dead: .00100000005 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Submit |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: return |
|||
altNegativeButton: |
|||
altPositiveButton: joystick button 0 |
|||
gravity: 1000 |
|||
dead: .00100000005 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Submit |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: enter |
|||
altNegativeButton: |
|||
altPositiveButton: space |
|||
gravity: 1000 |
|||
dead: .00100000005 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Cancel |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: escape |
|||
altNegativeButton: |
|||
altPositiveButton: joystick button 1 |
|||
gravity: 1000 |
|||
dead: .00100000005 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!13 &1 |
|||
InputManager: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 2 |
|||
m_Axes: |
|||
- serializedVersion: 3 |
|||
m_Name: Horizontal |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: left |
|||
positiveButton: right |
|||
altNegativeButton: q |
|||
altPositiveButton: d |
|||
gravity: 3 |
|||
dead: 0.001 |
|||
sensitivity: 3 |
|||
snap: 1 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Vertical |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: down |
|||
positiveButton: up |
|||
altNegativeButton: s |
|||
altPositiveButton: z |
|||
gravity: 3 |
|||
dead: 0.001 |
|||
sensitivity: 3 |
|||
snap: 1 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Fire1 |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: left ctrl |
|||
altNegativeButton: |
|||
altPositiveButton: mouse 0 |
|||
gravity: 1000 |
|||
dead: 0.001 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Fire2 |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: left alt |
|||
altNegativeButton: |
|||
altPositiveButton: mouse 1 |
|||
gravity: 1000 |
|||
dead: 0.001 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Fire3 |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: left shift |
|||
altNegativeButton: |
|||
altPositiveButton: mouse 2 |
|||
gravity: 1000 |
|||
dead: 0.001 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Jump |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: space |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 1000 |
|||
dead: 0.001 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Mouse X |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 0 |
|||
dead: 0 |
|||
sensitivity: 0.1 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 1 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Controller Right Stick X |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 1 |
|||
dead: 0.2 |
|||
sensitivity: 1 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 2 |
|||
axis: 3 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Mouse Y |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 0 |
|||
dead: 0 |
|||
sensitivity: 0.1 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 1 |
|||
axis: 1 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Controller Right Stick Y |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 1 |
|||
dead: 0.2 |
|||
sensitivity: 1 |
|||
snap: 0 |
|||
invert: 1 |
|||
type: 2 |
|||
axis: 4 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Mouse ScrollWheel |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 0 |
|||
dead: 0 |
|||
sensitivity: 0.1 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 1 |
|||
axis: 2 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Horizontal |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 0 |
|||
dead: 0.19 |
|||
sensitivity: 1 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 2 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Vertical |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 0 |
|||
dead: 0.19 |
|||
sensitivity: 1 |
|||
snap: 0 |
|||
invert: 1 |
|||
type: 2 |
|||
axis: 1 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Fire1 |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: joystick button 0 |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 1000 |
|||
dead: 0.001 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Fire2 |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: joystick button 1 |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 1000 |
|||
dead: 0.001 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Fire3 |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: joystick button 2 |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 1000 |
|||
dead: 0.001 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Jump |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: joystick button 3 |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 1000 |
|||
dead: 0.001 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Submit |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: return |
|||
altNegativeButton: |
|||
altPositiveButton: joystick button 0 |
|||
gravity: 1000 |
|||
dead: 0.001 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Submit |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: enter |
|||
altNegativeButton: |
|||
altPositiveButton: space |
|||
gravity: 1000 |
|||
dead: 0.001 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Cancel |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: escape |
|||
altNegativeButton: |
|||
altPositiveButton: joystick button 1 |
|||
gravity: 1000 |
|||
dead: 0.001 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Enable Debug Button 1 |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: escape |
|||
altNegativeButton: |
|||
altPositiveButton: joystick button 8 |
|||
gravity: 1000 |
|||
dead: 0.001 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Enable Debug Button 2 |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: escape |
|||
altNegativeButton: |
|||
altPositiveButton: joystick button 9 |
|||
gravity: 1000 |
|||
dead: 0.001 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Debug Next |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: |
|||
altNegativeButton: |
|||
altPositiveButton: joystick button 5 |
|||
gravity: 1000 |
|||
dead: 0.001 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Debug Next |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: page down |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 1000 |
|||
dead: 0.001 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Debug Previous |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: |
|||
altNegativeButton: joystick button 4 |
|||
altPositiveButton: |
|||
gravity: 1000 |
|||
dead: 0.001 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|||
- serializedVersion: 3 |
|||
m_Name: Debug Previous |
|||
descriptiveName: |
|||
descriptiveNegativeName: |
|||
negativeButton: |
|||
positiveButton: page up |
|||
altNegativeButton: |
|||
altPositiveButton: |
|||
gravity: 1000 |
|||
dead: 0.001 |
|||
sensitivity: 1000 |
|||
snap: 0 |
|||
invert: 0 |
|||
type: 0 |
|||
axis: 0 |
|||
joyNum: 0 |
|
|||
m_EditorVersion: 2017.1.0a1 |
|||
m_EditorVersion: 2017.1.0a2 |
|
|||
Shader "Hidden/HDRenderPipeline/DebugDisplayLatlong" |
|||
{ |
|||
SubShader |
|||
{ |
|||
Pass |
|||
{ |
|||
ZWrite Off |
|||
ZTest Off |
|||
Blend One Zero |
|||
Cull Off |
|||
|
|||
HLSLPROGRAM |
|||
#pragma target 4.5 |
|||
#pragma only_renderers d3d11 ps4 metal // TEMP: unitl we go futher in dev |
|||
|
|||
#pragma vertex Vert |
|||
#pragma fragment Frag |
|||
|
|||
#include "ShaderLibrary/Common.hlsl" |
|||
#include "ShaderLibrary/ImageBasedLighting.hlsl" |
|||
|
|||
TEXTURECUBE(_InputCubemap); |
|||
SAMPLERCUBE(sampler_InputCubemap); |
|||
float _Mipmap; |
|||
|
|||
struct Attributes |
|||
{ |
|||
uint vertexID : SV_VertexID; |
|||
}; |
|||
|
|||
struct Varyings |
|||
{ |
|||
float4 positionCS : SV_POSITION; |
|||
float2 texcoord : TEXCOORD0; |
|||
}; |
|||
|
|||
Varyings Vert(Attributes input) |
|||
{ |
|||
Varyings output; |
|||
output.positionCS = GetFullScreenTriangleVertexPosition(input.vertexID); |
|||
output.texcoord = GetFullScreenTriangleTexcoord(input.vertexID);// *_TextureScaleBias.xy + _TextureScaleBias.zw; |
|||
|
|||
return output; |
|||
} |
|||
|
|||
float4 Frag(Varyings input) : SV_Target |
|||
{ |
|||
uint width, height, depth, mipCount; |
|||
width = height = depth = mipCount = 0; |
|||
_InputCubemap.GetDimensions(width, height, depth, mipCount); |
|||
mipCount = clamp(mipCount, 0, UNITY_SPECCUBE_LOD_STEPS); |
|||
return SAMPLE_TEXTURECUBE_LOD(_InputCubemap, sampler_InputCubemap, LatlongToDirectionCoordinate(input.texcoord.xy), _Mipmap * mipCount); |
|||
} |
|||
|
|||
ENDHLSL |
|||
} |
|||
|
|||
} |
|||
Fallback Off |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: c1d1d149a043a5349ba367da6c2051ba |
|||
timeCreated: 1476053153 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
|
|
|||
using System; |
|||
using UnityEngine.Rendering; |
|||
#if UNITY_EDITOR
|
|||
using UnityEditor; |
|||
#endif
|
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
[Serializable] |
|||
public class SubsurfaceScatteringProfile |
|||
{ |
|||
public const int numSamples = 7; // Must be an odd number
|
|||
|
|||
[SerializeField, ColorUsage(false, true, 0.05f, 2.0f, 1.0f, 1.0f)] |
|||
public Color stdDev1; |
|||
[SerializeField, ColorUsage(false, true, 0.05f, 2.0f, 1.0f, 1.0f)] |
|||
public Color stdDev2; |
|||
[SerializeField] |
|||
public float lerpWeight; |
|||
[SerializeField] |
|||
public bool enableTransmission; |
|||
[SerializeField] |
|||
public Vector2 thicknessRemap; |
|||
[SerializeField] [HideInInspector] |
|||
Vector4[] m_FilterKernel; |
|||
[SerializeField] [HideInInspector] |
|||
Vector3[] m_HalfRcpVariances; |
|||
[SerializeField] [HideInInspector] |
|||
Vector4 m_HalfRcpWeightedVariances; |
|||
|
|||
// --- Public Methods ---
|
|||
|
|||
public SubsurfaceScatteringProfile() |
|||
{ |
|||
stdDev1 = new Color(0.3f, 0.3f, 0.3f, 0.0f); |
|||
stdDev2 = new Color(0.6f, 0.6f, 0.6f, 0.0f); |
|||
lerpWeight = 0.5f; |
|||
enableTransmission = false; |
|||
thicknessRemap = new Vector2(0, 3); |
|||
|
|||
UpdateKernelAndVarianceData(); |
|||
} |
|||
|
|||
public Vector4[] filterKernel |
|||
{ |
|||
// Set via UpdateKernelAndVarianceData().
|
|||
get { return m_FilterKernel; } |
|||
} |
|||
|
|||
public Vector3[] halfRcpVariances |
|||
{ |
|||
// Set via UpdateKernelAndVarianceData().
|
|||
get { return m_HalfRcpVariances; } |
|||
} |
|||
|
|||
public Vector4 halfRcpWeightedVariances |
|||
{ |
|||
// Set via UpdateKernelAndVarianceData().
|
|||
get { return m_HalfRcpWeightedVariances; } |
|||
} |
|||
|
|||
public void UpdateKernelAndVarianceData() |
|||
{ |
|||
if (m_FilterKernel == null) |
|||
{ |
|||
m_FilterKernel = new Vector4[numSamples]; |
|||
} |
|||
|
|||
if (m_HalfRcpVariances == null) |
|||
{ |
|||
m_HalfRcpVariances = new Vector3[2]; |
|||
} |
|||
|
|||
// Our goal is to blur the image using a filter which is represented
|
|||
// as a product of a linear combination of two normalized 1D Gaussians
|
|||
// as suggested by Jimenez et al. in "Separable Subsurface Scattering".
|
|||
// A normalized (i.e. energy-preserving) 1D Gaussian with the mean of 0
|
|||
// is defined as follows: G1(x, v) = exp(-x� / (2 * v)) / sqrt(2 * Pi * v),
|
|||
// where 'v' is variance and 'x' is the radial distance from the origin.
|
|||
// Using the weight 'w', our 1D and the resulting 2D filters are given as:
|
|||
// A1(v1, v2, w, x) = G1(x, v1) * (1 - w) + G1(r, v2) * w,
|
|||
// A2(v1, v2, w, x, y) = A1(v1, v2, w, x) * A1(v1, v2, w, y).
|
|||
// The resulting filter function is a non-Gaussian PDF.
|
|||
// It is separable by design, but generally not radially symmetric.
|
|||
|
|||
// Find the widest Gaussian across 3 color channels.
|
|||
float maxStdDev1 = Mathf.Max(stdDev1.r, stdDev1.g, stdDev1.b); |
|||
float maxStdDev2 = Mathf.Max(stdDev2.r, stdDev2.g, stdDev2.b); |
|||
|
|||
Vector3 weightSum = new Vector3(0, 0, 0); |
|||
|
|||
// Importance sample the linear combination of two Gaussians.
|
|||
for (uint i = 0; i < numSamples; i++) |
|||
{ |
|||
float u = (i + 0.5f) / numSamples; |
|||
float pos = GaussianCombinationCdfInverse(u, maxStdDev1, maxStdDev2, lerpWeight); |
|||
float pdf = GaussianCombination(pos, maxStdDev1, maxStdDev2, lerpWeight); |
|||
|
|||
Vector3 val; |
|||
val.x = GaussianCombination(pos, stdDev1.r, stdDev2.r, lerpWeight); |
|||
val.y = GaussianCombination(pos, stdDev1.g, stdDev2.g, lerpWeight); |
|||
val.z = GaussianCombination(pos, stdDev1.b, stdDev2.b, lerpWeight); |
|||
|
|||
// We do not divide by 'numSamples' since we will renormalize, anyway.
|
|||
m_FilterKernel[i].x = val.x * (1 / pdf); |
|||
m_FilterKernel[i].y = val.y * (1 / pdf); |
|||
m_FilterKernel[i].z = val.z * (1 / pdf); |
|||
m_FilterKernel[i].w = pos; |
|||
|
|||
weightSum.x += m_FilterKernel[i].x; |
|||
weightSum.y += m_FilterKernel[i].y; |
|||
weightSum.z += m_FilterKernel[i].z; |
|||
} |
|||
|
|||
// Renormalize the weights to conserve energy.
|
|||
for (uint i = 0; i < numSamples; i++) |
|||
{ |
|||
m_FilterKernel[i].x *= 1 / weightSum.x; |
|||
m_FilterKernel[i].y *= 1 / weightSum.y; |
|||
m_FilterKernel[i].z *= 1 / weightSum.z; |
|||
} |
|||
|
|||
// Store (1 / (2 * Variance)) per color channel per Gaussian.
|
|||
m_HalfRcpVariances[0].x = 0.5f / (stdDev1.r * stdDev1.r); |
|||
m_HalfRcpVariances[0].y = 0.5f / (stdDev1.g * stdDev1.g); |
|||
m_HalfRcpVariances[0].z = 0.5f / (stdDev1.b * stdDev1.b); |
|||
m_HalfRcpVariances[1].x = 0.5f / (stdDev2.r * stdDev2.r); |
|||
m_HalfRcpVariances[1].y = 0.5f / (stdDev2.g * stdDev2.g); |
|||
m_HalfRcpVariances[1].z = 0.5f / (stdDev2.b * stdDev2.b); |
|||
|
|||
Vector4 weightedStdDev; |
|||
weightedStdDev.x = Mathf.Lerp(stdDev1.r, stdDev2.r, lerpWeight); |
|||
weightedStdDev.y = Mathf.Lerp(stdDev1.g, stdDev2.g, lerpWeight); |
|||
weightedStdDev.z = Mathf.Lerp(stdDev1.b, stdDev2.b, lerpWeight); |
|||
weightedStdDev.w = Mathf.Lerp(maxStdDev1, maxStdDev2, lerpWeight); |
|||
|
|||
// Store (1 / (2 * WeightedVariance)) per color channel.
|
|||
m_HalfRcpWeightedVariances.x = 0.5f / (weightedStdDev.x * weightedStdDev.x); |
|||
m_HalfRcpWeightedVariances.y = 0.5f / (weightedStdDev.y * weightedStdDev.y); |
|||
m_HalfRcpWeightedVariances.z = 0.5f / (weightedStdDev.z * weightedStdDev.z); |
|||
m_HalfRcpWeightedVariances.w = 0.5f / (weightedStdDev.w * weightedStdDev.w); |
|||
} |
|||
|
|||
// --- Private Methods ---
|
|||
|
|||
static float Gaussian(float x, float stdDev) |
|||
{ |
|||
float variance = stdDev * stdDev; |
|||
return Mathf.Exp(-x * x / (2 * variance)) / Mathf.Sqrt(2 * Mathf.PI * variance); |
|||
} |
|||
|
|||
static float GaussianCombination(float x, float stdDev1, float stdDev2, float lerpWeight) |
|||
{ |
|||
return Mathf.Lerp(Gaussian(x, stdDev1), Gaussian(x, stdDev2), lerpWeight); |
|||
} |
|||
|
|||
static float RationalApproximation(float t) |
|||
{ |
|||
// Abramowitz and Stegun formula 26.2.23.
|
|||
// The absolute value of the error should be less than 4.5 e-4.
|
|||
float[] c = {2.515517f, 0.802853f, 0.010328f}; |
|||
float[] d = {1.432788f, 0.189269f, 0.001308f}; |
|||
return t - ((c[2] * t + c[1]) * t + c[0]) / (((d[2] * t + d[1]) * t + d[0]) * t + 1.0f); |
|||
} |
|||
|
|||
// Ref: https://www.johndcook.com/blog/csharp_phi_inverse/
|
|||
static float NormalCdfInverse(float p, float stdDev) |
|||
{ |
|||
float x; |
|||
|
|||
if (p < 0.5) |
|||
{ |
|||
// F^-1(p) = - G^-1(p)
|
|||
x = -RationalApproximation(Mathf.Sqrt(-2.0f * Mathf.Log(p))); |
|||
} |
|||
else |
|||
{ |
|||
// F^-1(p) = G^-1(1-p)
|
|||
x = RationalApproximation(Mathf.Sqrt(-2.0f * Mathf.Log(1.0f - p))); |
|||
} |
|||
|
|||
return x * stdDev; |
|||
} |
|||
|
|||
static float GaussianCombinationCdfInverse(float p, float stdDev1, float stdDev2, float lerpWeight) |
|||
{ |
|||
return Mathf.Lerp(NormalCdfInverse(p, stdDev1), NormalCdfInverse(p, stdDev2), lerpWeight); |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class SubsurfaceScatteringSettings |
|||
{ |
|||
public enum TexturingMode : int { PreScatter = 0, PostScatter = 1, PreAndPostScatter = 2, MaxValue = 2 }; |
|||
|
|||
public const int maxNumProfiles = 8; |
|||
|
|||
public int numProfiles; |
|||
public TexturingMode texturingMode; |
|||
public int transmissionFlags; |
|||
public SubsurfaceScatteringProfile[] profiles; |
|||
public float[] thicknessRemaps; |
|||
public Vector4[] halfRcpVariancesAndLerpWeights; |
|||
public Vector4[] halfRcpWeightedVariances; |
|||
public Vector4[] filterKernels; |
|||
|
|||
// --- Public Methods ---
|
|||
|
|||
public SubsurfaceScatteringSettings() |
|||
{ |
|||
numProfiles = 1; |
|||
texturingMode = 0; |
|||
profiles = new SubsurfaceScatteringProfile[numProfiles]; |
|||
|
|||
for (int i = 0; i < numProfiles; i++) |
|||
{ |
|||
profiles[i] = new SubsurfaceScatteringProfile(); |
|||
} |
|||
|
|||
OnValidate(); |
|||
} |
|||
|
|||
public void OnValidate() |
|||
{ |
|||
if (profiles.Length > maxNumProfiles) |
|||
{ |
|||
Array.Resize(ref profiles, maxNumProfiles); |
|||
} |
|||
|
|||
numProfiles = profiles.Length; |
|||
texturingMode = (TexturingMode)Math.Max(0, Math.Min((int)texturingMode, (int)TexturingMode.MaxValue)); |
|||
|
|||
if (thicknessRemaps == null) |
|||
{ |
|||
thicknessRemaps = new float[maxNumProfiles * 2]; |
|||
} |
|||
|
|||
if (halfRcpVariancesAndLerpWeights == null) |
|||
{ |
|||
halfRcpVariancesAndLerpWeights = new Vector4[maxNumProfiles * 2]; |
|||
} |
|||
|
|||
if (halfRcpWeightedVariances == null) |
|||
{ |
|||
halfRcpWeightedVariances = new Vector4[maxNumProfiles]; |
|||
} |
|||
|
|||
if (filterKernels == null) |
|||
{ |
|||
filterKernels = new Vector4[maxNumProfiles * SubsurfaceScatteringProfile.numSamples]; |
|||
} |
|||
|
|||
transmissionFlags = 0; |
|||
Color c = new Color(); |
|||
|
|||
for (int i = 0; i < numProfiles; i++) |
|||
{ |
|||
transmissionFlags |= (profiles[i].enableTransmission ? 1 : 0) << i; |
|||
|
|||
c.r = Mathf.Clamp(profiles[i].stdDev1.r, 0.05f, 2.0f); |
|||
c.g = Mathf.Clamp(profiles[i].stdDev1.g, 0.05f, 2.0f); |
|||
c.b = Mathf.Clamp(profiles[i].stdDev1.b, 0.05f, 2.0f); |
|||
c.a = 0.0f; |
|||
|
|||
profiles[i].stdDev1 = c; |
|||
|
|||
c.r = Mathf.Clamp(profiles[i].stdDev2.r, 0.05f, 2.0f); |
|||
c.g = Mathf.Clamp(profiles[i].stdDev2.g, 0.05f, 2.0f); |
|||
c.b = Mathf.Clamp(profiles[i].stdDev2.b, 0.05f, 2.0f); |
|||
c.a = 0.0f; |
|||
|
|||
profiles[i].stdDev2 = c; |
|||
|
|||
profiles[i].lerpWeight = Mathf.Clamp01(profiles[i].lerpWeight); |
|||
|
|||
profiles[i].thicknessRemap.x = Mathf.Clamp(profiles[i].thicknessRemap.x, 0, profiles[i].thicknessRemap.y); |
|||
profiles[i].thicknessRemap.y = Mathf.Max(profiles[i].thicknessRemap.x, profiles[i].thicknessRemap.y); |
|||
|
|||
profiles[i].UpdateKernelAndVarianceData(); |
|||
} |
|||
|
|||
// Use the updated data to fill the cache.
|
|||
for (int i = 0; i < numProfiles; i++) |
|||
{ |
|||
thicknessRemaps[2 * i] = profiles[i].thicknessRemap.x; |
|||
thicknessRemaps[2 * i + 1] = profiles[i].thicknessRemap.y - profiles[i].thicknessRemap.x; |
|||
halfRcpVariancesAndLerpWeights[2 * i] = profiles[i].halfRcpVariances[0]; |
|||
halfRcpVariancesAndLerpWeights[2 * i].w = 1.0f - profiles[i].lerpWeight; |
|||
halfRcpVariancesAndLerpWeights[2 * i + 1] = profiles[i].halfRcpVariances[1]; |
|||
halfRcpVariancesAndLerpWeights[2 * i + 1].w = profiles[i].lerpWeight; |
|||
halfRcpWeightedVariances[i] = profiles[i].halfRcpWeightedVariances; |
|||
|
|||
for (int j = 0, n = SubsurfaceScatteringProfile.numSamples; j < n; j++) |
|||
{ |
|||
filterKernels[n * i + j] = profiles[i].filterKernel[j]; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: cccb0727e6924014ebb35773fbfed141 |
|||
timeCreated: 1487685614 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: e99921594db38ce4cbb616f0ca87148d |
|||
folderAsset: yes |
|||
timeCreated: 1488370960 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
public class Debugging : MonoBehaviour |
|||
{ |
|||
|
|||
private static bool m_DebugControlEnabled = false; |
|||
public static bool debugControlEnabled { get { return m_DebugControlEnabled; } } |
|||
|
|||
private float m_DebugControlEnabledMsgTime = 3.0f; |
|||
private float m_DebugControlEnabledMsgTimer = 0.0f; |
|||
|
|||
private bool m_DebugKeyUp1 = false; |
|||
private bool m_DebugKeyUp2 = false; |
|||
private bool m_CanReceiveInput = true; |
|||
|
|||
private static List<string> m_DebugMessages = new List<string>(); |
|||
|
|||
private static string kEnableDebugBtn1 = "Enable Debug Button 1"; |
|||
private static string kEnableDebugBtn2 = "Enable Debug Button 2"; |
|||
private string[] m_RequiredInputButtons = { kEnableDebugBtn1, kEnableDebugBtn2 }; |
|||
private bool m_Valid = true; |
|||
|
|||
public static void PushDebugMessage(string message) |
|||
{ |
|||
m_DebugMessages.Add(message); |
|||
} |
|||
|
|||
static public bool CheckRequiredInputButtonMapping(string[] values) |
|||
{ |
|||
bool inputsOk = true; |
|||
foreach(string value in values) |
|||
{ |
|||
try |
|||
{ |
|||
Input.GetButton(value); |
|||
} |
|||
catch |
|||
{ |
|||
Debug.LogWarning(string.Format("Required input button mapping missing: {0}.", value)); |
|||
inputsOk = false; |
|||
} |
|||
} |
|||
|
|||
return inputsOk; |
|||
} |
|||
|
|||
static public bool CheckRequiredInputAxisMapping(string[] values) |
|||
{ |
|||
bool inputsOk = true; |
|||
foreach (string value in values) |
|||
{ |
|||
try |
|||
{ |
|||
Input.GetAxis(value); |
|||
} |
|||
catch |
|||
{ |
|||
Debug.LogWarning(string.Format("Required input axis mapping missing: {0}.", value)); |
|||
inputsOk = false; |
|||
} |
|||
} |
|||
|
|||
return inputsOk; |
|||
} |
|||
|
|||
void OnEnable() |
|||
{ |
|||
m_Valid = CheckRequiredInputButtonMapping(m_RequiredInputButtons); |
|||
} |
|||
|
|||
void Update() |
|||
{ |
|||
if(m_Valid) |
|||
{ |
|||
m_DebugControlEnabledMsgTimer += Time.deltaTime; |
|||
|
|||
bool enableDebug = Input.GetButton(kEnableDebugBtn1) && Input.GetButton(kEnableDebugBtn2) || Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.Backspace); |
|||
|
|||
if (m_CanReceiveInput && enableDebug) |
|||
{ |
|||
m_DebugControlEnabled = !m_DebugControlEnabled; |
|||
m_DebugControlEnabledMsgTimer = 0.0f; |
|||
m_CanReceiveInput = false; |
|||
m_DebugKeyUp1 = false; |
|||
m_DebugKeyUp2 = false; |
|||
} |
|||
|
|||
if (Input.GetButtonUp(kEnableDebugBtn1)) |
|||
{ |
|||
m_DebugKeyUp1 = true; |
|||
} |
|||
if (Input.GetButtonUp(kEnableDebugBtn2)) |
|||
{ |
|||
m_DebugKeyUp2 = true; |
|||
} |
|||
|
|||
// For keyboard you want to be able to keep ctrl pressed.
|
|||
if (Input.GetKeyUp(KeyCode.Backspace)) |
|||
{ |
|||
m_DebugKeyUp1 = m_DebugKeyUp2 = true; |
|||
} |
|||
|
|||
m_CanReceiveInput = m_DebugKeyUp1 && m_DebugKeyUp2; |
|||
|
|||
if (m_DebugControlEnabledMsgTimer < m_DebugControlEnabledMsgTime) |
|||
{ |
|||
if (m_DebugControlEnabled) |
|||
PushDebugMessage("Debug Controls Enabled"); |
|||
else |
|||
PushDebugMessage("Debug Controls Disabled"); |
|||
} |
|||
} |
|||
} |
|||
|
|||
void OnGUI() |
|||
{ |
|||
using(new GUILayout.HorizontalScope()) |
|||
{ |
|||
GUILayout.Space(10.0f); |
|||
using(new GUILayout.VerticalScope()) |
|||
{ |
|||
GUILayout.Space(10.0f); |
|||
for (int i = 0; i < m_DebugMessages.Count; ++i) |
|||
{ |
|||
GUILayout.Label(m_DebugMessages[i]); |
|||
} |
|||
} |
|||
} |
|||
|
|||
// Make sure to clear only after all relevant events have occured.
|
|||
if (Event.current.type == EventType.Repaint) |
|||
m_DebugMessages.Clear(); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: fcb6090d644beb040a7853639fcffddb |
|||
timeCreated: 1488381065 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 59b6606ef2548734bb6d11b9d160bc7e, type: 3} |
|||
m_Name: HDRISkySettings_Cascaded |
|||
m_EditorClassIdentifier: |
|||
rotation: 0 |
|||
exposure: 0 |
|||
multiplier: 1 |
|||
resolution: 256 |
|||
updateMode: 0 |
|||
updatePeriod: 0 |
|||
skyHDRI: {fileID: 0} |
|
|||
fileFormatVersion: 2 |
|||
guid: 622aa06566c087b41ac0edc80769f45f |
|||
timeCreated: 1487264328 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
mainObjectFileID: 11400000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
public class CameraSwitcher : MonoBehaviour |
|||
{ |
|||
public Camera[] m_Cameras; |
|||
|
|||
private int m_CurrentCameraIndex = -1; |
|||
private Camera m_OriginalCamera = null; |
|||
private Vector3 m_OriginalCameraPosition; |
|||
private Quaternion m_OriginalCameraRotation; |
|||
private Camera m_CurrentCamera = null; |
|||
|
|||
private float m_MessageDuration = 1.0f; |
|||
private float m_MessageTimer = 1000.0f; |
|||
|
|||
private static string kDebugNext = "Debug Next"; |
|||
private static string kDebugPrevious = "Debug Previous"; |
|||
private string[] m_RequiredInputButtons = { kDebugNext, kDebugPrevious }; |
|||
private bool m_Valid = true; |
|||
|
|||
void OnEnable() |
|||
{ |
|||
m_OriginalCamera = GetComponent<Camera>(); |
|||
m_CurrentCamera = m_OriginalCamera; |
|||
|
|||
m_Valid = Debugging.CheckRequiredInputButtonMapping(m_RequiredInputButtons); |
|||
} |
|||
|
|||
int GetCameraCount() |
|||
{ |
|||
return m_Cameras.Length + 1; // We need +1 for handling the original camera.
|
|||
} |
|||
|
|||
void NextCamera() |
|||
{ |
|||
m_CurrentCameraIndex = (m_CurrentCameraIndex + 1) % GetCameraCount(); |
|||
} |
|||
|
|||
void PreviousCamera() |
|||
{ |
|||
m_CurrentCameraIndex = m_CurrentCameraIndex - 1; |
|||
if (m_CurrentCameraIndex == -1) |
|||
m_CurrentCameraIndex = m_Cameras.Length; |
|||
} |
|||
|
|||
Camera GetNextCamera() |
|||
{ |
|||
if (m_CurrentCameraIndex == m_Cameras.Length) |
|||
return m_OriginalCamera; |
|||
else |
|||
return m_Cameras[m_CurrentCameraIndex]; |
|||
} |
|||
|
|||
void Update() |
|||
{ |
|||
if (m_Valid && Debugging.debugControlEnabled && m_OriginalCamera != null) |
|||
{ |
|||
m_MessageTimer += Time.deltaTime; |
|||
bool needUpdateCamera = false; |
|||
if (Input.GetButtonDown(kDebugNext)) |
|||
{ |
|||
NextCamera(); |
|||
needUpdateCamera = true; |
|||
} |
|||
|
|||
if (Input.GetButtonDown(kDebugPrevious)) |
|||
{ |
|||
PreviousCamera(); |
|||
needUpdateCamera = true; |
|||
} |
|||
|
|||
if (needUpdateCamera) |
|||
{ |
|||
m_MessageTimer = 0.0f; |
|||
|
|||
if(m_CurrentCamera == m_OriginalCamera) |
|||
{ |
|||
m_OriginalCameraPosition = m_OriginalCamera.transform.position; |
|||
m_OriginalCameraRotation = m_OriginalCamera.transform.rotation; |
|||
} |
|||
|
|||
m_CurrentCamera = GetNextCamera(); |
|||
|
|||
if(m_CurrentCamera != null) |
|||
{ |
|||
// If we witch back to the original camera, put back the transform in it.
|
|||
if (m_CurrentCamera == m_OriginalCamera) |
|||
{ |
|||
m_OriginalCamera.transform.position = m_OriginalCameraPosition; |
|||
m_OriginalCamera.transform.rotation = m_OriginalCameraRotation; |
|||
} |
|||
|
|||
transform.position = m_CurrentCamera.transform.position; |
|||
transform.rotation = m_CurrentCamera.transform.rotation; |
|||
} |
|||
} |
|||
|
|||
if (m_MessageTimer < m_MessageDuration) |
|||
{ |
|||
string cameraName = m_CurrentCamera != null ? m_CurrentCamera.name : "NULL"; |
|||
string message = string.Format("Switching to camera : {0}", cameraName); |
|||
Debugging.PushDebugMessage(message); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f52d1e5345c395641b482217c8804ff9 |
|||
timeCreated: 1488380874 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
|
|||
public class FreeCamera : MonoBehaviour |
|||
{ |
|||
public float m_LookSpeedController = 120f; |
|||
public float m_LookSpeedMouse = 10.0f; |
|||
public float m_MoveSpeed = 50.0f; |
|||
public float m_Turbo = 10.0f; |
|||
|
|||
|
|||
private static string kMouseX = "Mouse X"; |
|||
private static string kMouseY = "Mouse Y"; |
|||
private static string kRightStickX = "Controller Right Stick X"; |
|||
private static string kRightStickY = "Controller Right Stick Y"; |
|||
private static string kVertical = "Vertical"; |
|||
private static string kHorizontal = "Horizontal"; |
|||
private string[] m_RequiredInputAxes = { kMouseX, kMouseY, kRightStickX, kRightStickY, kVertical, kHorizontal }; |
|||
|
|||
private bool m_Valid = true; |
|||
void OnEnable() |
|||
{ |
|||
m_Valid = Debugging.CheckRequiredInputAxisMapping(m_RequiredInputAxes); |
|||
} |
|||
|
|||
void Update() |
|||
{ |
|||
if(m_Valid) |
|||
{ |
|||
float inputRotateAxisX = 0.0f; |
|||
float inputRotateAxisY = 0.0f; |
|||
if (Input.GetMouseButton(1)) |
|||
{ |
|||
inputRotateAxisX = Input.GetAxis(kMouseX) * m_LookSpeedMouse; |
|||
inputRotateAxisY = Input.GetAxis(kMouseY) * m_LookSpeedMouse; |
|||
} |
|||
inputRotateAxisX += (Input.GetAxis(kRightStickX) * m_LookSpeedController * Time.deltaTime); |
|||
inputRotateAxisY += (Input.GetAxis(kRightStickY) * m_LookSpeedController * Time.deltaTime); |
|||
|
|||
float inputVertical = Input.GetAxis(kVertical); |
|||
float inputHorizontal = Input.GetAxis(kHorizontal); |
|||
|
|||
bool moved = inputRotateAxisX != 0.0f || inputRotateAxisY != 0.0f || inputVertical != 0.0f || inputHorizontal != 0.0f; |
|||
if (moved) |
|||
{ |
|||
float rotationX = transform.localEulerAngles.x; |
|||
float newRotationY = transform.localEulerAngles.y + inputRotateAxisX; |
|||
|
|||
// Weird clamping code due to weird Euler angle mapping...
|
|||
float newRotationX = (rotationX - inputRotateAxisY); |
|||
if (rotationX <= 90.0f && newRotationX >= 0.0f) |
|||
newRotationX = Mathf.Clamp(newRotationX, 0.0f, 90.0f); |
|||
if (rotationX >= 270.0f) |
|||
newRotationX = Mathf.Clamp(newRotationX, 270.0f, 360.0f); |
|||
|
|||
transform.localRotation = Quaternion.Euler(newRotationX, newRotationY, transform.localEulerAngles.z); |
|||
|
|||
float moveSpeed = Time.deltaTime * m_MoveSpeed; |
|||
if (Input.GetMouseButton(1)) |
|||
moveSpeed *= Input.GetKey(KeyCode.LeftShift) ? m_Turbo : 1.0f; |
|||
else |
|||
moveSpeed *= Input.GetAxis("Fire1") > 0.0f ? m_Turbo : 1.0f; |
|||
transform.position += transform.forward * moveSpeed * inputVertical; |
|||
transform.position += transform.right * moveSpeed * inputHorizontal; |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 618b0e3f6c65dd247a4a016150006c57 |
|||
timeCreated: 1488370968 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: e9493dbe9d624704d9a80a75d52835b3 |
|||
timeCreated: 1485361779 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEngine.Rendering; |
|||
#if UNITY_EDITOR
|
|||
using UnityEditor; |
|||
#endif
|
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
[Serializable] |
|||
public class SubsurfaceScatteringProfile |
|||
{ |
|||
public const int numSamples = 7; // Must be an odd number
|
|||
|
|||
[SerializeField, ColorUsage(false, true, 0.05f, 2.0f, 1.0f, 1.0f)] |
|||
public Color stdDev1; |
|||
[SerializeField, ColorUsage(false, true, 0.05f, 2.0f, 1.0f, 1.0f)] |
|||
public Color stdDev2; |
|||
[SerializeField] |
|||
public float lerpWeight; |
|||
[SerializeField] |
|||
public bool enableTransmission; |
|||
[SerializeField] |
|||
public Vector2 thicknessRemap; |
|||
[SerializeField] [HideInInspector] |
|||
Vector4[] m_FilterKernel; |
|||
[SerializeField] [HideInInspector] |
|||
Vector3[] m_HalfRcpVariances; |
|||
[SerializeField] [HideInInspector] |
|||
Vector4 m_HalfRcpWeightedVariances; |
|||
|
|||
// --- Public Methods ---
|
|||
|
|||
public SubsurfaceScatteringProfile() |
|||
{ |
|||
stdDev1 = new Color(0.3f, 0.3f, 0.3f, 0.0f); |
|||
stdDev2 = new Color(0.6f, 0.6f, 0.6f, 0.0f); |
|||
lerpWeight = 0.5f; |
|||
enableTransmission = false; |
|||
thicknessRemap = new Vector2(0, 3); |
|||
|
|||
UpdateKernelAndVarianceData(); |
|||
} |
|||
|
|||
public Vector4[] filterKernel |
|||
{ |
|||
// Set via UpdateKernelAndVarianceData().
|
|||
get { return m_FilterKernel; } |
|||
} |
|||
|
|||
public Vector3[] halfRcpVariances |
|||
{ |
|||
// Set via UpdateKernelAndVarianceData().
|
|||
get { return m_HalfRcpVariances; } |
|||
} |
|||
|
|||
public Vector4 halfRcpWeightedVariances |
|||
{ |
|||
// Set via UpdateKernelAndVarianceData().
|
|||
get { return m_HalfRcpWeightedVariances; } |
|||
} |
|||
|
|||
public void UpdateKernelAndVarianceData() |
|||
{ |
|||
if (m_FilterKernel == null) |
|||
{ |
|||
m_FilterKernel = new Vector4[numSamples]; |
|||
} |
|||
|
|||
if (m_HalfRcpVariances == null) |
|||
{ |
|||
m_HalfRcpVariances = new Vector3[2]; |
|||
} |
|||
|
|||
// Our goal is to blur the image using a filter which is represented
|
|||
// as a product of a linear combination of two normalized 1D Gaussians
|
|||
// as suggested by Jimenez et al. in "Separable Subsurface Scattering".
|
|||
// A normalized (i.e. energy-preserving) 1D Gaussian with the mean of 0
|
|||
// is defined as follows: G1(x, v) = exp(-x� / (2 * v)) / sqrt(2 * Pi * v),
|
|||
// where 'v' is variance and 'x' is the radial distance from the origin.
|
|||
// Using the weight 'w', our 1D and the resulting 2D filters are given as:
|
|||
// A1(v1, v2, w, x) = G1(x, v1) * (1 - w) + G1(r, v2) * w,
|
|||
// A2(v1, v2, w, x, y) = A1(v1, v2, w, x) * A1(v1, v2, w, y).
|
|||
// The resulting filter function is a non-Gaussian PDF.
|
|||
// It is separable by design, but generally not radially symmetric.
|
|||
|
|||
// Find the widest Gaussian across 3 color channels.
|
|||
float maxStdDev1 = Mathf.Max(stdDev1.r, stdDev1.g, stdDev1.b); |
|||
float maxStdDev2 = Mathf.Max(stdDev2.r, stdDev2.g, stdDev2.b); |
|||
|
|||
Vector3 weightSum = new Vector3(0, 0, 0); |
|||
|
|||
// Importance sample the linear combination of two Gaussians.
|
|||
for (uint i = 0; i < numSamples; i++) |
|||
{ |
|||
float u = (i + 0.5f) / numSamples; |
|||
float pos = GaussianCombinationCdfInverse(u, maxStdDev1, maxStdDev2, lerpWeight); |
|||
float pdf = GaussianCombination(pos, maxStdDev1, maxStdDev2, lerpWeight); |
|||
|
|||
Vector3 val; |
|||
val.x = GaussianCombination(pos, stdDev1.r, stdDev2.r, lerpWeight); |
|||
val.y = GaussianCombination(pos, stdDev1.g, stdDev2.g, lerpWeight); |
|||
val.z = GaussianCombination(pos, stdDev1.b, stdDev2.b, lerpWeight); |
|||
|
|||
// We do not divide by 'numSamples' since we will renormalize, anyway.
|
|||
m_FilterKernel[i].x = val.x * (1 / pdf); |
|||
m_FilterKernel[i].y = val.y * (1 / pdf); |
|||
m_FilterKernel[i].z = val.z * (1 / pdf); |
|||
m_FilterKernel[i].w = pos; |
|||
|
|||
weightSum.x += m_FilterKernel[i].x; |
|||
weightSum.y += m_FilterKernel[i].y; |
|||
weightSum.z += m_FilterKernel[i].z; |
|||
} |
|||
|
|||
// Renormalize the weights to conserve energy.
|
|||
for (uint i = 0; i < numSamples; i++) |
|||
{ |
|||
m_FilterKernel[i].x *= 1 / weightSum.x; |
|||
m_FilterKernel[i].y *= 1 / weightSum.y; |
|||
m_FilterKernel[i].z *= 1 / weightSum.z; |
|||
} |
|||
|
|||
// Store (1 / (2 * Variance)) per color channel per Gaussian.
|
|||
m_HalfRcpVariances[0].x = 0.5f / (stdDev1.r * stdDev1.r); |
|||
m_HalfRcpVariances[0].y = 0.5f / (stdDev1.g * stdDev1.g); |
|||
m_HalfRcpVariances[0].z = 0.5f / (stdDev1.b * stdDev1.b); |
|||
m_HalfRcpVariances[1].x = 0.5f / (stdDev2.r * stdDev2.r); |
|||
m_HalfRcpVariances[1].y = 0.5f / (stdDev2.g * stdDev2.g); |
|||
m_HalfRcpVariances[1].z = 0.5f / (stdDev2.b * stdDev2.b); |
|||
|
|||
Vector4 weightedStdDev; |
|||
weightedStdDev.x = Mathf.Lerp(stdDev1.r, stdDev2.r, lerpWeight); |
|||
weightedStdDev.y = Mathf.Lerp(stdDev1.g, stdDev2.g, lerpWeight); |
|||
weightedStdDev.z = Mathf.Lerp(stdDev1.b, stdDev2.b, lerpWeight); |
|||
weightedStdDev.w = Mathf.Lerp(maxStdDev1, maxStdDev2, lerpWeight); |
|||
|
|||
// Store (1 / (2 * WeightedVariance)) per color channel.
|
|||
m_HalfRcpWeightedVariances.x = 0.5f / (weightedStdDev.x * weightedStdDev.x); |
|||
m_HalfRcpWeightedVariances.y = 0.5f / (weightedStdDev.y * weightedStdDev.y); |
|||
m_HalfRcpWeightedVariances.z = 0.5f / (weightedStdDev.z * weightedStdDev.z); |
|||
m_HalfRcpWeightedVariances.w = 0.5f / (weightedStdDev.w * weightedStdDev.w); |
|||
} |
|||
|
|||
// --- Private Methods ---
|
|||
|
|||
static float Gaussian(float x, float stdDev) |
|||
{ |
|||
float variance = stdDev * stdDev; |
|||
return Mathf.Exp(-x * x / (2 * variance)) / Mathf.Sqrt(2 * Mathf.PI * variance); |
|||
} |
|||
|
|||
static float GaussianCombination(float x, float stdDev1, float stdDev2, float lerpWeight) |
|||
{ |
|||
return Mathf.Lerp(Gaussian(x, stdDev1), Gaussian(x, stdDev2), lerpWeight); |
|||
} |
|||
|
|||
static float RationalApproximation(float t) |
|||
{ |
|||
// Abramowitz and Stegun formula 26.2.23.
|
|||
// The absolute value of the error should be less than 4.5 e-4.
|
|||
float[] c = {2.515517f, 0.802853f, 0.010328f}; |
|||
float[] d = {1.432788f, 0.189269f, 0.001308f}; |
|||
return t - ((c[2] * t + c[1]) * t + c[0]) / (((d[2] * t + d[1]) * t + d[0]) * t + 1.0f); |
|||
} |
|||
|
|||
// Ref: https://www.johndcook.com/blog/csharp_phi_inverse/
|
|||
static float NormalCdfInverse(float p, float stdDev) |
|||
{ |
|||
float x; |
|||
|
|||
if (p < 0.5) |
|||
{ |
|||
// F^-1(p) = - G^-1(p)
|
|||
x = -RationalApproximation(Mathf.Sqrt(-2.0f * Mathf.Log(p))); |
|||
} |
|||
else |
|||
{ |
|||
// F^-1(p) = G^-1(1-p)
|
|||
x = RationalApproximation(Mathf.Sqrt(-2.0f * Mathf.Log(1.0f - p))); |
|||
} |
|||
|
|||
return x * stdDev; |
|||
} |
|||
|
|||
static float GaussianCombinationCdfInverse(float p, float stdDev1, float stdDev2, float lerpWeight) |
|||
{ |
|||
return Mathf.Lerp(NormalCdfInverse(p, stdDev1), NormalCdfInverse(p, stdDev2), lerpWeight); |
|||
} |
|||
} |
|||
|
|||
public class SubsurfaceScatteringParameters : ScriptableObject |
|||
{ |
|||
public const int maxNumProfiles = 8; |
|||
|
|||
[SerializeField] |
|||
bool m_EnableSSS; |
|||
[SerializeField] |
|||
int m_NumProfiles; |
|||
[SerializeField] |
|||
int m_TransmissionFlags; |
|||
[SerializeField] |
|||
SubsurfaceScatteringProfile[] m_Profiles; |
|||
[SerializeField] |
|||
float[] m_ThicknessRemaps; |
|||
[SerializeField] |
|||
Vector4[] m_HalfRcpVariancesAndLerpWeights; |
|||
[SerializeField] |
|||
Vector4[] m_HalfRcpWeightedVariances; |
|||
[SerializeField] |
|||
Vector4[] m_FilterKernels; |
|||
|
|||
// --- Public Methods ---
|
|||
|
|||
public SubsurfaceScatteringParameters() |
|||
{ |
|||
m_EnableSSS = true; |
|||
m_NumProfiles = 1; |
|||
m_Profiles = new SubsurfaceScatteringProfile[m_NumProfiles]; |
|||
|
|||
for (int i = 0; i < m_NumProfiles; i++) |
|||
{ |
|||
m_Profiles[i] = new SubsurfaceScatteringProfile(); |
|||
} |
|||
|
|||
OnValidate(); |
|||
} |
|||
|
|||
public bool enableSSS { |
|||
// Set via serialization.
|
|||
get { return m_EnableSSS; } |
|||
} |
|||
|
|||
public SubsurfaceScatteringProfile[] profiles { |
|||
// Set via serialization.
|
|||
get { return m_Profiles; } |
|||
} |
|||
|
|||
// Returns a bit mask s.t. the i-th bit indicates whether the i-th profile requires transmittance evaluation.
|
|||
// Supplies '_TransmissionFlags' to Lit.hlsl.
|
|||
public int transmissionFlags { |
|||
// Set during OnValidate().
|
|||
get { return m_TransmissionFlags; } |
|||
} |
|||
|
|||
// Supplies '_ThicknessRemaps' to Lit.hlsl.
|
|||
public float[] thicknessRemaps |
|||
{ |
|||
// Set during OnValidate().
|
|||
get { return m_ThicknessRemaps; } |
|||
} |
|||
|
|||
// Supplies '_HalfRcpVariancesAndLerpWeights' to Lit.hlsl.
|
|||
public Vector4[] halfRcpVariancesAndLerpWeights { |
|||
// Set during OnValidate().
|
|||
get { return m_HalfRcpVariancesAndLerpWeights; } |
|||
} |
|||
|
|||
// Supplies '_HalfRcpWeightedVariances' to CombineSubsurfaceScattering.shader.
|
|||
public Vector4[] halfRcpWeightedVariances { |
|||
// Set during OnValidate().
|
|||
get { return m_HalfRcpWeightedVariances; } |
|||
} |
|||
|
|||
// Supplies '_FilterKernels' to CombineSubsurfaceScattering.shader.
|
|||
public Vector4[] filterKernels |
|||
{ |
|||
// Set during OnValidate().
|
|||
get { return m_FilterKernels; } |
|||
} |
|||
|
|||
public void OnValidate() |
|||
{ |
|||
if (m_Profiles.Length > maxNumProfiles) |
|||
{ |
|||
Array.Resize(ref m_Profiles, maxNumProfiles); |
|||
} |
|||
|
|||
m_NumProfiles = m_Profiles.Length; |
|||
m_TransmissionFlags = 0; |
|||
|
|||
if (m_ThicknessRemaps == null) |
|||
{ |
|||
m_ThicknessRemaps = new float[maxNumProfiles * 2]; |
|||
} |
|||
|
|||
if (m_HalfRcpVariancesAndLerpWeights == null) |
|||
{ |
|||
m_HalfRcpVariancesAndLerpWeights = new Vector4[maxNumProfiles * 2]; |
|||
} |
|||
|
|||
if (m_HalfRcpWeightedVariances == null) |
|||
{ |
|||
m_HalfRcpWeightedVariances = new Vector4[maxNumProfiles]; |
|||
} |
|||
|
|||
if (m_FilterKernels == null) |
|||
{ |
|||
m_FilterKernels = new Vector4[maxNumProfiles * SubsurfaceScatteringProfile.numSamples]; |
|||
} |
|||
|
|||
Color c = new Color(); |
|||
|
|||
for (int i = 0; i < m_NumProfiles; i++) |
|||
{ |
|||
m_TransmissionFlags |= (m_Profiles[i].enableTransmission ? 1 : 0) << i; |
|||
|
|||
c.r = Mathf.Clamp(m_Profiles[i].stdDev1.r, 0.05f, 2.0f); |
|||
c.g = Mathf.Clamp(m_Profiles[i].stdDev1.g, 0.05f, 2.0f); |
|||
c.b = Mathf.Clamp(m_Profiles[i].stdDev1.b, 0.05f, 2.0f); |
|||
c.a = 0.0f; |
|||
|
|||
m_Profiles[i].stdDev1 = c; |
|||
|
|||
c.r = Mathf.Clamp(m_Profiles[i].stdDev2.r, 0.05f, 2.0f); |
|||
c.g = Mathf.Clamp(m_Profiles[i].stdDev2.g, 0.05f, 2.0f); |
|||
c.b = Mathf.Clamp(m_Profiles[i].stdDev2.b, 0.05f, 2.0f); |
|||
c.a = 0.0f; |
|||
|
|||
m_Profiles[i].stdDev2 = c; |
|||
|
|||
m_Profiles[i].lerpWeight = Mathf.Clamp01(m_Profiles[i].lerpWeight); |
|||
|
|||
m_Profiles[i].thicknessRemap.x = Mathf.Clamp(m_Profiles[i].thicknessRemap.x, 0, m_Profiles[i].thicknessRemap.y); |
|||
m_Profiles[i].thicknessRemap.y = Mathf.Max(m_Profiles[i].thicknessRemap.x, m_Profiles[i].thicknessRemap.y); |
|||
|
|||
m_Profiles[i].UpdateKernelAndVarianceData(); |
|||
} |
|||
|
|||
// Use the updated data to fill the cache.
|
|||
for (int i = 0; i < m_NumProfiles; i++) |
|||
{ |
|||
m_ThicknessRemaps[2 * i] = m_Profiles[i].thicknessRemap.x; |
|||
m_ThicknessRemaps[2 * i + 1] = m_Profiles[i].thicknessRemap.y - m_Profiles[i].thicknessRemap.x; |
|||
m_HalfRcpVariancesAndLerpWeights[2 * i] = m_Profiles[i].halfRcpVariances[0]; |
|||
m_HalfRcpVariancesAndLerpWeights[2 * i].w = 1.0f - m_Profiles[i].lerpWeight; |
|||
m_HalfRcpVariancesAndLerpWeights[2 * i + 1] = m_Profiles[i].halfRcpVariances[1]; |
|||
m_HalfRcpVariancesAndLerpWeights[2 * i + 1].w = m_Profiles[i].lerpWeight; |
|||
m_HalfRcpWeightedVariances[i] = m_Profiles[i].halfRcpWeightedVariances; |
|||
|
|||
for (int j = 0, n = SubsurfaceScatteringProfile.numSamples; j < n; j++) |
|||
{ |
|||
m_FilterKernels[n * i + j] = m_Profiles[i].filterKernel[j]; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
public class SubsurfaceScatteringSettings : Singleton<SubsurfaceScatteringSettings> |
|||
{ |
|||
SubsurfaceScatteringParameters settings { get; set; } |
|||
|
|||
public static SubsurfaceScatteringParameters overrideSettings |
|||
{ |
|||
get { return instance.settings; } |
|||
set { instance.settings = value; } |
|||
} |
|||
} |
|||
|
|||
#if UNITY_EDITOR
|
|||
[CustomEditor(typeof(SubsurfaceScatteringParameters))] |
|||
public class SubsurfaceScatteringParametersEditor : Editor |
|||
{ |
|||
private class Styles |
|||
{ |
|||
public readonly GUIContent category = new GUIContent("Subsurface scattering parameters"); |
|||
public readonly GUIContent[] profiles = new GUIContent[SubsurfaceScatteringParameters.maxNumProfiles] { new GUIContent("Profile #0"), new GUIContent("Profile #1"), new GUIContent("Profile #2"), new GUIContent("Profile #3"), new GUIContent("Profile #4"), new GUIContent("Profile #5"), new GUIContent("Profile #6"), new GUIContent("Profile #7") }; |
|||
public readonly GUIContent profilePreview0 = new GUIContent("Profile preview"); |
|||
public readonly GUIContent profilePreview1 = new GUIContent("Shows the fraction of light scattered from the source as radius increases to 1."); |
|||
public readonly GUIContent profilePreview2 = new GUIContent("Note that the intensity of the region in the center may be clamped."); |
|||
public readonly GUIContent transmittancePreview0 = new GUIContent("Transmittance preview"); |
|||
public readonly GUIContent transmittancePreview1 = new GUIContent("Shows the fraction of light passing through the object as thickness increases to 1."); |
|||
public readonly GUIContent numProfiles = new GUIContent("Number of profiles"); |
|||
public readonly GUIContent profileStdDev1 = new GUIContent("Standard deviation #1", "Determines the shape of the 1st Gaussian filter. Increases the strength and the radius of the blur of the corresponding color channel."); |
|||
public readonly GUIContent profileStdDev2 = new GUIContent("Standard deviation #2", "Determines the shape of the 2nd Gaussian filter. Increases the strength and the radius of the blur of the corresponding color channel."); |
|||
public readonly GUIContent profileLerpWeight = new GUIContent("Filter interpolation", "Controls linear interpolation between the two Gaussian filters."); |
|||
public readonly GUIContent profileTransmission = new GUIContent("Enable transmission", "Toggles simulation of light passing through thin objects. Depends on the thickness of the material."); |
|||
public readonly GUIContent profileThicknessRemap = new GUIContent("Thickness remap", "Remaps the thickness parameter from [0, 1] to the desired range."); |
|||
|
|||
public readonly GUIStyle centeredMiniBoldLabel = new GUIStyle (GUI.skin.label); |
|||
} |
|||
|
|||
private static Styles s_Styles; |
|||
private SerializedProperty m_EnableSSS, m_Profiles, m_NumProfiles; |
|||
private Material m_ProfileMaterial, m_TransmittanceMaterial; |
|||
private RenderTexture[] m_ProfileImages, m_TransmittanceImages; |
|||
|
|||
// --- Public Methods ---
|
|||
|
|||
private static Styles styles |
|||
{ |
|||
get |
|||
{ |
|||
if (s_Styles == null) |
|||
{ |
|||
s_Styles = new Styles(); |
|||
|
|||
s_Styles.centeredMiniBoldLabel.alignment = TextAnchor.MiddleCenter; |
|||
s_Styles.centeredMiniBoldLabel.fontSize = 10; |
|||
s_Styles.centeredMiniBoldLabel.fontStyle = FontStyle.Bold; |
|||
} |
|||
|
|||
return s_Styles; |
|||
} |
|||
} |
|||
|
|||
void OnEnable() |
|||
{ |
|||
m_EnableSSS = serializedObject.FindProperty("m_EnableSSS"); |
|||
m_Profiles = serializedObject.FindProperty("m_Profiles"); |
|||
m_NumProfiles = m_Profiles.FindPropertyRelative("Array.size"); |
|||
m_ProfileMaterial = Utilities.CreateEngineMaterial("Hidden/HDRenderPipeline/DrawGaussianProfile"); |
|||
m_TransmittanceMaterial = Utilities.CreateEngineMaterial("Hidden/HDRenderPipeline/DrawTransmittanceGraph"); |
|||
m_ProfileImages = new RenderTexture[SubsurfaceScatteringParameters.maxNumProfiles]; |
|||
m_TransmittanceImages = new RenderTexture[SubsurfaceScatteringParameters.maxNumProfiles]; |
|||
|
|||
for (int i = 0; i < SubsurfaceScatteringParameters.maxNumProfiles; i++) |
|||
{ |
|||
m_ProfileImages[i] = new RenderTexture(256, 256, 0, RenderTextureFormat.DefaultHDR); |
|||
m_TransmittanceImages[i] = new RenderTexture(16, 256, 0, RenderTextureFormat.DefaultHDR); |
|||
} |
|||
} |
|||
|
|||
public override void OnInspectorGUI() |
|||
{ |
|||
serializedObject.Update(); |
|||
|
|||
EditorGUI.BeginChangeCheck(); |
|||
|
|||
// Validate the data before displaying it.
|
|||
((SubsurfaceScatteringParameters)serializedObject.targetObject).OnValidate(); |
|||
|
|||
EditorGUILayout.LabelField(styles.category, EditorStyles.boldLabel); |
|||
|
|||
EditorGUILayout.PropertyField(m_EnableSSS); |
|||
EditorGUILayout.PropertyField(m_NumProfiles, styles.numProfiles); |
|||
EditorGUILayout.PropertyField(m_Profiles); |
|||
|
|||
if (m_Profiles.isExpanded) |
|||
{ |
|||
EditorGUI.indentLevel++; |
|||
|
|||
for (int i = 0, n = Math.Min(m_Profiles.arraySize, SubsurfaceScatteringParameters.maxNumProfiles); i < n; i++) |
|||
{ |
|||
SerializedProperty profile = m_Profiles.GetArrayElementAtIndex(i); |
|||
EditorGUILayout.PropertyField(profile, styles.profiles[i]); |
|||
|
|||
if (profile.isExpanded) |
|||
{ |
|||
EditorGUI.indentLevel++; |
|||
|
|||
SerializedProperty profileStdDev1 = profile.FindPropertyRelative("stdDev1"); |
|||
SerializedProperty profileStdDev2 = profile.FindPropertyRelative("stdDev2"); |
|||
SerializedProperty profileLerpWeight = profile.FindPropertyRelative("lerpWeight"); |
|||
SerializedProperty profileTransmission = profile.FindPropertyRelative("enableTransmission"); |
|||
SerializedProperty profileThicknessRemap = profile.FindPropertyRelative("thicknessRemap"); |
|||
|
|||
EditorGUILayout.PropertyField(profileStdDev1, styles.profileStdDev1); |
|||
EditorGUILayout.PropertyField(profileStdDev2, styles.profileStdDev2); |
|||
EditorGUILayout.PropertyField(profileLerpWeight, styles.profileLerpWeight); |
|||
EditorGUILayout.PropertyField(profileTransmission, styles.profileTransmission); |
|||
|
|||
Vector2 thicknessRemap = profileThicknessRemap.vector2Value; |
|||
EditorGUILayout.LabelField("Min thickness: ", thicknessRemap.x.ToString()); |
|||
EditorGUILayout.LabelField("Max thickness: ", thicknessRemap.y.ToString()); |
|||
EditorGUILayout.MinMaxSlider(styles.profileThicknessRemap, ref thicknessRemap.x, ref thicknessRemap.y, 0, 10); |
|||
profileThicknessRemap.vector2Value = thicknessRemap; |
|||
|
|||
EditorGUILayout.Space(); |
|||
EditorGUILayout.LabelField(styles.profilePreview0, styles.centeredMiniBoldLabel); |
|||
EditorGUILayout.LabelField(styles.profilePreview1, EditorStyles.centeredGreyMiniLabel); |
|||
EditorGUILayout.LabelField(styles.profilePreview2, EditorStyles.centeredGreyMiniLabel); |
|||
EditorGUILayout.Space(); |
|||
|
|||
// Draw the profile.
|
|||
m_ProfileMaterial.SetColor("_StdDev1", profileStdDev1.colorValue); |
|||
m_ProfileMaterial.SetColor("_StdDev2", profileStdDev2.colorValue); |
|||
m_ProfileMaterial.SetFloat("_LerpWeight", profileLerpWeight.floatValue); |
|||
EditorGUI.DrawPreviewTexture(GUILayoutUtility.GetRect(256, 256), m_ProfileImages[i], m_ProfileMaterial, ScaleMode.ScaleToFit, 1.0f); |
|||
|
|||
EditorGUILayout.Space(); |
|||
EditorGUILayout.LabelField(styles.transmittancePreview0, styles.centeredMiniBoldLabel); |
|||
EditorGUILayout.LabelField(styles.transmittancePreview1, EditorStyles.centeredGreyMiniLabel); |
|||
EditorGUILayout.Space(); |
|||
|
|||
// Draw the transmittance graph.
|
|||
m_TransmittanceMaterial.SetColor("_StdDev1", profileStdDev1.colorValue); |
|||
m_TransmittanceMaterial.SetColor("_StdDev2", profileStdDev2.colorValue); |
|||
m_TransmittanceMaterial.SetFloat("_LerpWeight", profileLerpWeight.floatValue); |
|||
m_TransmittanceMaterial.SetVector("_ThicknessRemap", profileThicknessRemap.vector2Value); |
|||
EditorGUI.DrawPreviewTexture(GUILayoutUtility.GetRect(16, 16), m_TransmittanceImages[i], m_TransmittanceMaterial, ScaleMode.ScaleToFit, 16.0f); |
|||
|
|||
EditorGUILayout.Space(); |
|||
|
|||
EditorGUI.indentLevel--; |
|||
} |
|||
} |
|||
|
|||
EditorGUI.indentLevel--; |
|||
} |
|||
|
|||
if (EditorGUI.EndChangeCheck()) |
|||
{ |
|||
// Serialization does not invoke setters, but does call OnValidate().
|
|||
serializedObject.ApplyModifiedProperties(); |
|||
} |
|||
} |
|||
} |
|||
#endif
|
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue