浏览代码

initial port of Classic OnChip Deferred Mobile Renderloop based on exisitng standard and deferred shaders from built-in renderloops with new shadows.

/main
Filip Iliescu 8 年前
当前提交
1109a6c7
共有 49 个文件被更改,包括 5811 次插入0 次删除
  1. 9
      Assets/ScriptableRenderPipeline/MobileRenderPipeline.meta
  2. 9
      Assets/TestScenes/MobileDeferredTest.meta
  3. 9
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred.meta
  4. 523
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/ClassicDeferredPipeline.cs
  5. 12
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/ClassicDeferredPipeline.cs.meta
  6. 720
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/HLSLSupport.cginc
  7. 9
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/HLSLSupport.cginc.meta
  8. 142
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/Internal-DeferredReflections.shader
  9. 9
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/Internal-DeferredReflections.shader.meta
  10. 178
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/Internal-DeferredShading.shader
  11. 9
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/Internal-DeferredShading.shader.meta
  12. 9
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightVolumes.meta
  13. 9
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightVolumes/Materials.meta
  14. 75
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightVolumes/Materials/No Name.mat
  15. 9
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightVolumes/Materials/No Name.mat.meta
  16. 385
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightVolumes/icosahedron.fbx
  17. 84
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightVolumes/icosahedron.fbx.meta
  18. 410
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightVolumes/icosphere.fbx
  19. 84
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightVolumes/icosphere.fbx.meta
  20. 378
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightVolumes/pyramid.fbx
  21. 84
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightVolumes/pyramid.fbx.meta
  22. 283
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightingTemplate.hlsl
  23. 9
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightingTemplate.hlsl.meta
  24. 79
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/Skybox-Cubed.shader
  25. 9
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/Skybox-Cubed.shader.meta
  26. 336
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/Standard.shader
  27. 9
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/Standard.shader.meta
  28. 335
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/StandardSpecular.shader
  29. 9
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/StandardSpecular.shader.meta
  30. 203
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/UnityDeferredLibrary.cginc
  31. 9
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/UnityDeferredLibrary.cginc.meta
  32. 693
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/UnityStandardCore.cginc
  33. 9
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/UnityStandardCore.cginc.meta
  34. 29
      Assets/TestScenes/MobileDeferredTest/ClassicDeferredPipeline.asset
  35. 9
      Assets/TestScenes/MobileDeferredTest/ClassicDeferredPipeline.asset.meta
  36. 430
      Assets/TestScenes/MobileDeferredTest/ClassicDeferredTest.unity
  37. 8
      Assets/TestScenes/MobileDeferredTest/ClassicDeferredTest.unity.meta
  38. 9
      Assets/TestScenes/MobileDeferredTest/Materials.meta
  39. 80
      Assets/TestScenes/MobileDeferredTest/Materials/SRP_StandardSpec.mat
  40. 9
      Assets/TestScenes/MobileDeferredTest/Materials/SRP_StandardSpec.mat.meta
  41. 80
      Assets/TestScenes/MobileDeferredTest/Materials/sphereGloss.mat
  42. 9
      Assets/TestScenes/MobileDeferredTest/Materials/sphereGloss.mat.meta
  43. 9
      Assets/TestScenes/MobileDeferredTest/Model.meta

9
Assets/ScriptableRenderPipeline/MobileRenderPipeline.meta


fileFormatVersion: 2
guid: f3fc0327e8ac441a89bebf2193a37f38
folderAsset: yes
timeCreated: 1490047261
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

9
Assets/TestScenes/MobileDeferredTest.meta


fileFormatVersion: 2
guid: 447cd88b2a10441b0970c782d8f7175a
folderAsset: yes
timeCreated: 1490056679
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

9
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred.meta


fileFormatVersion: 2
guid: 1299fcd744a6b48f39b1b46a1fcbcfde
folderAsset: yes
timeCreated: 1490047296
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

523
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/ClassicDeferredPipeline.cs


using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Experimental.Rendering;
public class ClassicDeferredPipelineInstance : RenderPipeline {
private readonly ClassicDeferredPipeline m_Owner;
public ClassicDeferredPipelineInstance(ClassicDeferredPipeline owner)
{
m_Owner = owner;
if (m_Owner != null)
m_Owner.Build();
}
public override void Dispose()
{
base.Dispose();
if (m_Owner != null)
m_Owner.Cleanup();
}
public override void Render(ScriptableRenderContext renderContext, Camera[] cameras)
{
base.Render(renderContext, cameras);
m_Owner.Render(renderContext, cameras);
}
}
[ExecuteInEditMode]
public class ClassicDeferredPipeline : RenderPipelineAsset {
#if UNITY_EDITOR
[UnityEditor.MenuItem("RenderPipeline/Create ClassicDeferredPipeline")]
static void CreateDeferredRenderPipeline()
{
var instance = ScriptableObject.CreateInstance<ClassicDeferredPipeline> ();
UnityEditor.AssetDatabase.CreateAsset (instance, "Assets/ClassicDeferredPipeline.asset");
}
#endif
protected override IRenderPipeline InternalCreatePipeline()
{
return new ClassicDeferredPipelineInstance(this);
}
[SerializeField]
ShadowSettings m_ShadowSettings = ShadowSettings.Default;
ShadowRenderPass m_ShadowPass;
const int k_MaxLights = 10;
const int k_MaxShadowmapPerLights = 6;
const int k_MaxDirectionalSplit = 4;
Matrix4x4[] m_MatWorldToShadow = new Matrix4x4[k_MaxLights * k_MaxShadowmapPerLights];
Vector4[] m_DirShadowSplitSpheres = new Vector4[k_MaxDirectionalSplit];
Vector4[] m_Shadow3X3PCFTerms = new Vector4[4];
[NonSerialized]
private int m_WarnedTooManyLights = 0;
private int m_shadowBufferID;
public Mesh m_PointLightMesh;
public Mesh m_SpotLightMesh;
public Mesh m_QuadMesh;
public Shader finalPassShader;
public Shader deferredShader;
public Shader deferredReflectionShader;
private static int s_GBufferAlbedo;
private static int s_GBufferSpecRough;
private static int s_GBufferNormal;
private static int s_GBufferEmission;
private static int s_GBufferRedF32;
private static int s_GBufferZ;
private static int s_CameraTarget;
private static int s_CameraDepthTexture;
private static int m_quadLightingPassNdx;
private static int m_FiniteLightingPassNdx;
private Material m_DeferredMaterial;
private Material m_DeferredReflectionMaterial;
private Material m_BlitMaterial;
public Texture m_DefaultSpotCookie;
private void OnValidate()
{
Build();
}
public void Cleanup()
{
if (m_BlitMaterial) DestroyImmediate(m_BlitMaterial);
if (m_DeferredMaterial) DestroyImmediate(m_DeferredMaterial);
if (m_DeferredReflectionMaterial) DestroyImmediate (m_DeferredReflectionMaterial);
}
public void Build()
{
s_GBufferAlbedo = Shader.PropertyToID ("_CameraGBufferTexture0");
s_GBufferSpecRough = Shader.PropertyToID ("_CameraGBufferTexture1");
s_GBufferNormal = Shader.PropertyToID ("_CameraGBufferTexture2");
s_GBufferEmission = Shader.PropertyToID ("_CameraGBufferTexture3");
s_GBufferRedF32 = Shader.PropertyToID ("_CameraVPDepth");
s_GBufferZ = Shader.PropertyToID ("_CameraGBufferZ"); // used while rendering into G-buffer+
s_CameraDepthTexture = Shader.PropertyToID ("_CameraDepthTexture"); // copy of that for later sampling in shaders
s_CameraTarget = Shader.PropertyToID ("_CameraTarget");
m_BlitMaterial = new Material (finalPassShader) { hideFlags = HideFlags.HideAndDontSave };
m_DeferredMaterial = new Material (deferredShader) { hideFlags = HideFlags.HideAndDontSave };
m_DeferredReflectionMaterial = new Material (deferredReflectionShader) { hideFlags = HideFlags.HideAndDontSave };
m_quadLightingPassNdx = m_DeferredMaterial.FindPass ("DIRECTIONALLIGHT");
m_FiniteLightingPassNdx = m_DeferredMaterial.FindPass ("FINITELIGHT");
//shadows
m_MatWorldToShadow = new Matrix4x4[k_MaxLights * k_MaxShadowmapPerLights];
m_DirShadowSplitSpheres = new Vector4[k_MaxDirectionalSplit];
m_Shadow3X3PCFTerms = new Vector4[4];
m_ShadowPass = new ShadowRenderPass(m_ShadowSettings);
m_shadowBufferID = Shader.PropertyToID("g_tShadowBuffer");
}
public void Render(ScriptableRenderContext context, IEnumerable<Camera> cameras)
{
foreach (var camera in cameras) {
// Culling
CullingParameters cullingParams;
if (!CullResults.GetCullingParameters (camera, out cullingParams))
continue;
m_ShadowPass.UpdateCullingParameters(ref cullingParams);
var cullResults = CullResults.Cull (ref cullingParams, context);
ExecuteRenderLoop(camera, cullResults, context);
}
context.Submit ();
}
void ExecuteRenderLoop(Camera camera, CullResults cullResults, ScriptableRenderContext loop)
{
RenderShadowMaps(cullResults, loop);
loop.SetupCameraProperties(camera);
RenderGBuffer(cullResults, camera, loop);
//DepthOnlyForForwardOpaques(cullResults, camera, loop);
// IF PLATFORM_MAC -- cannot use framebuffer fetch
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
CopyDepthAfterGBuffer(loop);
#endif
PushGlobalShadowParams (loop);
RenderLighting (camera, cullResults, loop);
loop.DrawSkybox (camera);
loop.SetupCameraProperties (camera);
// present frame buffer.
FinalPass(loop);
}
void RenderShadowMaps(CullResults cullResults, ScriptableRenderContext loop)
{
ShadowOutput shadows;
m_ShadowPass.Render(loop, cullResults, out shadows);
UpdateShadowConstants (cullResults.visibleLights, ref shadows);
}
void PushGlobalShadowParams(ScriptableRenderContext loop)
{
var cmd = new CommandBuffer { name = "Push Global Parameters" };
// Shadow constants
cmd.SetGlobalMatrixArray("g_matWorldToShadow", m_MatWorldToShadow);
cmd.SetGlobalVectorArray("g_vDirShadowSplitSpheres", m_DirShadowSplitSpheres);
cmd.SetGlobalVector("g_vShadow3x3PCFTerms0", m_Shadow3X3PCFTerms[0]);
cmd.SetGlobalVector("g_vShadow3x3PCFTerms1", m_Shadow3X3PCFTerms[1]);
cmd.SetGlobalVector("g_vShadow3x3PCFTerms2", m_Shadow3X3PCFTerms[2]);
cmd.SetGlobalVector("g_vShadow3x3PCFTerms3", m_Shadow3X3PCFTerms[3]);
loop.ExecuteCommandBuffer(cmd);
cmd.Dispose();
}
void UpdateShadowConstants(IList<VisibleLight> visibleLights, ref ShadowOutput shadow)
{
var nNumLightsIncludingTooMany = 0;
var numLights = 0;
var lightShadowIndex_LightParams = new Vector4[k_MaxLights];
var lightFalloffParams = new Vector4[k_MaxLights];
for (int nLight = 0; nLight < visibleLights.Count; nLight++)
{
nNumLightsIncludingTooMany++;
if (nNumLightsIncludingTooMany > k_MaxLights)
continue;
var light = visibleLights[nLight];
var lightType = light.lightType;
var position = light.light.transform.position;
var lightDir = light.light.transform.forward.normalized;
// Setup shadow data arrays
var hasShadows = shadow.GetShadowSliceCountLightIndex(nLight) != 0;
if (lightType == LightType.Directional)
{
lightShadowIndex_LightParams[numLights] = new Vector4(0, 0, 1, 1);
lightFalloffParams[numLights] = new Vector4(0.0f, 0.0f, float.MaxValue, (float)lightType);
if (hasShadows)
{
for (int s = 0; s < k_MaxDirectionalSplit; ++s)
{
m_DirShadowSplitSpheres[s] = shadow.directionalShadowSplitSphereSqr[s];
}
}
}
else if (lightType == LightType.Point)
{
lightShadowIndex_LightParams[numLights] = new Vector4(0, 0, 1, 1);
lightFalloffParams[numLights] = new Vector4(1.0f, 0.0f, light.range * light.range, (float)lightType);
}
else if (lightType == LightType.Spot)
{
lightShadowIndex_LightParams[numLights] = new Vector4(0, 0, 1, 1);
lightFalloffParams[numLights] = new Vector4(1.0f, 0.0f, light.range * light.range, (float)lightType);
}
if (hasShadows)
{
// Enable shadows
lightShadowIndex_LightParams[numLights].x = 1;
for (int s = 0; s < shadow.GetShadowSliceCountLightIndex(nLight); ++s)
{
var shadowSliceIndex = shadow.GetShadowSliceIndex(nLight, s);
m_MatWorldToShadow[numLights * k_MaxShadowmapPerLights + s] = shadow.shadowSlices[shadowSliceIndex].shadowTransform.transpose;
}
}
numLights++;
}
// Warn if too many lights found
if (nNumLightsIncludingTooMany > k_MaxLights)
{
if (nNumLightsIncludingTooMany > m_WarnedTooManyLights)
{
Debug.LogError("ERROR! Found " + nNumLightsIncludingTooMany + " runtime lights! Renderer supports up to " + k_MaxLights +
" active runtime lights at a time!\nDisabling " + (nNumLightsIncludingTooMany - k_MaxLights) + " runtime light" +
((nNumLightsIncludingTooMany - k_MaxLights) > 1 ? "s" : "") + "!\n");
}
m_WarnedTooManyLights = nNumLightsIncludingTooMany;
}
else
{
if (m_WarnedTooManyLights > 0)
{
m_WarnedTooManyLights = 0;
Debug.Log("SUCCESS! Found " + nNumLightsIncludingTooMany + " runtime lights which is within the supported number of lights, " + k_MaxLights + ".\n\n");
}
}
// PCF 3x3 Shadows
var flTexelEpsilonX = 1.0f / m_ShadowSettings.shadowAtlasWidth;
var flTexelEpsilonY = 1.0f / m_ShadowSettings.shadowAtlasHeight;
m_Shadow3X3PCFTerms[0] = new Vector4(20.0f / 267.0f, 33.0f / 267.0f, 55.0f / 267.0f, 0.0f);
m_Shadow3X3PCFTerms[1] = new Vector4(flTexelEpsilonX, flTexelEpsilonY, -flTexelEpsilonX, -flTexelEpsilonY);
m_Shadow3X3PCFTerms[2] = new Vector4(flTexelEpsilonX, flTexelEpsilonY, 0.0f, 0.0f);
m_Shadow3X3PCFTerms[3] = new Vector4(-flTexelEpsilonX, -flTexelEpsilonY, 0.0f, 0.0f);
}
static void SetupGBuffer(int width, int height, CommandBuffer cmd)
{
var format10 = RenderTextureFormat.ARGB32;
if (SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGB2101010))
format10 = RenderTextureFormat.ARGB2101010;
var formatHDR = RenderTextureFormat.DefaultHDR;
//@TODO: cleanup, right now only because we want to use unmodified Standard shader that encodes emission differently based on HDR or not,
// so we make it think we always render in HDR
cmd.EnableShaderKeyword ("UNITY_HDR_ON");
//@TODO: GetGraphicsCaps().buggyMRTSRGBWriteFlag
cmd.GetTemporaryRT(s_GBufferAlbedo, width, height, 0, FilterMode.Point, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default);
cmd.GetTemporaryRT(s_GBufferSpecRough, width, height, 0, FilterMode.Point, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default);
cmd.GetTemporaryRT(s_GBufferNormal, width, height, 0, FilterMode.Point, format10, RenderTextureReadWrite.Linear);
cmd.GetTemporaryRT(s_GBufferEmission, width, height, 0, FilterMode.Point, formatHDR, RenderTextureReadWrite.Linear);
cmd.GetTemporaryRT(s_CameraDepthTexture, width, height, 24, FilterMode.Point, RenderTextureFormat.Depth);
cmd.GetTemporaryRT(s_CameraTarget, width, height, 0, FilterMode.Point, formatHDR, RenderTextureReadWrite.Default, 1, true); // rtv/uav
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
cmd.GetTemporaryRT(s_GBufferZ, width, height, 24, FilterMode.Point, RenderTextureFormat.Depth);
var colorMRTs = new RenderTargetIdentifier[4] { s_GBufferAlbedo, s_GBufferSpecRough, s_GBufferNormal, s_GBufferEmission };
cmd.SetRenderTarget(colorMRTs, new RenderTargetIdentifier(s_GBufferZ));
#else
cmd.GetTemporaryRT(s_GBufferZ, width, height, 24, FilterMode.Point, RenderTextureFormat.Depth);
cmd.GetTemporaryRT(s_GBufferRedF32, width, height, 24, FilterMode.Point, RenderTextureFormat.RFloat);
var colorMRTs = new RenderTargetIdentifier[5] { s_GBufferAlbedo, s_GBufferSpecRough, s_GBufferNormal, s_GBufferEmission, s_GBufferRedF32 };
cmd.SetRenderTarget(colorMRTs, new RenderTargetIdentifier(s_GBufferZ));
#endif
cmd.ClearRenderTarget(true, true, new Color(0, 0, 0, 0));
}
static void RenderGBuffer(CullResults cull, Camera camera, ScriptableRenderContext loop)
{
// setup GBuffer for rendering
var cmd = new CommandBuffer { name = "Create G-Buffer" };
SetupGBuffer(camera.pixelWidth, camera.pixelHeight, cmd);
loop.ExecuteCommandBuffer(cmd);
cmd.Dispose();
// render opaque objects using Deferred pass
var settings = new DrawRendererSettings(cull, camera, new ShaderPassName("Deferred"))
{
sorting = {flags = SortFlags.CommonOpaque},
rendererConfiguration = RendererConfiguration.PerObjectLightmaps
};
//@TODO: need to get light probes + LPPV too?
settings.inputFilter.SetQueuesOpaque();
settings.rendererConfiguration = RendererConfiguration.PerObjectLightmaps | RendererConfiguration.PerObjectLightProbe;
loop.DrawRenderers(ref settings);
}
void RenderLighting (Camera camera, CullResults inputs, ScriptableRenderContext loop)
{
var cmd = new CommandBuffer { name = "Lighting" };
// IF PLATFORM_MAC -- cannot use framebuffer fetch
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
cmd.SetRenderTarget (new RenderTargetIdentifier(s_GBufferEmission), new RenderTargetIdentifier (s_GBufferZ));
#endif
foreach (var light in inputs.visibleLights)
{
RenderLightGeometry (camera, light, cmd, loop);
}
loop.ExecuteCommandBuffer (cmd);
cmd.Dispose ();
}
void RenderLightGeometry (Camera camera, VisibleLight light, CommandBuffer cmd, ScriptableRenderContext loop)
{
bool renderAsQuad = (light.flags & VisibleLightFlags.IntersectsNearPlane)!=0 || (light.flags & VisibleLightFlags.IntersectsFarPlane)!=0 || (light.lightType == LightType.Directional);
Vector3 lightPos = light.localToWorld.GetColumn (3); //position
Vector3 lightDir = light.localToWorld.GetColumn (2); //z axis
float range = light.range;
var lightToWorld = light.localToWorld;
var worldToLight = lightToWorld.inverse;
var props = new MaterialPropertyBlock ();
props.SetFloat ("_LightAsQuad", renderAsQuad ? 1 : 0);
props.SetVector ("_LightPos", new Vector4(lightPos.x, lightPos.y, lightPos.z, 1.0f / (range * range)));
props.SetVector ("_LightDir", new Vector4(lightDir.x, lightDir.y, lightDir.z, 0.0f));
props.SetVector ("_LightColor", light.finalColor);
props.SetMatrix ("_WorldToLight", lightToWorld.inverse);
// TODO:OPTIMIZATION DeferredRenderLoop.cpp:660 -- split up into shader varients
cmd.DisableShaderKeyword ("POINT");
cmd.DisableShaderKeyword ("POINT_COOKIE");
cmd.DisableShaderKeyword ("SPOT");
cmd.DisableShaderKeyword ("DIRECTIONAL");
cmd.DisableShaderKeyword ("DIRECTIONAL_COOKIE");
switch (light.lightType)
{
case LightType.Point:
cmd.EnableShaderKeyword ("POINT");
break;
case LightType.Spot:
cmd.EnableShaderKeyword ("SPOT");
break;
case LightType.Directional:
cmd.EnableShaderKeyword ("DIRECTIONAL");
break;
}
Texture cookie = light.light.cookie;
if (cookie != null)
cmd.SetGlobalTexture ("_LightTexture0", cookie);
if ((light.lightType == LightType.Point)) {
var matrix = Matrix4x4.TRS (lightPos, Quaternion.identity, new Vector3 (range*2, range*2, range*2));
if (cookie!=null)
cmd.EnableShaderKeyword ("POINT_COOKIE");
if (renderAsQuad) {
cmd.DrawMesh (m_QuadMesh, Matrix4x4.identity, m_DeferredMaterial, 0, m_quadLightingPassNdx, props);
} else {
cmd.DrawMesh (m_PointLightMesh, matrix, m_DeferredMaterial, 0, m_FiniteLightingPassNdx, props);
}
} else if ((light.lightType == LightType.Spot)) {
float chsa = GetCotanHalfSpotAngle (light.spotAngle);
// Setup Light Matrix
Matrix4x4 temp1 = Matrix4x4.Scale(new Vector3 (-.5f, -.5f, 1.0f));
Matrix4x4 temp2 = Matrix4x4.Translate( new Vector3 (.5f, .5f, 0.0f));
Matrix4x4 temp3 = PerspectiveCotanMatrix (chsa, 0.0f, range);
var LightMatrix0 = temp2 * temp3 * temp1 * worldToLight;
props.SetMatrix ("_LightMatrix0", LightMatrix0);
// Setup Spot Rendering mesh matrix
float sideLength = range / chsa;
// builtin pyramid model range is -.1 to .1 so scale by 10
lightToWorld = lightToWorld * Matrix4x4.Scale (new Vector3(sideLength*10, sideLength*10, range*10));
//set default cookie for spot light if there wasnt one added to the light manually
if (cookie == null)
cmd.SetGlobalTexture ("_LightTexture0", m_DefaultSpotCookie);
if (renderAsQuad) {
cmd.DrawMesh (m_QuadMesh, Matrix4x4.identity, m_DeferredMaterial, 0, m_quadLightingPassNdx, props);
} else {
cmd.DrawMesh (m_SpotLightMesh, lightToWorld, m_DeferredMaterial, 0, m_FiniteLightingPassNdx, props);
}
} else {
// Setup Light Matrix
float scale = 1.0f;// / light.light.cookieSize;
Matrix4x4 temp1 = Matrix4x4.Scale(new Vector3 (scale, scale, 0.0f));
Matrix4x4 temp2 = Matrix4x4.Translate( new Vector3 (.5f, .5f, 0.0f));
var LightMatrix0 = temp2 * temp1 * worldToLight;
props.SetMatrix ("_LightMatrix0", LightMatrix0);
if (cookie != null)
cmd.EnableShaderKeyword ("DIRECTIONAL_COOKIE");
cmd.DrawMesh (m_QuadMesh, Matrix4x4.identity, m_DeferredMaterial, 0, m_quadLightingPassNdx, props);
}
}
Matrix4x4 PerspectiveCotanMatrix(float cotangent, float zNear, float zFar )
{
float deltaZ = zNear - zFar;
var m = Matrix4x4.zero;
m.m00 = cotangent; m.m01 = 0.0f; m.m02 = 0.0f; m.m03 = 0.0f;
m.m10 = 0.0f; m.m11 = cotangent; m.m12 = 0.0f; m.m13 = 0.0f;
m.m20 = 0.0f; m.m21 = 0.0f; m.m22 = (zFar + zNear) / deltaZ; m.m23 = 2.0f * zNear * zFar / deltaZ;
m.m30 = 0.0f; m.m31 = 0.0f; m.m32 = -1.0f; m.m33 = 0.0f;
return m;
}
float GetCotanHalfSpotAngle (float spotAngle)
{
const float pi = 3.1415926535897932384626433832795f;
const float degToRad = (float)(pi / 180.0);
var cs = Mathf.Cos(0.5f * spotAngle * degToRad);
var ss = Mathf.Sin(0.5f * spotAngle * degToRad);
return cs / ss; //cothalfspotangle
//m_InvCosHalfSpotAngle = 1.0f / cs;
}
static void DepthOnlyForForwardOpaques(CullResults cull, Camera camera, ScriptableRenderContext loop)
{
var cmd = new CommandBuffer { name = "Forward Opaques - Depth Only" };
cmd.SetRenderTarget(new RenderTargetIdentifier(s_GBufferZ));
loop.ExecuteCommandBuffer(cmd);
cmd.Dispose();
// render opaque objects using Deferred pass
var settings = new DrawRendererSettings(cull, camera, new ShaderPassName("DepthOnly"))
{
sorting = { flags = SortFlags.CommonOpaque }
};
settings.inputFilter.SetQueuesOpaque();
loop.DrawRenderers(ref settings);
}
static void CopyDepthAfterGBuffer(ScriptableRenderContext loop)
{
var cmd = new CommandBuffer { name = "Copy depth" };
cmd.CopyTexture(new RenderTargetIdentifier(s_GBufferZ), new RenderTargetIdentifier(s_CameraDepthTexture));
loop.ExecuteCommandBuffer(cmd);
cmd.Dispose();
}
void FinalPass(ScriptableRenderContext loop)
{
var cmd = new CommandBuffer { name = "FinalPass" };
cmd.Blit(s_GBufferEmission, BuiltinRenderTextureType.CameraTarget, m_BlitMaterial, 0);
loop.ExecuteCommandBuffer(cmd);
cmd.Dispose();
}
}

12
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/ClassicDeferredPipeline.cs.meta


fileFormatVersion: 2
guid: d22b2b0343c2d4b1586e009e1bb0a736
timeCreated: 1490055658
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

720
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/HLSLSupport.cginc


#ifndef HLSL_SUPPORT_INCLUDED
#define HLSL_SUPPORT_INCLUDED
// Define the underlying compiler being used. Skips this step if the compiler is already specified,
// which may happen during development of new shader compiler for certain platform
#if !defined(UNITY_COMPILER_CG) && !defined(UNITY_COMPILER_HLSL) && !defined(UNITY_COMPILER_HLSL2GLSL) && !defined(UNITY_COMPILER_HLSLCC)
#if defined(SHADER_TARGET_SURFACE_ANALYSIS)
// Cg is used for surface shader analysis step
#define UNITY_COMPILER_CG
#elif defined(SHADER_API_GLCORE) || defined(SHADER_API_GLES3) || defined(SHADER_API_VULKAN)
// N.B. For Metal, the correct flags are set during internal shader compiler setup
#define UNITY_COMPILER_HLSL
#define UNITY_COMPILER_HLSLCC
#elif defined(SHADER_API_D3D11) || defined(SHADER_API_D3D11_9X) || defined(SHADER_API_D3D9) || defined(SHADER_API_XBOXONE)
#define UNITY_COMPILER_HLSL
#elif defined(SHADER_TARGET_GLSL) || defined(SHADER_API_WIIU)
#define UNITY_COMPILER_HLSL2GLSL
#else
#define UNITY_COMPILER_CG
#endif
#endif
#if defined(STEREO_MULTIVIEW_ON) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))
#define UNITY_SUPPORT_MULTIVIEW
#endif
#if defined(UNITY_FRAMEBUFFER_FETCH_AVAILABLE) && defined(UNITY_FRAMEBUFFER_FETCH_ENABLED) && defined(UNITY_COMPILER_HLSLCC)
// In the fragment shader, setting inout <type> var : SV_Target would result to
// compiler error, unless SV_Target is defined to COLOR semantic for compatibility
// reasons. Unfortunately, we still need to have a clear distinction between
// vertex shader COLOR output and SV_Target, so the following workaround abuses
// the fact that semantic names are case insensitive and preprocessor macros
// are not. The resulting HLSL bytecode has semantics in case preserving form,
// helps code generator to do extra work required for framebuffer fetch
// You should always declare color inouts against SV_Target
#define SV_Target CoLoR
#define SV_Target0 CoLoR0
#define SV_Target1 CoLoR1
#define SV_Target2 CoLoR2
#define SV_Target3 CoLoR3
#define SV_Target4 CoLoR4
#define SV_Target5 CoLoR5
#define SV_Target6 CoLoR6
#define SV_Target7 CoLoR7
#define COLOR VCOLOR
#define COLOR0 VCOLOR0
#define COLOR1 VCOLOR1
#define COLOR2 VCOLOR2
#define COLOR3 VCOLOR3
#define COLOR4 VCOLOR4
#define COLOR5 VCOLOR5
#define COLOR6 VCOLOR6
#define COLOR7 VCOLOR7
#endif
// SV_Target[n] / SV_Depth defines, if not defined by compiler already
#if !defined(SV_Target)
# if !defined(SHADER_API_XBOXONE)
# define SV_Target COLOR
# endif
#endif
#if !defined(SV_Target0)
# if !defined(SHADER_API_XBOXONE)
# define SV_Target0 COLOR0
# endif
#endif
#if !defined(SV_Target1)
# if !defined(SHADER_API_XBOXONE)
# define SV_Target1 COLOR1
# endif
#endif
#if !defined(SV_Target2)
# if !defined(SHADER_API_XBOXONE)
# define SV_Target2 COLOR2
# endif
#endif
#if !defined(SV_Target3)
# if !defined(SHADER_API_XBOXONE)
# define SV_Target3 COLOR3
# endif
#endif
#if !defined(SV_Target4)
# if defined(SHADER_API_PSSL)
# define SV_Target4 S_TARGET_OUTPUT4
# endif
#endif
#if !defined(SV_Target5)
# if defined(SHADER_API_PSSL)
# define SV_Target5 S_TARGET_OUTPUT5
# endif
#endif
#if !defined(SV_Target6)
# if defined(SHADER_API_PSSL)
# define SV_Target6 S_TARGET_OUTPUT6
# endif
#endif
#if !defined(SV_Target7)
# if defined(SHADER_API_PSSL)
# define SV_Target7 S_TARGET_OUTPUT7
# endif
#endif
#if !defined(SV_Depth)
# if !defined(SHADER_API_XBOXONE)
# define SV_Depth DEPTH
# endif
#endif
#if (defined(SHADER_API_GLES3) && !defined(SHADER_API_DESKTOP)) || defined(SHADER_API_D3D9) || defined(SHADER_API_GLES) || defined(SHADER_API_D3D11_9X) || defined(SHADER_API_PSP2) || defined(SHADER_API_N3DS)
#define UNITY_ALLOWED_MRT_COUNT 4
#else
#define UNITY_ALLOWED_MRT_COUNT 8
#endif
#if (SHADER_TARGET < 30) || defined(SHADER_API_GLES3) || defined(SHADER_API_D3D9) || defined(SHADER_API_GLES) || defined(SHADER_API_D3D11_9X) || defined(SHADER_API_PSP2) || defined(SHADER_API_N3DS)
//no fast coherent dynamic branching on these hardware
#else
#define UNITY_FAST_COHERENT_DYNAMIC_BRANCHING 1
#endif
// Disable warnings we aren't interested in
#if defined(UNITY_COMPILER_HLSL)
#pragma warning (disable : 3205) // conversion of larger type to smaller
#pragma warning (disable : 3568) // unknown pragma ignored
#pragma warning (disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
#pragma warning (disable : 3206) // implicit truncation of vector type
#endif
// Define "fixed" precision to be half on non-GLSL platforms,
// and sampler*_prec to be just simple samplers.
#if !defined(SHADER_TARGET_GLSL) && !defined(SHADER_API_PSSL) && !defined(SHADER_API_GLES3) && !defined(SHADER_API_VULKAN) && !(defined(SHADER_API_METAL) && defined(UNITY_COMPILER_HLSLCC))
#define fixed half
#define fixed2 half2
#define fixed3 half3
#define fixed4 half4
#define fixed4x4 half4x4
#define fixed3x3 half3x3
#define fixed2x2 half2x2
#define sampler2D_half sampler2D
#define sampler2D_float sampler2D
#define samplerCUBE_half samplerCUBE
#define samplerCUBE_float samplerCUBE
#define sampler3D_float sampler3D
#define sampler3D_half sampler3D
#define Texture2D_half Texture2D
#define Texture2D_float Texture2D
#define TextureCUBE_half TextureCUBE
#define TextureCUBE_float TextureCUBE
#define Texture3D_float Texture3D
#define Texture3D_half Texture3D
#endif
#if defined(SHADER_API_GLES3) || defined(SHADER_API_VULKAN) || (defined(SHADER_API_METAL) && defined(UNITY_COMPILER_HLSLCC))
// GLES3 and later via HLSLcc, use DX11.1 partial precision for translation
// we specifically define fixed to be float16 (same as half) as all new GPUs seems to agree on float16 being minimal precision float
#define fixed min16float
#define fixed2 min16float2
#define fixed3 min16float3
#define fixed4 min16float4
#define fixed4x4 min16float4x4
#define fixed3x3 min16float3x3
#define fixed2x2 min16float2x2
#define half min16float
#define half2 min16float2
#define half3 min16float3
#define half4 min16float4
#define half2x2 min16float2x2
#define half3x3 min16float3x3
#define half4x4 min16float4x4
#endif // defined(SHADER_API_GLES3) || defined(SHADER_API_VULKAN)
// Define min16float/min10float to be half/fixed on non-D3D11 platforms.
// This allows people to use min16float and friends in their shader code if they
// really want to (making that will make shaders not load before DX11.1, e.g. on Win7,
// but if they target WSA/WP exclusively that's fine).
#if !defined(SHADER_API_D3D11) && !defined(SHADER_API_D3D11_9X) && !defined(SHADER_API_GLES3) && !defined(SHADER_API_VULKAN) && !(defined(SHADER_API_METAL) && defined(UNITY_COMPILER_HLSLCC))
#define min16float half
#define min16float2 half2
#define min16float3 half3
#define min16float4 half4
#define min10float fixed
#define min10float2 fixed2
#define min10float3 fixed3
#define min10float4 fixed4
#endif
#if defined(SHADER_API_PSP2)
// The PSP2 cg compiler does not define uint<N>
#define uint2 unsigned int2
#define uint3 unsigned int3
#define uint4 unsigned int4
#endif
// specifically for samplers that are provided as arguments to entry functions
#if defined(SHADER_API_PSSL)
#define SAMPLER_UNIFORM uniform
#define SHADER_UNIFORM
#else
#define SAMPLER_UNIFORM
#endif
#if defined(SHADER_API_PSSL)
#define CBUFFER_START(name) ConstantBuffer name {
#define CBUFFER_END };
#elif defined(SHADER_API_D3D11) || defined(SHADER_API_D3D11_9X)
#define CBUFFER_START(name) cbuffer name {
#define CBUFFER_END };
#elif defined(UNITY_SUPPORT_MULTIVIEW) || (defined(UNITY_SINGLE_PASS_STEREO) && defined(SHADER_API_GLCORE))
#define CBUFFER_START(name) cbuffer name {
#define CBUFFER_END };
#else
// On specific platforms, like OpenGL and GLES3, constant buffers may still be used for instancing
#define CBUFFER_START(name)
#define CBUFFER_END
#endif
#if defined(UNITY_SUPPORT_MULTIVIEW)
// OVR_multiview
// In order to convey this info over the DX compiler, we wrap it into a cbuffer.
#define UNITY_DECLARE_MULTIVIEW(number_of_views) CBUFFER_START(OVR_multiview) uint gl_ViewID; uint numViews_##number_of_views; CBUFFER_END
#define UNITY_VIEWID gl_ViewID
#endif
// Special declaration macro for requiring the extended blend functionality
#if defined(SHADER_API_GLES3)
// Declare the need for the KHR_blend_equation_advanced extension plus the specific blend mode (see the extension spec for list or "all_equations" for all)
#define UNITY_REQUIRE_ADVANCED_BLEND(mode) uint hlslcc_blend_support_##mode
#else
#define UNITY_REQUIRE_ADVANCED_BLEND(mode)
#endif
#if defined(SHADER_API_PSP2)
// For tex2Dproj the PSP2 cg compiler doesn't like casting half3/4 to
// float3/4 with swizzle (optimizer generates invalid assembly), so declare
// explicit versions for half3/4
half4 tex2Dproj(sampler2D s, in half3 t) { return tex2D(s, t.xy / t.z); }
half4 tex2Dproj(sampler2D s, in half4 t) { return tex2D(s, t.xy / t.w); }
// As above but for sampling from single component textures, e.g. depth textures.
// NOTE that hardware PCF does not work with these versions, currently we have to ensure
// that tex coords for shadow sampling use float, not half; and for some reason casting half
// to float and using tex2Dproj also does not work.
half4 tex2DprojShadow(sampler2D s, in half3 t) { return tex2D<float>(s, t.xy / t.z); }
half4 tex2DprojShadow(sampler2D s, in half4 t) { return tex2D<float>(s, t.xy / t.w); }
// ...and versions of tex2DprojShadow for float uv.
half4 tex2DprojShadow(sampler2D s, in float3 t) { return tex2Dproj<float>(s, t); }
half4 tex2DprojShadow(sampler2D s, in float4 t) { return tex2Dproj<float>(s, t); }
#endif
#if defined(SHADER_API_PSP2)
#define UNITY_BUGGY_TEX2DPROJ4
#define UNITY_PROJ_COORD(a) (a).xyw
#else
#define UNITY_PROJ_COORD(a) a
#endif
// Depth texture sampling helpers.
// On most platforms you can just sample them, but some (e.g. PSP2) need special handling.
//
// SAMPLE_DEPTH_TEXTURE(sampler,uv): returns scalar depth
// SAMPLE_DEPTH_TEXTURE_PROJ(sampler,uv): projected sample
// SAMPLE_DEPTH_TEXTURE_LOD(sampler,uv): sample with LOD level
#if defined(SHADER_API_PSP2) && !defined(SHADER_API_PSM)
# define SAMPLE_DEPTH_TEXTURE(sampler, uv) (tex2D<float>(sampler, uv))
# define SAMPLE_DEPTH_TEXTURE_PROJ(sampler, uv) (tex2DprojShadow(sampler, uv))
# define SAMPLE_DEPTH_TEXTURE_LOD(sampler, uv) (tex2Dlod<float>(sampler, uv))
# define SAMPLE_RAW_DEPTH_TEXTURE(sampler, uv) SAMPLE_DEPTH_TEXTURE(sampler, uv)
# define SAMPLE_RAW_DEPTH_TEXTURE_PROJ(sampler, uv) SAMPLE_DEPTH_TEXTURE_PROJ(sampler, uv)
# define SAMPLE_RAW_DEPTH_TEXTURE_LOD(sampler, uv) SAMPLE_DEPTH_TEXTURE_LOD(sampler, uv)
#else
// Sample depth, just the red component.
# define SAMPLE_DEPTH_TEXTURE(sampler, uv) (tex2D(sampler, uv).r)
# define SAMPLE_DEPTH_TEXTURE_PROJ(sampler, uv) (tex2Dproj(sampler, uv).r)
# define SAMPLE_DEPTH_TEXTURE_LOD(sampler, uv) (tex2Dlod(sampler, uv).r)
// Sample depth, all components.
# define SAMPLE_RAW_DEPTH_TEXTURE(sampler, uv) (tex2D(sampler, uv))
# define SAMPLE_RAW_DEPTH_TEXTURE_PROJ(sampler, uv) (tex2Dproj(sampler, uv))
# define SAMPLE_RAW_DEPTH_TEXTURE_LOD(sampler, uv) (tex2Dlod(sampler, uv))
#endif
// Deprecated; use SAMPLE_DEPTH_TEXTURE & SAMPLE_DEPTH_TEXTURE_PROJ instead
#if defined(SHADER_API_PSP2)
# define UNITY_SAMPLE_DEPTH(value) (value).r
#else
# define UNITY_SAMPLE_DEPTH(value) (value).r
#endif
// Macros to declare and sample shadow maps.
//
// UNITY_DECLARE_SHADOWMAP declares a shadowmap.
// UNITY_SAMPLE_SHADOW samples with a float3 coordinate (UV in xy, Z in z) and returns 0..1 scalar result.
// UNITY_SAMPLE_SHADOW_PROJ samples with a projected coordinate (UV and Z divided by w).
#if !defined(SHADER_API_GLES)
// all platforms except GLES2.0 have built-in shadow comparison samplers
#define SHADOWS_NATIVE
#elif defined(SHADER_API_GLES) && defined(UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS)
// GLES2.0 also has built-in shadow comparison samplers, but only on platforms where we pass UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS from the editor
#define SHADOWS_NATIVE
#endif
#if defined(SHADER_API_D3D11) || defined(SHADER_API_D3D11_9X) || defined(UNITY_COMPILER_HLSLCC)
// DX11 & hlslcc platforms: built-in PCF
#if defined(SHADER_API_D3D11_9X)
// FL9.x has some bug where the runtime really wants resource & sampler to be bound to the same slot,
// otherwise it is skipping draw calls that use shadowmap sampling. Let's bind to #15
// and hope all works out.
#define UNITY_DECLARE_SHADOWMAP(tex) Texture2D tex : register(t15); SamplerComparisonState sampler##tex : register(s15)
#else
#define UNITY_DECLARE_SHADOWMAP(tex) Texture2D tex; SamplerComparisonState sampler##tex
#endif
#define UNITY_SAMPLE_SHADOW(tex,coord) tex.SampleCmpLevelZero (sampler##tex,(coord).xy,(coord).z)
#define UNITY_SAMPLE_SHADOW_PROJ(tex,coord) tex.SampleCmpLevelZero (sampler##tex,(coord).xy/(coord).w,(coord).z/(coord).w)
#elif defined(UNITY_COMPILER_HLSL2GLSL) && defined(SHADOWS_NATIVE)
// OpenGL-like hlsl2glsl platforms: most of them always have built-in PCF
#define UNITY_DECLARE_SHADOWMAP(tex) sampler2DShadow tex
#define UNITY_SAMPLE_SHADOW(tex,coord) shadow2D (tex,(coord).xyz)
#define UNITY_SAMPLE_SHADOW_PROJ(tex,coord) shadow2Dproj (tex,coord)
#elif defined(SHADER_API_D3D9)
// D3D9: Native shadow maps FOURCC "driver hack", looks just like a regular
// texture sample. Have to always do a projected sample
// so that HLSL compiler doesn't try to be too smart and mess up swizzles
// (thinking that Z is unused).
#define UNITY_DECLARE_SHADOWMAP(tex) sampler2D tex
#define UNITY_SAMPLE_SHADOW(tex,coord) tex2Dproj (tex,float4((coord).xyz,1)).r
#define UNITY_SAMPLE_SHADOW_PROJ(tex,coord) tex2Dproj (tex,coord).r
#elif defined(SHADER_API_PSSL)
// PS4: built-in PCF
#define UNITY_DECLARE_SHADOWMAP(tex) Texture2D tex; SamplerComparisonState sampler##tex
#define UNITY_SAMPLE_SHADOW(tex,coord) tex.SampleCmpLOD0(sampler##tex,(coord).xy,(coord).z)
#define UNITY_SAMPLE_SHADOW_PROJ(tex,coord) tex.SampleCmpLOD0(sampler##tex,(coord).xy/(coord).w,(coord).z/(coord).w)
#elif defined(SHADER_API_PSP2)
// Vita
#define UNITY_DECLARE_SHADOWMAP(tex) sampler2D tex
// tex2d shadow comparison on Vita returns 0 instead of 1 when shadowCoord.z >= 1 causing artefacts in some tests.
// Clamping Z to the range 0.0 <= Z < 1.0 solves this.
#define UNITY_SAMPLE_SHADOW(tex,coord) tex2D<float>(tex, float3((coord).xy, clamp((coord).z, 0.0, 0.999999)))
#define UNITY_SAMPLE_SHADOW_PROJ(tex,coord) tex2DprojShadow(tex, coord)
#else
// Fallback / No built-in shadowmap comparison sampling: regular texture sample and do manual depth comparison
#define UNITY_DECLARE_SHADOWMAP(tex) sampler2D_float tex
#define UNITY_SAMPLE_SHADOW(tex,coord) ((SAMPLE_DEPTH_TEXTURE(tex,(coord).xy) < (coord).z) ? 0.0 : 1.0)
#define UNITY_SAMPLE_SHADOW_PROJ(tex,coord) ((SAMPLE_DEPTH_TEXTURE_PROJ(tex,UNITY_PROJ_COORD(coord)) < ((coord).z/(coord).w)) ? 0.0 : 1.0)
#endif
// Macros to declare textures and samplers, possibly separately. For platforms
// that have separate samplers & textures (like DX11), and we'd want to conserve
// the samplers.
// - UNITY_DECLARE_TEX*_NOSAMPLER declares a texture, without a sampler.
// - UNITY_SAMPLE_TEX*_SAMPLER samples a texture, using sampler from another texture.
// That another texture must also be actually used in the current shader, otherwise
// the correct sampler will not be set.
#if defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL)
// DX11 style HLSL syntax; separate textures and samplers
// NB for HLSLcc we have special unity-specific syntax to pass sampler precision information
// 2D textures
#define UNITY_DECLARE_TEX2D(tex) Texture2D tex; SamplerState sampler##tex
#define UNITY_DECLARE_TEX2D_NOSAMPLER(tex) Texture2D tex
#define UNITY_SAMPLE_TEX2D(tex,coord) tex.Sample (sampler##tex,coord)
#define UNITY_SAMPLE_TEX2D_SAMPLER(tex,samplertex,coord) tex.Sample (sampler##samplertex,coord)
#if defined(UNITY_COMPILER_HLSLCC) && !defined(SHADER_API_GLCORE) // GL Core doesn't have the _half mangling, the rest of them do.
#define UNITY_DECLARE_TEX2D_HALF(tex) Texture2D_half tex; SamplerState sampler##tex
#define UNITY_DECLARE_TEX2D_FLOAT(tex) Texture2D_float tex; SamplerState sampler##tex
#define UNITY_DECLARE_TEX2D_NOSAMPLER_HALF(tex) Texture2D_half tex
#define UNITY_DECLARE_TEX2D_NOSAMPLER_FLOAT(tex) Texture2D_float tex
#else
#define UNITY_DECLARE_TEX2D_HALF(tex) Texture2D tex; SamplerState sampler##tex
#define UNITY_DECLARE_TEX2D_FLOAT(tex) Texture2D tex; SamplerState sampler##tex
#define UNITY_DECLARE_TEX2D_NOSAMPLER_HALF(tex) Texture2D tex
#define UNITY_DECLARE_TEX2D_NOSAMPLER_FLOAT(tex) Texture2D tex
#endif
// Cubemaps
#define UNITY_DECLARE_TEXCUBE(tex) TextureCube tex; SamplerState sampler##tex
#define UNITY_ARGS_TEXCUBE(tex) TextureCube tex, SamplerState sampler##tex
#define UNITY_PASS_TEXCUBE(tex) tex, sampler##tex
#define UNITY_PASS_TEXCUBE_SAMPLER(tex,samplertex) tex, sampler##samplertex
#define UNITY_PASS_TEXCUBE_SAMPLER_LOD(tex, samplertex, lod) tex, sampler##samplertex, lod
#define UNITY_DECLARE_TEXCUBE_NOSAMPLER(tex) TextureCube tex
#define UNITY_SAMPLE_TEXCUBE(tex,coord) tex.Sample (sampler##tex,coord)
#define UNITY_SAMPLE_TEXCUBE_LOD(tex,coord,lod) tex.SampleLevel (sampler##tex,coord, lod)
#define UNITY_SAMPLE_TEXCUBE_SAMPLER(tex,samplertex,coord) tex.Sample (sampler##samplertex,coord)
#define UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(tex, samplertex, coord, lod) tex.SampleLevel (sampler##samplertex, coord, lod)
// 3D textures
#define UNITY_DECLARE_TEX3D(tex) Texture3D tex; SamplerState sampler##tex
#define UNITY_DECLARE_TEX3D_NOSAMPLER(tex) Texture3D tex
#define UNITY_SAMPLE_TEX3D(tex,coord) tex.Sample (sampler##tex,coord)
#define UNITY_SAMPLE_TEX3D_LOD(tex,coord,lod) tex.SampleLevel (sampler##tex,coord, lod)
#define UNITY_SAMPLE_TEX3D_SAMPLER(tex,samplertex,coord) tex.Sample (sampler##samplertex,coord)
#define UNITY_SAMPLE_TEX3D_SAMPLER_LOD(tex, samplertex, coord, lod) tex.SampleLevel(sampler##samplertex, coord, lod)
#if defined(UNITY_COMPILER_HLSLCC) && !defined(SHADER_API_GLCORE) // GL Core doesn't have the _half mangling, the rest of them do.
#define UNITY_DECLARE_TEX3D_FLOAT(tex) Texture3D_float tex; SamplerState sampler##tex
#define UNITY_DECLARE_TEX3D_HALF(tex) Texture3D_half tex; SamplerState sampler##tex
#else
#define UNITY_DECLARE_TEX3D_FLOAT(tex) Texture3D tex; SamplerState sampler##tex
#define UNITY_DECLARE_TEX3D_HALF(tex) Texture3D tex; SamplerState sampler##tex
#endif
// 2D arrays
#define UNITY_DECLARE_TEX2DARRAY(tex) Texture2DArray tex; SamplerState sampler##tex
#define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) Texture2DArray tex
#define UNITY_ARGS_TEX2DARRAY(tex) Texture2DArray tex, SamplerState sampler##tex
#define UNITY_PASS_TEX2DARRAY(tex) tex, sampler##tex
#define UNITY_SAMPLE_TEX2DARRAY(tex,coord) tex.Sample (sampler##tex,coord)
#define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) tex.SampleLevel (sampler##tex,coord, lod)
#define UNITY_SAMPLE_TEX2DARRAY_SAMPLER(tex,samplertex,coord) tex.Sample (sampler##samplertex,coord)
#define UNITY_SAMPLE_TEX2DARRAY_SAMPLER_LOD(tex,samplertex,coord,lod) tex.SampleLevel (sampler##samplertex,coord,lod)
// Cube arrays
#define UNITY_DECLARE_TEXCUBEARRAY(tex) TextureCubeArray tex; SamplerState sampler##tex
#define UNITY_DECLARE_TEXCUBEARRAY_NOSAMPLER(tex) TextureCubeArray tex
#define UNITY_ARGS_TEXCUBEARRAY(tex) TextureCubeArray tex, SamplerState sampler##tex
#define UNITY_PASS_TEXCUBEARRAY(tex) tex, sampler##tex
#if defined(SHADER_API_PSSL)
// round the layer index to get DX11-like behaviour (otherwise fractional indices result in mixed up cubemap faces)
#define UNITY_SAMPLE_TEXCUBEARRAY(tex,coord) tex.Sample (sampler##tex,float4((coord).xyz, round((coord).w)))
#define UNITY_SAMPLE_TEXCUBEARRAY_LOD(tex,coord,lod) tex.SampleLevel (sampler##tex,float4((coord).xyz, round((coord).w)), lod)
#define UNITY_SAMPLE_TEXCUBEARRAY_SAMPLER(tex,samplertex,coord) tex.Sample (sampler##samplertex,float4((coord).xyz, round((coord).w)))
#define UNITY_SAMPLE_TEXCUBEARRAY_SAMPLER_LOD(tex,samplertex,coord,lod) tex.SampleLevel (sampler##samplertex,float4((coord).xyz, round((coord).w)), lod)
#else
#define UNITY_SAMPLE_TEXCUBEARRAY(tex,coord) tex.Sample (sampler##tex,coord)
#define UNITY_SAMPLE_TEXCUBEARRAY_LOD(tex,coord,lod) tex.SampleLevel (sampler##tex,coord, lod)
#define UNITY_SAMPLE_TEXCUBEARRAY_SAMPLER(tex,samplertex,coord) tex.Sample (sampler##samplertex,coord)
#define UNITY_SAMPLE_TEXCUBEARRAY_SAMPLER_LOD(tex,samplertex,coord,lod) tex.SampleLevel (sampler##samplertex,coord,lod)
#endif
#else
// DX9 style HLSL syntax; same object for texture+sampler
// 2D textures
#define UNITY_DECLARE_TEX2D(tex) sampler2D tex
#define UNITY_DECLARE_TEX2D_HALF(tex) sampler2D_half tex
#define UNITY_DECLARE_TEX2D_FLOAT(tex) sampler2D_float tex
#define UNITY_DECLARE_TEX2D_NOSAMPLER(tex) sampler2D tex
#define UNITY_DECLARE_TEX2D_NOSAMPLER_HALF(tex) sampler2D_half tex
#define UNITY_DECLARE_TEX2D_NOSAMPLER_FLOAT(tex) sampler2D_float tex
#define UNITY_SAMPLE_TEX2D(tex,coord) tex2D (tex,coord)
#define UNITY_SAMPLE_TEX2D_SAMPLER(tex,samplertex,coord) tex2D (tex,coord)
// Cubemaps
#define UNITY_DECLARE_TEXCUBE(tex) samplerCUBE tex
#define UNITY_ARGS_TEXCUBE(tex) samplerCUBE tex
#define UNITY_PASS_TEXCUBE(tex) tex
#define UNITY_PASS_TEXCUBE_SAMPLER(tex,samplertex) tex
#define UNITY_DECLARE_TEXCUBE_NOSAMPLER(tex) samplerCUBE tex
#define UNITY_SAMPLE_TEXCUBE(tex,coord) texCUBE (tex,coord)
// DX9 with SM2.0, and DX11 FL 9.x do not have texture LOD sampling.
// We will approximate that with mip bias (very poor approximation, but not much we can do)
#if ((SHADER_TARGET < 25) && defined(SHADER_API_D3D9)) || defined(SHADER_API_D3D11_9X)
# define UNITY_SAMPLE_TEXCUBE_LOD(tex,coord,lod) texCUBEbias(tex, half4(coord, lod))
# define UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(tex,samplertex,coord,lod) UNITY_SAMPLE_TEXCUBE_LOD(tex,coord,lod)
#else
# define UNITY_SAMPLE_TEXCUBE_LOD(tex,coord,lod) texCUBElod (tex, half4(coord, lod))
# define UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(tex,samplertex,coord,lod) UNITY_SAMPLE_TEXCUBE_LOD(tex,coord,lod)
#endif
#define UNITY_SAMPLE_TEXCUBE_SAMPLER(tex,samplertex,coord) texCUBE (tex,coord)
// 3D textures
#define UNITY_DECLARE_TEX3D(tex) sampler3D tex
#define UNITY_DECLARE_TEX3D_NOSAMPLER(tex) sampler3D tex
#define UNITY_DECLARE_TEX3D_FLOAT(tex) sampler3D_float tex
#define UNITY_DECLARE_TEX3D_HALF(tex) sampler3D_float tex
#define UNITY_SAMPLE_TEX3D(tex,coord) tex3D (tex,coord)
#define UNITY_SAMPLE_TEX3D_LOD(tex,coord,lod) tex3D (tex,float4(coord,lod))
#define UNITY_SAMPLE_TEX3D_SAMPLER(tex,samplertex,coord) tex3D (tex,coord)
#define UNITY_SAMPLE_TEX3D_SAMPLER_LOD(tex,samplertex,coord,lod) tex3D (tex,float4(coord,lod))
// 2D array syntax for hlsl2glsl and surface shader analysis
#if defined(UNITY_COMPILER_HLSL2GLSL) || defined(SHADER_TARGET_SURFACE_ANALYSIS)
#define UNITY_DECLARE_TEX2DARRAY(tex) sampler2DArray tex
#define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) sampler2DArray tex
#define UNITY_ARGS_TEX2DARRAY(tex) sampler2DArray tex
#define UNITY_PASS_TEX2DARRAY(tex) tex
#define UNITY_SAMPLE_TEX2DARRAY(tex,coord) tex2DArray (tex,coord)
#define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) tex2DArraylod (tex, float4(coord,lod))
#define UNITY_SAMPLE_TEX2DARRAY_SAMPLER(tex,samplertex,coord) tex2DArray (tex,coord)
#define UNITY_SAMPLE_TEX2DARRAY_SAMPLER_LOD(tex,samplertex,coord,lod) tex2DArraylod (tex, float4(coord,lod))
#endif
// surface shader analysis; just pretend that 2D arrays are cubemaps
#if defined(SHADER_TARGET_SURFACE_ANALYSIS)
#define sampler2DArray samplerCUBE
#define tex2DArray texCUBE
#define tex2DArraylod texCUBElod
#endif
#endif
// For backwards compatibility, so we won't accidentally break shaders written by user
#define SampleCubeReflection(env, dir, lod) UNITY_SAMPLE_TEXCUBE_LOD(env, dir, lod)
#define samplerRECT sampler2D
#define texRECT tex2D
#define texRECTlod tex2Dlod
#define texRECTbias tex2Dbias
#define texRECTproj tex2Dproj
#if defined(SHADER_API_PSSL)
#define VPOS S_POSITION
#elif defined(UNITY_COMPILER_CG)
// Cg seems to use WPOS instead of VPOS semantic?
#define VPOS WPOS
// Cg does not have tex2Dgrad and friends, but has tex2D overload that
// can take the derivatives
#define tex2Dgrad tex2D
#define texCUBEgrad texCUBE
#define tex3Dgrad tex3D
#endif
// Data type to be used for "screen space position" pixel shader input semantic;
// D3D9 needs it to be float2, unlike all other platforms.
#if defined(SHADER_API_D3D9)
#define UNITY_VPOS_TYPE float2
#else
#define UNITY_VPOS_TYPE float4
#endif
#if defined(UNITY_COMPILER_HLSL) || defined (SHADER_TARGET_GLSL)
#define FOGC FOG
#endif
// Use VFACE pixel shader input semantic in your shaders to get front-facing scalar value.
// Requires shader model 3.0 or higher.
#if defined(UNITY_COMPILER_CG)
#define VFACE FACE
#endif
#if defined(UNITY_COMPILER_HLSL2GLSL)
#define FACE VFACE
#endif
#if defined(SHADER_API_PSSL)
#define VFACE S_FRONT_FACE
#endif
// Is VFACE affected by flipped projection?
#if defined(SHADER_API_D3D9) || defined(SHADER_API_PSSL)
#define UNITY_VFACE_AFFECTED_BY_PROJECTION 1
#endif
#if !defined(SHADER_API_D3D11) && !defined(SHADER_API_D3D11_9X) && !defined(UNITY_COMPILER_HLSLCC) && !defined(SHADER_API_PSSL)
#define SV_POSITION POSITION
#endif
#if defined(SHADER_API_D3D9) || defined(SHADER_API_D3D11) || defined(SHADER_API_D3D11_9X) || defined(SHADER_API_PSP2) || defined(SHADER_API_PSSL)
#define UNITY_ATTEN_CHANNEL r
#else
#define UNITY_ATTEN_CHANNEL a
#endif
#if defined(SHADER_API_D3D9) || defined(SHADER_API_D3D11) || defined(SHADER_API_D3D11_9X) || defined(SHADER_API_PSP2) || defined(SHADER_API_PSSL) || defined(SHADER_API_METAL) || defined(SHADER_API_WIIU) || defined(SHADER_API_VULKAN)
#define UNITY_UV_STARTS_AT_TOP 1
#endif
#if defined(SHADER_API_D3D11) || defined(SHADER_API_PSSL) || defined(SHADER_API_XBOXONE) || defined(SHADER_API_METAL) || defined(SHADER_API_VULKAN)
#define UNITY_REVERSED_Z 1
#endif
#if defined(UNITY_REVERSED_Z)
#define UNITY_NEAR_CLIP_VALUE (1.0)
#elif defined(SHADER_API_D3D9) || defined(SHADER_API_WIIU) || defined(SHADER_API_D3D11_9X)
#define UNITY_NEAR_CLIP_VALUE (0.0)
#else
#define UNITY_NEAR_CLIP_VALUE (-1.0)
#endif
// "platform caps" defines that were moved to editor, so they are set automatically when compiling shader
// UNITY_NO_DXT5nm - no DXT5NM support, so normal maps will encoded in rgb
// UNITY_NO_RGBM - no RGBM support, so doubleLDR
// UNITY_NO_SCREENSPACE_SHADOWS - no screenspace cascaded shadowmaps
// UNITY_FRAMEBUFFER_FETCH_AVAILABLE - framebuffer fetch
// UNITY_ENABLE_REFLECTION_BUFFERS - render reflection probes in deferred way, when using deferred shading
#if defined(SHADER_API_PSP2)
// To get acceptable precision from the SGX interpolators when decoding RGBM type
// textures we have to disable sRGB reads and then convert to gamma space in the shader
// explicitly.
#define UNITY_FORCE_LINEAR_READ_FOR_RGBM
#endif
// On most platforms, use floating point render targets to store depth of point
// light shadowmaps. However, on some others they either have issues, or aren't widely
// supported; in which case fallback to encoding depth into RGBA channels.
// Make sure this define matches GraphicsCaps.useRGBAForPointShadows.
#if defined(SHADER_API_GLES) || defined(SHADER_API_GLES3) || defined(SHADER_API_PSP2)
#define UNITY_USE_RGBA_FOR_POINT_SHADOWS
#endif
// Initialize arbitrary structure with zero values.
// Not supported on some backends (e.g. Cg-based particularly with nested structs).
// hlsl2glsl would almost support it, except with structs that have arrays -- so treat as not supported there either :(
#if defined(UNITY_COMPILER_HLSL) || defined(SHADER_API_PSSL) || defined(UNITY_COMPILER_HLSLCC)
#define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0;
#else
#define UNITY_INITIALIZE_OUTPUT(type,name)
#endif
#if defined(SHADER_API_D3D11) || defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE) || defined(SHADER_API_VULKAN) || defined(SHADER_API_PSSL)
#define UNITY_CAN_COMPILE_TESSELLATION 1
# define UNITY_domain domain
# define UNITY_partitioning partitioning
# define UNITY_outputtopology outputtopology
# define UNITY_patchconstantfunc patchconstantfunc
# define UNITY_outputcontrolpoints outputcontrolpoints
#endif
// Not really needed anymore, but did ship in Unity 4.0; with D3D11_9X remapping them to .r channel.
// Now that's not used.
#define UNITY_SAMPLE_1CHANNEL(x,y) tex2D(x,y).a
#define UNITY_ALPHA_CHANNEL a
// HLSL attributes
#if defined(UNITY_COMPILER_HLSL)
#define UNITY_BRANCH [branch]
#define UNITY_FLATTEN [flatten]
#define UNITY_UNROLL [unroll]
#define UNITY_LOOP [loop]
#define UNITY_FASTOPT [fastopt]
#else
#define UNITY_BRANCH
#define UNITY_FLATTEN
#define UNITY_UNROLL
#define UNITY_LOOP
#define UNITY_FASTOPT
#endif
// Unity 4.x shaders used to mostly work if someone used WPOS semantic,
// which was accepted by Cg. The correct semantic to use is "VPOS",
// so define that so that old shaders keep on working.
#if !defined(UNITY_COMPILER_CG)
#define WPOS VPOS
#endif
// define use to identify platform with modern feature like texture 3D with filtering, texture array etc...
#define UNITY_SM40_PLUS_PLATFORM (!((SHADER_TARGET < 30) || defined (SHADER_API_MOBILE) || defined(SHADER_API_D3D9) || defined(SHADER_API_D3D11_9X) || defined (SHADER_API_PSP2) || defined(SHADER_API_GLES)))
// Ability to manually set descriptor set and binding numbers (Vulkan only)
#if defined(SHADER_API_VULKAN)
#define CBUFFER_START_WITH_BINDING(Name, Set, Binding) CBUFFER_START(Name##Xhlslcc_set_##Set##_bind_##Binding##X)
// Sampler / image declaration with set/binding decoration
#define DECL_WITH_BINDING(Type, Name, Set, Binding) Type Name##hlslcc_set_##Set##_bind_##Binding
#else
#define CBUFFER_START_WITH_BINDING(Name, Set, Binding) CBUFFER_START(Name)
#define DECL_WITH_BINDING(Type, Name, Set, Binding) Type Name
#endif
// ---- Shader keyword backwards compatibility
// We used to have some built-in shader keywords, but they got removed at some point to save on shader keyword count.
// However some existing shader code might be checking for the old names, so define them as regular
// macros based on other criteria -- so that existing code keeps on working.
// Unity 5.0 renamed HDR_LIGHT_PREPASS_ON to UNITY_HDR_ON
#if defined(UNITY_HDR_ON)
#define HDR_LIGHT_PREPASS_ON 1
#endif
// UNITY_NO_LINEAR_COLORSPACE was removed in 5.4 when UNITY_COLORSPACE_GAMMA was introduced as a platform keyword and runtime gamma fallback removed.
#if !defined(UNITY_NO_LINEAR_COLORSPACE) && defined(UNITY_COLORSPACE_GAMMA)
#define UNITY_NO_LINEAR_COLORSPACE 1
#endif
#if !defined(DIRLIGHTMAP_OFF) && !defined(DIRLIGHTMAP_COMBINED)
#define DIRLIGHTMAP_OFF 1
#endif
#if !defined(LIGHTMAP_OFF) && !defined(LIGHTMAP_ON)
#define LIGHTMAP_OFF 1
#endif
#if !defined(DYNAMICLIGHTMAP_OFF) && !defined(DYNAMICLIGHTMAP_ON)
#define DYNAMICLIGHTMAP_OFF 1
#endif
#if defined (SHADER_API_D3D11) && defined(STEREO_INSTANCING_ON)
#undef UNITY_DECLARE_DEPTH_TEXTURE
#define UNITY_DECLARE_DEPTH_TEXTURE(tex) Texture2DArray tex; SamplerState sampler##tex
#undef SAMPLE_DEPTH_TEXTURE
#define SAMPLE_DEPTH_TEXTURE(tex, uv) UNITY_SAMPLE_TEX2DARRAY(tex, float3(uv.x, uv.y, (float)unity_StereoEyeIndex)).r
#undef SAMPLE_DEPTH_TEXTURE_PROJ
#define SAMPLE_DEPTH_TEXTURE_PROJ(tex, uv) UNITY_SAMPLE_TEX2DARRAY(tex, float3(uv.x/uv.w, uv.y/uv.w, (float)unity_StereoEyeIndex)).r
#define UNITY_DECLARE_SCREENSPACE_SHADOWMAP UNITY_DECLARE_TEX2DARRAY
#define UNITY_SAMPLE_SCREEN_SHADOW(tex, uv) UNITY_SAMPLE_TEX2DARRAY( tex, float3(uv.x/uv.w, uv.y/uv.w, (float)unity_StereoEyeIndex) ).r
#else
#define UNITY_DECLARE_DEPTH_TEXTURE(tex) sampler2D_float tex
#define UNITY_DECLARE_SCREENSPACE_SHADOWMAP(tex) sampler2D tex
#define UNITY_SAMPLE_SCREEN_SHADOW(tex, uv) tex2Dproj( tex, UNITY_PROJ_COORD(uv) ).r
#endif
#endif // HLSL_SUPPORT_INCLUDED

9
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/HLSLSupport.cginc.meta


fileFormatVersion: 2
guid: 5cccb757ee7ed4a63aac84c8c8954a3f
timeCreated: 1490056564
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

142
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/Internal-DeferredReflections.shader


Shader "MobileRenderloop/ClassicDeferredReflections" {
Properties {
_SrcBlend ("", Float) = 1
_DstBlend ("", Float) = 1
}
SubShader {
// Calculates reflection contribution from a single probe (rendered as cubes) or default reflection (rendered as full screen quad)
Pass {
ZWrite Off
ZTest LEqual
Blend [_SrcBlend] [_DstBlend]
CGPROGRAM
#pragma target 3.0
#pragma vertex vert_deferred
#pragma fragment frag
#include "UnityCG.cginc"
#include "UnityDeferredLibrary.cginc"
#include "UnityStandardUtils.cginc"
#include "UnityGBuffer.cginc"
#include "UnityStandardBRDF.cginc"
#include "UnityPBSLighting.cginc"
sampler2D _CameraGBufferTexture0;
sampler2D _CameraGBufferTexture1;
sampler2D _CameraGBufferTexture2;
half3 distanceFromAABB(half3 p, half3 aabbMin, half3 aabbMax)
{
return max(max(p - aabbMax, aabbMin - p), half3(0.0, 0.0, 0.0));
}
half4 frag (unity_v2f_deferred i) : SV_Target
{
// Stripped from UnityDeferredCalculateLightParams, refactor into function ?
i.ray = i.ray * (_ProjectionParams.z / i.ray.z);
float2 uv = i.uv.xy / i.uv.w;
// read depth and reconstruct world position
float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv);
depth = Linear01Depth (depth);
float4 viewPos = float4(i.ray * depth,1);
float3 worldPos = mul (unity_CameraToWorld, viewPos).xyz;
half4 gbuffer0 = tex2D (_CameraGBufferTexture0, uv);
half4 gbuffer1 = tex2D (_CameraGBufferTexture1, uv);
half4 gbuffer2 = tex2D (_CameraGBufferTexture2, uv);
UnityStandardData data = UnityStandardDataFromGbuffer(gbuffer0, gbuffer1, gbuffer2);
float3 eyeVec = normalize(worldPos - _WorldSpaceCameraPos);
half oneMinusReflectivity = 1 - SpecularStrength(data.specularColor);
half3 worldNormalRefl = reflect(eyeVec, data.normalWorld);
// Unused member don't need to be initialized
UnityGIInput d;
d.worldPos = worldPos;
d.worldViewDir = -eyeVec;
d.probeHDR[0] = unity_SpecCube0_HDR;
float blendDistance = unity_SpecCube1_ProbePosition.w; // will be set to blend distance for this probe
#ifdef UNITY_SPECCUBE_BOX_PROJECTION
d.probePosition[0] = unity_SpecCube0_ProbePosition;
d.boxMin[0].xyz = unity_SpecCube0_BoxMin - float4(blendDistance,blendDistance,blendDistance,0);
d.boxMin[0].w = 1; // 1 in .w allow to disable blending in UnityGI_IndirectSpecular call
d.boxMax[0].xyz = unity_SpecCube0_BoxMax + float4(blendDistance,blendDistance,blendDistance,0);
#endif
Unity_GlossyEnvironmentData g = UnityGlossyEnvironmentSetup(data.smoothness, d.worldViewDir, data.normalWorld, data.specularColor);
half3 env0 = UnityGI_IndirectSpecular(d, data.occlusion, g);
UnityLight light;
light.color = half3(0, 0, 0);
light.dir = half3(0, 1, 0);
UnityIndirect ind;
ind.diffuse = 0;
ind.specular = env0;
half3 rgb = UNITY_BRDF_PBS (0, data.specularColor, oneMinusReflectivity, data.smoothness, data.normalWorld, -eyeVec, light, ind).rgb;
// Calculate falloff value, so reflections on the edges of the probe would gradually blend to previous reflection.
// Also this ensures that pixels not located in the reflection probe AABB won't
// accidentally pick up reflections from this probe.
half3 distance = distanceFromAABB(worldPos, unity_SpecCube0_BoxMin.xyz, unity_SpecCube0_BoxMax.xyz);
half falloff = saturate(1.0 - length(distance)/blendDistance);
return half4(rgb, falloff);
}
ENDCG
}
// Adds reflection buffer to the lighting buffer
Pass
{
ZWrite Off
ZTest Always
Blend [_SrcBlend] [_DstBlend]
CGPROGRAM
#pragma target 3.0
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile ___ UNITY_HDR_ON
#include "UnityCG.cginc"
sampler2D _CameraReflectionsTexture;
struct v2f {
float2 uv : TEXCOORD0;
float4 pos : SV_POSITION;
};
v2f vert (float4 vertex : POSITION)
{
v2f o;
o.pos = UnityObjectToClipPos(vertex);
o.uv = ComputeScreenPos (o.pos).xy;
return o;
}
half4 frag (v2f i) : SV_Target
{
half4 c = tex2D (_CameraReflectionsTexture, i.uv);
#ifdef UNITY_HDR_ON
return float4(c.rgb, 0.0f);
#else
return float4(exp2(-c.rgb), 0.0f);
#endif
}
ENDCG
}
}
Fallback Off
}

9
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/Internal-DeferredReflections.shader.meta


fileFormatVersion: 2
guid: eabc0a21ba0ff47268d9a58c92b8b40b
timeCreated: 1490056565
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

178
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/Internal-DeferredShading.shader


Shader "MobileRenderloop/ClassicDeferred" {
Properties {
_LightTexture0 ("", any) = "" {}
_LightTextureB0 ("", 2D) = "" {}
_ShadowMapTexture ("", any) = "" {}
}
SubShader {
// Pass 1: Finite Lighting pass -- cuz thats how i roll
// LDR case - Lighting encoded into a subtractive ARGB8 buffer
// HDR case - Lighting additively blended into floating point buffer
Pass {
Name "FINITELIGHT"
ZWrite Off
Blend One One
CGPROGRAM
#pragma target 3.0
#pragma vertex vert_deferred
#pragma fragment frag
#pragma multi_compile_lightpass
#pragma multi_compile ___ UNITY_HDR_ON
#pragma exclude_renderers nomrt
#include "UnityCG.cginc"
#include "UnityDeferredLibrary.cginc"
#include "UnityPBSLighting.cginc"
#include "UnityStandardUtils.cginc"
#include "UnityGBuffer.cginc"
#include "UnityStandardBRDF.cginc"
#include "LightingTemplate.hlsl"
#ifdef UNITY_FRAMEBUFFER_FETCH_AVAILABLE
void frag (unity_v2f_deferred i,
in half4 outGBuffer0 : SV_Target0,
in half4 outGBuffer1 : SV_Target1,
in half4 outGBuffer2 : SV_Target2,
out half4 outEmission : SV_Target3,
in float outLinearDepth : SV_Target4)
#else
half4 frag (unity_v2f_deferred i) : SV_TARGET
#endif
{
#ifdef UNITY_FRAMEBUFFER_FETCH_AVAILABLE
outEmission = CalculateLight(i, outGBuffer0, outGBuffer1, outGBuffer2, outLinearDepth);
#else
return CalculateLight(i);
#endif
}
ENDCG
}
// Pass 1.5: Directional Lighting pass -- becuase i said so
// LDR case - Lighting encoded into a subtractive ARGB8 buffer
// HDR case - Lighting additively blended into floating point buffer
Pass {
Name "DIRECTIONALLIGHT"
ZWrite Off
ZTest Always
Cull Off
Blend One One
CGPROGRAM
#pragma target 3.0
#pragma vertex filip_vert_deferred
#pragma fragment frag
#pragma multi_compile_lightpass
#pragma multi_compile ___ UNITY_HDR_ON
#pragma exclude_renderers nomrt
#include "UnityCG.cginc"
#include "UnityDeferredLibrary.cginc"
#include "UnityPBSLighting.cginc"
#include "UnityStandardUtils.cginc"
#include "UnityGBuffer.cginc"
#include "UnityStandardBRDF.cginc"
#include "LightingTemplate.hlsl"
unity_v2f_deferred filip_vert_deferred (float4 vertex : POSITION, float3 normal : NORMAL)
{
bool lightAsQuad = _LightAsQuad!=0.0;
unity_v2f_deferred o;
// scaling quasd by two becuase built-in unity quad ranges from -0.5 to 0.5
o.pos = lightAsQuad ? float4(2.0*vertex.xy, 0.5, 1.0) : UnityObjectToClipPos(vertex);
o.uv = ComputeScreenPos(o.pos);
// normal contains a ray pointing from the camera to one of near plane's
// corners in camera space when we are drawing a full screen quad.
// Otherwise, when rendering 3D shapes, use the ray calculated here.
if (lightAsQuad){
float2 rayXY = mul(unity_CameraInvProjection, float4(o.pos.x, -o.pos.y, -1, 1)).xy;
o.ray = float3(rayXY, 1.0);
}
else
{
o.ray = UnityObjectToViewPos(vertex) * float3(-1,-1,1);
}
return o;
}
#ifdef UNITY_FRAMEBUFFER_FETCH_AVAILABLE
void frag (unity_v2f_deferred i,
in half4 outGBuffer0 : SV_Target0,
in half4 outGBuffer1 : SV_Target1,
in half4 outGBuffer2 : SV_Target2,
out half4 outEmission : SV_Target3,
in float outLinearDepth : SV_Target4)
#else
half4 frag (unity_v2f_deferred i) : SV_TARGET
#endif
{
#ifdef UNITY_FRAMEBUFFER_FETCH_AVAILABLE
outEmission = CalculateLight(i, outGBuffer0, outGBuffer1, outGBuffer2, outLinearDepth);
#else
return CalculateLight(i);
#endif
}
ENDCG
}
// Pass 2: Final decode pass.
// Used only with HDR off, to decode the logarithmic buffer into the main RT
Pass {
ZTest Always Cull Off ZWrite Off
Stencil {
ref [_StencilNonBackground]
readmask [_StencilNonBackground]
// Normally just comp would be sufficient, but there's a bug and only front face stencil state is set (case 583207)
compback equal
compfront equal
}
CGPROGRAM
#pragma target 3.0
#pragma vertex vert
#pragma fragment frag
#pragma exclude_renderers nomrt
#include "UnityCG.cginc"
sampler2D _LightBuffer;
struct v2f {
float4 vertex : SV_POSITION;
float2 texcoord : TEXCOORD0;
};
v2f vert (float4 vertex : POSITION, float2 texcoord : TEXCOORD0)
{
v2f o;
o.vertex = UnityObjectToClipPos(vertex);
o.texcoord = texcoord.xy;
#ifdef UNITY_SINGLE_PASS_STEREO
o.texcoord = TransformStereoScreenSpaceTex(o.texcoord, 1.0f);
#endif
return o;
}
fixed4 frag (v2f i) : SV_Target
{
return -log2(tex2D(_LightBuffer, i.texcoord));
}
ENDCG
}
}
Fallback Off
}

9
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/Internal-DeferredShading.shader.meta


fileFormatVersion: 2
guid: eeee2c879e4754d958204f0816f646c7
timeCreated: 1490056565
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

9
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightVolumes.meta


fileFormatVersion: 2
guid: 03196c32579a14093b71c0f3f6db986d
folderAsset: yes
timeCreated: 1490056768
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

9
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightVolumes/Materials.meta


fileFormatVersion: 2
guid: 51a6ba599f86f474c91af7d576edf353
folderAsset: yes
timeCreated: 1490056799
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

75
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightVolumes/Materials/No Name.mat


%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: No Name
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 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.5
- _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: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

9
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightVolumes/Materials/No Name.mat.meta


fileFormatVersion: 2
guid: 6fbc93b0fa7b44e8f95c9d5cf1030915
timeCreated: 1490056799
licenseType: Pro
NativeFormatImporter:
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

385
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightVolumes/icosahedron.fbx


; FBX 6.1.0 project file
; Created by Blender FBX Exporter
; for support mail: ideasman42@gmail.com
; ----------------------------------------------------
FBXHeaderExtension: {
FBXHeaderVersion: 1003
FBXVersion: 6100
CreationTimeStamp: {
Version: 1000
Year: 2013
Month: 07
Day: 04
Hour: 14
Minute: 10
Second: 26
Millisecond: 0
}
Creator: "FBX SDK/FBX Plugins build 20070228"
OtherFlags: {
FlagPLE: 0
}
}
CreationTime: "2013-07-04 14:10:26:000"
Creator: "Blender version 2.66 (sub 1)"
; Object definitions
;------------------------------------------------------------------
Definitions: {
Version: 100
Count: 11
ObjectType: "Model" {
Count: 1
}
ObjectType: "Geometry" {
Count: 1
}
ObjectType: "Material" {
Count: 1
}
ObjectType: "Pose" {
Count: 1
}
ObjectType: "GlobalSettings" {
Count: 1
}
}
; Object properties
;------------------------------------------------------------------
Objects: {
Model: "Model::icosahedron", "Mesh" {
Version: 232
Properties60: {
Property: "QuaternionInterpolate", "bool", "",0
Property: "Visibility", "Visibility", "A+",1
Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,0.000000000000000,0.000000000000000
Property: "Lcl Rotation", "Lcl Rotation", "A+",-90.000009334538021,0.000000000000000,0.000000000000000
Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000
Property: "RotationOffset", "Vector3D", "",0,0,0
Property: "RotationPivot", "Vector3D", "",0,0,0
Property: "ScalingOffset", "Vector3D", "",0,0,0
Property: "ScalingPivot", "Vector3D", "",0,0,0
Property: "TranslationActive", "bool", "",0
Property: "TranslationMin", "Vector3D", "",0,0,0
Property: "TranslationMax", "Vector3D", "",0,0,0
Property: "TranslationMinX", "bool", "",0
Property: "TranslationMinY", "bool", "",0
Property: "TranslationMinZ", "bool", "",0
Property: "TranslationMaxX", "bool", "",0
Property: "TranslationMaxY", "bool", "",0
Property: "TranslationMaxZ", "bool", "",0
Property: "RotationOrder", "enum", "",0
Property: "RotationSpaceForLimitOnly", "bool", "",0
Property: "AxisLen", "double", "",10
Property: "PreRotation", "Vector3D", "",0,0,0
Property: "PostRotation", "Vector3D", "",0,0,0
Property: "RotationActive", "bool", "",0
Property: "RotationMin", "Vector3D", "",0,0,0
Property: "RotationMax", "Vector3D", "",0,0,0
Property: "RotationMinX", "bool", "",0
Property: "RotationMinY", "bool", "",0
Property: "RotationMinZ", "bool", "",0
Property: "RotationMaxX", "bool", "",0
Property: "RotationMaxY", "bool", "",0
Property: "RotationMaxZ", "bool", "",0
Property: "RotationStiffnessX", "double", "",0
Property: "RotationStiffnessY", "double", "",0
Property: "RotationStiffnessZ", "double", "",0
Property: "MinDampRangeX", "double", "",0
Property: "MinDampRangeY", "double", "",0
Property: "MinDampRangeZ", "double", "",0
Property: "MaxDampRangeX", "double", "",0
Property: "MaxDampRangeY", "double", "",0
Property: "MaxDampRangeZ", "double", "",0
Property: "MinDampStrengthX", "double", "",0
Property: "MinDampStrengthY", "double", "",0
Property: "MinDampStrengthZ", "double", "",0
Property: "MaxDampStrengthX", "double", "",0
Property: "MaxDampStrengthY", "double", "",0
Property: "MaxDampStrengthZ", "double", "",0
Property: "PreferedAngleX", "double", "",0
Property: "PreferedAngleY", "double", "",0
Property: "PreferedAngleZ", "double", "",0
Property: "InheritType", "enum", "",0
Property: "ScalingActive", "bool", "",0
Property: "ScalingMin", "Vector3D", "",1,1,1
Property: "ScalingMax", "Vector3D", "",1,1,1
Property: "ScalingMinX", "bool", "",0
Property: "ScalingMinY", "bool", "",0
Property: "ScalingMinZ", "bool", "",0
Property: "ScalingMaxX", "bool", "",0
Property: "ScalingMaxY", "bool", "",0
Property: "ScalingMaxZ", "bool", "",0
Property: "GeometricTranslation", "Vector3D", "",0,0,0
Property: "GeometricRotation", "Vector3D", "",0,0,0
Property: "GeometricScaling", "Vector3D", "",1,1,1
Property: "LookAtProperty", "object", ""
Property: "UpVectorProperty", "object", ""
Property: "Show", "bool", "",1
Property: "NegativePercentShapeSupport", "bool", "",1
Property: "DefaultAttributeIndex", "int", "",0
Property: "Color", "Color", "A",0.8,0.8,0.8
Property: "Size", "double", "",100
Property: "Look", "enum", "",1
}
MultiLayer: 0
MultiTake: 1
Shading: Y
Culling: "CullingOff"
Vertices: 0.000000,-0.000000,-1.257438,0.909882,-0.661060,-0.562345,-0.347537,-1.069627,-0.562345,-1.124684,-0.000000,-0.562345,-0.347537,1.069627,-0.562345,0.909882,0.661060,-0.562345,0.347537,-1.069627,0.562345
,-0.909882,-0.661060,0.562345,-0.909882,0.661060,0.562345,0.347537,1.069627,0.562345,1.124684,-0.000000,0.562345,0.000000,-0.000000,1.257438
PolygonVertexIndex: 0,1,-3,1,0,-6,0,2,-4,0,3,-5,0,4,-6,1,5,-11,2,1,-7,3,2,-8,4,3,-9,5,4,-10,1,10,-7,2,6,-8,3,7,-9
,4,8,-10,5,9,-11,6,10,-12,7,6,-12,8,7,-12,9,8,-12,10,9,-12
Edges:
GeometryVersion: 124
LayerElementNormal: 0 {
Version: 101
Name: ""
MappingInformationType: "ByVertice"
ReferenceInformationType: "Direct"
Normals: 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0
}
LayerElementSmoothing: 0 {
Version: 102
Name: ""
MappingInformationType: "ByPolygon"
ReferenceInformationType: "Direct"
Smoothing: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
}
Layer: 0 {
Version: 100
LayerElement: {
Type: "LayerElementNormal"
TypedIndex: 0
}
LayerElement: {
Type: "LayerElementSmoothing"
TypedIndex: 0
}
}
}
Material: "Material::unnamed", "" {
Version: 102
ShadingModel: "phong"
MultiLayer: 0
Properties60: {
Property: "ShadingModel", "KString", "", "Phong"
Property: "MultiLayer", "bool", "",0
Property: "EmissiveColor", "ColorRGB", "",0.8000,0.8000,0.8000
Property: "EmissiveFactor", "double", "",0.0000
Property: "AmbientColor", "ColorRGB", "",0.0000,0.0000,0.0000
Property: "AmbientFactor", "double", "",0.5000
Property: "DiffuseColor", "ColorRGB", "",0.8000,0.8000,0.8000
Property: "DiffuseFactor", "double", "",1.0000
Property: "Bump", "Vector3D", "",0,0,0
Property: "TransparentColor", "ColorRGB", "",1,1,1
Property: "TransparencyFactor", "double", "",0.0000
Property: "SpecularColor", "ColorRGB", "",0.8000,0.8000,0.8000
Property: "SpecularFactor", "double", "",0.2000
Property: "ShininessExponent", "double", "",80.0
Property: "ReflectionColor", "ColorRGB", "",0,0,0
Property: "ReflectionFactor", "double", "",1
Property: "Emissive", "ColorRGB", "",0,0,0
Property: "Ambient", "ColorRGB", "",0.0,0.0,0.0
Property: "Diffuse", "ColorRGB", "",0.8,0.8,0.8
Property: "Specular", "ColorRGB", "",0.8,0.8,0.8
Property: "Shininess", "double", "",20.0
Property: "Opacity", "double", "",1.0
Property: "Reflectivity", "double", "",0
}
}
Pose: "Pose::BIND_POSES", "BindPose" {
Type: "BindPose"
Version: 100
Properties60: {
}
NbPoseNodes: 1
PoseNode: {
Node: "Model::icosahedron"
Matrix: 0.000000075497901,0.000000000000000,-1.000000000000000,0.000000000000000,-1.000000000000000,0.000000000000000,-0.000000075497901,0.000000000000000,0.000000000000000,1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000
}
}
GlobalSettings: {
Version: 1000
Properties60: {
Property: "UpAxis", "int", "",1
Property: "UpAxisSign", "int", "",1
Property: "FrontAxis", "int", "",2
Property: "FrontAxisSign", "int", "",1
Property: "CoordAxis", "int", "",0
Property: "CoordAxisSign", "int", "",1
Property: "UnitScaleFactor", "double", "",1
}
}
}
; Object relations
;------------------------------------------------------------------
Relations: {
Model: "Model::icosahedron", "Mesh" {
}
Model: "Model::Producer Perspective", "Camera" {
}
Model: "Model::Producer Top", "Camera" {
}
Model: "Model::Producer Bottom", "Camera" {
}
Model: "Model::Producer Front", "Camera" {
}
Model: "Model::Producer Back", "Camera" {
}
Model: "Model::Producer Right", "Camera" {
}
Model: "Model::Producer Left", "Camera" {
}
Model: "Model::Camera Switcher", "CameraSwitcher" {
}
Material: "Material::unnamed", "" {
}
}
; Object connections
;------------------------------------------------------------------
Connections: {
Connect: "OO", "Model::icosahedron", "Model::Scene"
}
;Takes and animation section
;----------------------------------------------------
Takes: {
Current: "Default Take"
Take: "Default Take" {
FileName: "Default_Take.tak"
LocalTime: 0,479181389250
ReferenceTime: 0,479181389250
;Models animation
;----------------------------------------------------
Model: "Model::icosahedron" {
Version: 1.1
Channel: "Transform" {
Channel: "T" {
Channel: "X" {
Default: 0.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,0.000000000000000,L
Color: 1,0,0
}
Channel: "Y" {
Default: 0.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,0.000000000000000,L
Color: 0,1,0
}
Channel: "Z" {
Default: 0.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,0.000000000000000,L
Color: 0,0,1
}
LayerType: 1
}
Channel: "R" {
Channel: "X" {
Default: -90.000002504348856
KeyVer: 4005
KeyCount: 1
Key:
1924423250,-90.000002504348856,L
Color: 1,0,0
}
Channel: "Y" {
Default: -0.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,-0.000000000000000,L
Color: 0,1,0
}
Channel: "Z" {
Default: 0.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,0.000000000000000,L
Color: 0,0,1
}
LayerType: 2
}
Channel: "S" {
Channel: "X" {
Default: 1.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,1.000000000000000,L
Color: 1,0,0
}
Channel: "Y" {
Default: 1.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,1.000000000000000,L
Color: 0,1,0
}
Channel: "Z" {
Default: 1.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,1.000000000000000,L
Color: 0,0,1
}
LayerType: 3
}
}
}
}
}
;Version 5 settings
;------------------------------------------------------------------
Version5: {
AmbientRenderSettings: {
Version: 101
AmbientLightColor: 0.0,0.0,0.0,0
}
FogOptions: {
FogEnable: 0
FogMode: 0
FogDensity: 0.000
FogStart: 5.000
FogEnd: 25.000
FogColor: 0.1,0.1,0.1,1
}
Settings: {
FrameRate: "24"
TimeFormat: 1
SnapOnFrames: 0
ReferenceTimeIndex: -1
TimeLineStartTime: 0
TimeLineStopTime: 479181389250
}
RendererSetting: {
DefaultCamera: "Producer Perspective"
DefaultViewingMode: 0
}
}

84
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightVolumes/icosahedron.fbx.meta


fileFormatVersion: 2
guid: fbcdb4376322a4948bf0455ea0666d54
timeCreated: 1490056800
licenseType: Pro
ModelImporter:
serializedVersion: 19
fileIDToRecycleName:
100000: //RootNode
400000: //RootNode
2300000: //RootNode
3300000: //RootNode
4300000: icosahedron
7400000: Default Take
9500000: //RootNode
materials:
importMaterials: 1
materialName: 0
materialSearch: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
importBlendShapes: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
importAnimation: 1
copyAvatar: 0
humanDescription:
serializedVersion: 2
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
rootMotionBoneName:
rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1}
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 2
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

410
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightVolumes/icosphere.fbx


; FBX 6.1.0 project file
; Created by Blender FBX Exporter
; for support mail: ideasman42@gmail.com
; ----------------------------------------------------
FBXHeaderExtension: {
FBXHeaderVersion: 1003
FBXVersion: 6100
CreationTimeStamp: {
Version: 1000
Year: 2013
Month: 07
Day: 04
Hour: 14
Minute: 10
Second: 00
Millisecond: 0
}
Creator: "FBX SDK/FBX Plugins build 20070228"
OtherFlags: {
FlagPLE: 0
}
}
CreationTime: "2013-07-04 14:10:00:000"
Creator: "Blender version 2.66 (sub 1)"
; Object definitions
;------------------------------------------------------------------
Definitions: {
Version: 100
Count: 11
ObjectType: "Model" {
Count: 1
}
ObjectType: "Geometry" {
Count: 1
}
ObjectType: "Material" {
Count: 1
}
ObjectType: "Pose" {
Count: 1
}
ObjectType: "GlobalSettings" {
Count: 1
}
}
; Object properties
;------------------------------------------------------------------
Objects: {
Model: "Model::Icosphere", "Mesh" {
Version: 232
Properties60: {
Property: "QuaternionInterpolate", "bool", "",0
Property: "Visibility", "Visibility", "A+",1
Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,0.000000000000000,0.000000000000000
Property: "Lcl Rotation", "Lcl Rotation", "A+",-90.000009334538021,0.000000000000000,0.000000000000000
Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000
Property: "RotationOffset", "Vector3D", "",0,0,0
Property: "RotationPivot", "Vector3D", "",0,0,0
Property: "ScalingOffset", "Vector3D", "",0,0,0
Property: "ScalingPivot", "Vector3D", "",0,0,0
Property: "TranslationActive", "bool", "",0
Property: "TranslationMin", "Vector3D", "",0,0,0
Property: "TranslationMax", "Vector3D", "",0,0,0
Property: "TranslationMinX", "bool", "",0
Property: "TranslationMinY", "bool", "",0
Property: "TranslationMinZ", "bool", "",0
Property: "TranslationMaxX", "bool", "",0
Property: "TranslationMaxY", "bool", "",0
Property: "TranslationMaxZ", "bool", "",0
Property: "RotationOrder", "enum", "",0
Property: "RotationSpaceForLimitOnly", "bool", "",0
Property: "AxisLen", "double", "",10
Property: "PreRotation", "Vector3D", "",0,0,0
Property: "PostRotation", "Vector3D", "",0,0,0
Property: "RotationActive", "bool", "",0
Property: "RotationMin", "Vector3D", "",0,0,0
Property: "RotationMax", "Vector3D", "",0,0,0
Property: "RotationMinX", "bool", "",0
Property: "RotationMinY", "bool", "",0
Property: "RotationMinZ", "bool", "",0
Property: "RotationMaxX", "bool", "",0
Property: "RotationMaxY", "bool", "",0
Property: "RotationMaxZ", "bool", "",0
Property: "RotationStiffnessX", "double", "",0
Property: "RotationStiffnessY", "double", "",0
Property: "RotationStiffnessZ", "double", "",0
Property: "MinDampRangeX", "double", "",0
Property: "MinDampRangeY", "double", "",0
Property: "MinDampRangeZ", "double", "",0
Property: "MaxDampRangeX", "double", "",0
Property: "MaxDampRangeY", "double", "",0
Property: "MaxDampRangeZ", "double", "",0
Property: "MinDampStrengthX", "double", "",0
Property: "MinDampStrengthY", "double", "",0
Property: "MinDampStrengthZ", "double", "",0
Property: "MaxDampStrengthX", "double", "",0
Property: "MaxDampStrengthY", "double", "",0
Property: "MaxDampStrengthZ", "double", "",0
Property: "PreferedAngleX", "double", "",0
Property: "PreferedAngleY", "double", "",0
Property: "PreferedAngleZ", "double", "",0
Property: "InheritType", "enum", "",0
Property: "ScalingActive", "bool", "",0
Property: "ScalingMin", "Vector3D", "",1,1,1
Property: "ScalingMax", "Vector3D", "",1,1,1
Property: "ScalingMinX", "bool", "",0
Property: "ScalingMinY", "bool", "",0
Property: "ScalingMinZ", "bool", "",0
Property: "ScalingMaxX", "bool", "",0
Property: "ScalingMaxY", "bool", "",0
Property: "ScalingMaxZ", "bool", "",0
Property: "GeometricTranslation", "Vector3D", "",0,0,0
Property: "GeometricRotation", "Vector3D", "",0,0,0
Property: "GeometricScaling", "Vector3D", "",1,1,1
Property: "LookAtProperty", "object", ""
Property: "UpVectorProperty", "object", ""
Property: "Show", "bool", "",1
Property: "NegativePercentShapeSupport", "bool", "",1
Property: "DefaultAttributeIndex", "int", "",0
Property: "Color", "Color", "A",0.8,0.8,0.8
Property: "Size", "double", "",100
Property: "Look", "enum", "",1
}
MultiLayer: 0
MultiTake: 1
Shading: Y
Culling: "CullingOff"
Vertices: 0.000000,0.000000,-1.069758,0.774084,-0.562399,-0.478417,-0.295668,-0.909988,-0.478417,-0.956819,0.000000,-0.478412,-0.295668,0.909988,-0.478417,0.774084,0.562399,-0.478417,0.295668,-0.909988,0.478417
,-0.774084,-0.562399,0.478417,-0.774084,0.562399,0.478417,0.295668,0.909988,0.478417,0.956819,0.000000,0.478412,0.000000,0.000000,1.069758,0.454992,-0.330567,-0.909994,0.281206,-0.865446,-0.562412
,-0.173788,-0.534874,-0.909994,0.454992,0.330567,-0.909994,0.909987,0.000000,-0.562410,-0.736196,-0.534876,-0.562410,-0.562403,0.000000,-0.909991,-0.736196,0.534876,-0.562410,-0.173788,0.534874,-0.909994
,0.281206,0.865446,-0.562412,1.017401,0.330569,-0.000000,1.017401,-0.330569,-0.000000,0.628788,-0.865452,-0.000000,0.000000,-1.069757,-0.000000,-0.628788,-0.865452,-0.000000,-1.017401,-0.330569,-0.000000
,-1.017401,0.330569,-0.000000,-0.628788,0.865452,-0.000000,0.000000,1.069757,-0.000000,0.628788,0.865452,-0.000000,0.736196,-0.534876,0.562410,-0.281206,-0.865446,0.562412,-0.909987,0.000000,0.562410
,-0.281206,0.865446,0.562412,0.736196,0.534876,0.562410,0.562403,0.000000,0.909991,0.173788,-0.534874,0.909994,-0.454992,-0.330567,0.909994,-0.454992,0.330567,0.909994,0.173788,0.534874,0.909994
PolygonVertexIndex: 0,12,-15,1,12,-17,0,14,-19,0,18,-21,0,20,-16,1,16,-24,2,13,-26,3,17,-28,4,19,-30,5,21,-32,1,23,-25,2,25,-27,3,27,-29
,4,29,-31,5,31,-23,6,32,-39,7,33,-40,8,34,-41,9,35,-42,10,36,-38,14,13,-3,14,12,-14,12,1,-14,16,15,-6,16,12,-16,12,0,-16
,18,17,-4,18,14,-18,14,2,-18,20,19,-5,20,18,-20,18,3,-20,15,21,-6,15,20,-22,20,4,-22,23,22,-11,23,16,-23,16,5,-23,25,24,-7
,25,13,-25,13,1,-25,27,26,-8,27,17,-27,17,2,-27,29,28,-9,29,19,-29,19,3,-29,31,30,-10,31,21,-31,21,4,-31,24,32,-7,24,23,-33
,23,10,-33,26,33,-8,26,25,-34,25,6,-34,28,34,-9,28,27,-35,27,7,-35,30,35,-10,30,29,-36,29,8,-36,22,36,-11,22,31,-37,31,9,-37
,38,37,-12,38,32,-38,32,10,-38,39,38,-12,39,33,-39,33,6,-39,40,39,-12,40,34,-40,34,7,-40,41,40,-12,41,35,-41,35,8,-41,37,41,-12
,37,36,-42,36,9,-42
Edges:
GeometryVersion: 124
LayerElementNormal: 0 {
Version: 101
Name: ""
MappingInformationType: "ByVertice"
ReferenceInformationType: "Direct"
Normals: 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0
}
LayerElementSmoothing: 0 {
Version: 102
Name: ""
MappingInformationType: "ByPolygon"
ReferenceInformationType: "Direct"
Smoothing: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
}
Layer: 0 {
Version: 100
LayerElement: {
Type: "LayerElementNormal"
TypedIndex: 0
}
LayerElement: {
Type: "LayerElementSmoothing"
TypedIndex: 0
}
}
}
Material: "Material::unnamed", "" {
Version: 102
ShadingModel: "phong"
MultiLayer: 0
Properties60: {
Property: "ShadingModel", "KString", "", "Phong"
Property: "MultiLayer", "bool", "",0
Property: "EmissiveColor", "ColorRGB", "",0.8000,0.8000,0.8000
Property: "EmissiveFactor", "double", "",0.0000
Property: "AmbientColor", "ColorRGB", "",0.0000,0.0000,0.0000
Property: "AmbientFactor", "double", "",0.5000
Property: "DiffuseColor", "ColorRGB", "",0.8000,0.8000,0.8000
Property: "DiffuseFactor", "double", "",1.0000
Property: "Bump", "Vector3D", "",0,0,0
Property: "TransparentColor", "ColorRGB", "",1,1,1
Property: "TransparencyFactor", "double", "",0.0000
Property: "SpecularColor", "ColorRGB", "",0.8000,0.8000,0.8000
Property: "SpecularFactor", "double", "",0.2000
Property: "ShininessExponent", "double", "",80.0
Property: "ReflectionColor", "ColorRGB", "",0,0,0
Property: "ReflectionFactor", "double", "",1
Property: "Emissive", "ColorRGB", "",0,0,0
Property: "Ambient", "ColorRGB", "",0.0,0.0,0.0
Property: "Diffuse", "ColorRGB", "",0.8,0.8,0.8
Property: "Specular", "ColorRGB", "",0.8,0.8,0.8
Property: "Shininess", "double", "",20.0
Property: "Opacity", "double", "",1.0
Property: "Reflectivity", "double", "",0
}
}
Pose: "Pose::BIND_POSES", "BindPose" {
Type: "BindPose"
Version: 100
Properties60: {
}
NbPoseNodes: 1
PoseNode: {
Node: "Model::Icosphere"
Matrix: 0.000000075497901,0.000000000000000,-1.000000000000000,0.000000000000000,-1.000000000000000,0.000000000000000,-0.000000075497901,0.000000000000000,0.000000000000000,1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000
}
}
GlobalSettings: {
Version: 1000
Properties60: {
Property: "UpAxis", "int", "",1
Property: "UpAxisSign", "int", "",1
Property: "FrontAxis", "int", "",2
Property: "FrontAxisSign", "int", "",1
Property: "CoordAxis", "int", "",0
Property: "CoordAxisSign", "int", "",1
Property: "UnitScaleFactor", "double", "",1
}
}
}
; Object relations
;------------------------------------------------------------------
Relations: {
Model: "Model::Icosphere", "Mesh" {
}
Model: "Model::Producer Perspective", "Camera" {
}
Model: "Model::Producer Top", "Camera" {
}
Model: "Model::Producer Bottom", "Camera" {
}
Model: "Model::Producer Front", "Camera" {
}
Model: "Model::Producer Back", "Camera" {
}
Model: "Model::Producer Right", "Camera" {
}
Model: "Model::Producer Left", "Camera" {
}
Model: "Model::Camera Switcher", "CameraSwitcher" {
}
Material: "Material::unnamed", "" {
}
}
; Object connections
;------------------------------------------------------------------
Connections: {
Connect: "OO", "Model::Icosphere", "Model::Scene"
}
;Takes and animation section
;----------------------------------------------------
Takes: {
Current: "Default Take"
Take: "Default Take" {
FileName: "Default_Take.tak"
LocalTime: 0,479181389250
ReferenceTime: 0,479181389250
;Models animation
;----------------------------------------------------
Model: "Model::Icosphere" {
Version: 1.1
Channel: "Transform" {
Channel: "T" {
Channel: "X" {
Default: 0.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,0.000000000000000,L
Color: 1,0,0
}
Channel: "Y" {
Default: 0.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,0.000000000000000,L
Color: 0,1,0
}
Channel: "Z" {
Default: 0.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,0.000000000000000,L
Color: 0,0,1
}
LayerType: 1
}
Channel: "R" {
Channel: "X" {
Default: -90.000002504348856
KeyVer: 4005
KeyCount: 1
Key:
1924423250,-90.000002504348856,L
Color: 1,0,0
}
Channel: "Y" {
Default: -0.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,-0.000000000000000,L
Color: 0,1,0
}
Channel: "Z" {
Default: 0.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,0.000000000000000,L
Color: 0,0,1
}
LayerType: 2
}
Channel: "S" {
Channel: "X" {
Default: 1.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,1.000000000000000,L
Color: 1,0,0
}
Channel: "Y" {
Default: 1.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,1.000000000000000,L
Color: 0,1,0
}
Channel: "Z" {
Default: 1.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,1.000000000000000,L
Color: 0,0,1
}
LayerType: 3
}
}
}
}
}
;Version 5 settings
;------------------------------------------------------------------
Version5: {
AmbientRenderSettings: {
Version: 101
AmbientLightColor: 0.0,0.0,0.0,0
}
FogOptions: {
FogEnable: 0
FogMode: 0
FogDensity: 0.000
FogStart: 5.000
FogEnd: 25.000
FogColor: 0.1,0.1,0.1,1
}
Settings: {
FrameRate: "24"
TimeFormat: 1
SnapOnFrames: 0
ReferenceTimeIndex: -1
TimeLineStartTime: 0
TimeLineStopTime: 479181389250
}
RendererSetting: {
DefaultCamera: "Producer Perspective"
DefaultViewingMode: 0
}
}

84
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightVolumes/icosphere.fbx.meta


fileFormatVersion: 2
guid: ca5ad20b8c008467d85ab2152d0f67a9
timeCreated: 1490056799
licenseType: Pro
ModelImporter:
serializedVersion: 19
fileIDToRecycleName:
100000: //RootNode
400000: //RootNode
2300000: //RootNode
3300000: //RootNode
4300000: Icosphere
7400000: Default Take
9500000: //RootNode
materials:
importMaterials: 1
materialName: 0
materialSearch: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
importBlendShapes: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
importAnimation: 1
copyAvatar: 0
humanDescription:
serializedVersion: 2
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
rootMotionBoneName:
rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1}
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 2
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

378
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightVolumes/pyramid.fbx


; FBX 6.1.0 project file
; Created by Blender FBX Exporter
; for support mail: ideasman42@gmail.com
; ----------------------------------------------------
FBXHeaderExtension: {
FBXHeaderVersion: 1003
FBXVersion: 6100
CreationTimeStamp: {
Version: 1000
Year: 2013
Month: 07
Day: 05
Hour: 14
Minute: 46
Second: 58
Millisecond: 0
}
Creator: "FBX SDK/FBX Plugins build 20070228"
OtherFlags: {
FlagPLE: 0
}
}
CreationTime: "2013-07-05 14:46:58:000"
Creator: "Blender version 2.66 (sub 1)"
; Object definitions
;------------------------------------------------------------------
Definitions: {
Version: 100
Count: 11
ObjectType: "Model" {
Count: 1
}
ObjectType: "Geometry" {
Count: 1
}
ObjectType: "Material" {
Count: 1
}
ObjectType: "Pose" {
Count: 1
}
ObjectType: "GlobalSettings" {
Count: 1
}
}
; Object properties
;------------------------------------------------------------------
Objects: {
Model: "Model::pyramid", "Mesh" {
Version: 232
Properties60: {
Property: "QuaternionInterpolate", "bool", "",0
Property: "Visibility", "Visibility", "A+",1
Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,0.000000000000000,0.000000000000000
Property: "Lcl Rotation", "Lcl Rotation", "A+",-90.000009334538021,0.000000000000000,0.000000000000000
Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000
Property: "RotationOffset", "Vector3D", "",0,0,0
Property: "RotationPivot", "Vector3D", "",0,0,0
Property: "ScalingOffset", "Vector3D", "",0,0,0
Property: "ScalingPivot", "Vector3D", "",0,0,0
Property: "TranslationActive", "bool", "",0
Property: "TranslationMin", "Vector3D", "",0,0,0
Property: "TranslationMax", "Vector3D", "",0,0,0
Property: "TranslationMinX", "bool", "",0
Property: "TranslationMinY", "bool", "",0
Property: "TranslationMinZ", "bool", "",0
Property: "TranslationMaxX", "bool", "",0
Property: "TranslationMaxY", "bool", "",0
Property: "TranslationMaxZ", "bool", "",0
Property: "RotationOrder", "enum", "",0
Property: "RotationSpaceForLimitOnly", "bool", "",0
Property: "AxisLen", "double", "",10
Property: "PreRotation", "Vector3D", "",0,0,0
Property: "PostRotation", "Vector3D", "",0,0,0
Property: "RotationActive", "bool", "",0
Property: "RotationMin", "Vector3D", "",0,0,0
Property: "RotationMax", "Vector3D", "",0,0,0
Property: "RotationMinX", "bool", "",0
Property: "RotationMinY", "bool", "",0
Property: "RotationMinZ", "bool", "",0
Property: "RotationMaxX", "bool", "",0
Property: "RotationMaxY", "bool", "",0
Property: "RotationMaxZ", "bool", "",0
Property: "RotationStiffnessX", "double", "",0
Property: "RotationStiffnessY", "double", "",0
Property: "RotationStiffnessZ", "double", "",0
Property: "MinDampRangeX", "double", "",0
Property: "MinDampRangeY", "double", "",0
Property: "MinDampRangeZ", "double", "",0
Property: "MaxDampRangeX", "double", "",0
Property: "MaxDampRangeY", "double", "",0
Property: "MaxDampRangeZ", "double", "",0
Property: "MinDampStrengthX", "double", "",0
Property: "MinDampStrengthY", "double", "",0
Property: "MinDampStrengthZ", "double", "",0
Property: "MaxDampStrengthX", "double", "",0
Property: "MaxDampStrengthY", "double", "",0
Property: "MaxDampStrengthZ", "double", "",0
Property: "PreferedAngleX", "double", "",0
Property: "PreferedAngleY", "double", "",0
Property: "PreferedAngleZ", "double", "",0
Property: "InheritType", "enum", "",0
Property: "ScalingActive", "bool", "",0
Property: "ScalingMin", "Vector3D", "",1,1,1
Property: "ScalingMax", "Vector3D", "",1,1,1
Property: "ScalingMinX", "bool", "",0
Property: "ScalingMinY", "bool", "",0
Property: "ScalingMinZ", "bool", "",0
Property: "ScalingMaxX", "bool", "",0
Property: "ScalingMaxY", "bool", "",0
Property: "ScalingMaxZ", "bool", "",0
Property: "GeometricTranslation", "Vector3D", "",0,0,0
Property: "GeometricRotation", "Vector3D", "",0,0,0
Property: "GeometricScaling", "Vector3D", "",1,1,1
Property: "LookAtProperty", "object", ""
Property: "UpVectorProperty", "object", ""
Property: "Show", "bool", "",1
Property: "NegativePercentShapeSupport", "bool", "",1
Property: "DefaultAttributeIndex", "int", "",0
Property: "Color", "Color", "A",0.8,0.8,0.8
Property: "Size", "double", "",100
Property: "Look", "enum", "",1
}
MultiLayer: 0
MultiTake: 1
Shading: Y
Culling: "CullingOff"
Vertices: 0.000000,0.000000,0.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,-1.000000,1.000000
PolygonVertexIndex: 0,1,-3,0,2,-4,0,3,-5,0,4,-2,4,3,2,-2
Edges:
GeometryVersion: 124
LayerElementNormal: 0 {
Version: 101
Name: ""
MappingInformationType: "ByVertice"
ReferenceInformationType: "Direct"
Normals: 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
}
LayerElementSmoothing: 0 {
Version: 102
Name: ""
MappingInformationType: "ByPolygon"
ReferenceInformationType: "Direct"
Smoothing: 0,0,0,0,0
}
Layer: 0 {
Version: 100
LayerElement: {
Type: "LayerElementNormal"
TypedIndex: 0
}
LayerElement: {
Type: "LayerElementSmoothing"
TypedIndex: 0
}
}
}
Material: "Material::unnamed", "" {
Version: 102
ShadingModel: "phong"
MultiLayer: 0
Properties60: {
Property: "ShadingModel", "KString", "", "Phong"
Property: "MultiLayer", "bool", "",0
Property: "EmissiveColor", "ColorRGB", "",0.8000,0.8000,0.8000
Property: "EmissiveFactor", "double", "",0.0000
Property: "AmbientColor", "ColorRGB", "",0.0000,0.0000,0.0000
Property: "AmbientFactor", "double", "",0.5000
Property: "DiffuseColor", "ColorRGB", "",0.8000,0.8000,0.8000
Property: "DiffuseFactor", "double", "",1.0000
Property: "Bump", "Vector3D", "",0,0,0
Property: "TransparentColor", "ColorRGB", "",1,1,1
Property: "TransparencyFactor", "double", "",0.0000
Property: "SpecularColor", "ColorRGB", "",0.8000,0.8000,0.8000
Property: "SpecularFactor", "double", "",0.2000
Property: "ShininessExponent", "double", "",80.0
Property: "ReflectionColor", "ColorRGB", "",0,0,0
Property: "ReflectionFactor", "double", "",1
Property: "Emissive", "ColorRGB", "",0,0,0
Property: "Ambient", "ColorRGB", "",0.0,0.0,0.0
Property: "Diffuse", "ColorRGB", "",0.8,0.8,0.8
Property: "Specular", "ColorRGB", "",0.8,0.8,0.8
Property: "Shininess", "double", "",20.0
Property: "Opacity", "double", "",1.0
Property: "Reflectivity", "double", "",0
}
}
Pose: "Pose::BIND_POSES", "BindPose" {
Type: "BindPose"
Version: 100
Properties60: {
}
NbPoseNodes: 1
PoseNode: {
Node: "Model::pyramid"
Matrix: 0.000000075497901,0.000000000000000,-1.000000000000000,0.000000000000000,-1.000000000000000,0.000000000000000,-0.000000075497901,0.000000000000000,0.000000000000000,1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000
}
}
GlobalSettings: {
Version: 1000
Properties60: {
Property: "UpAxis", "int", "",1
Property: "UpAxisSign", "int", "",1
Property: "FrontAxis", "int", "",2
Property: "FrontAxisSign", "int", "",1
Property: "CoordAxis", "int", "",0
Property: "CoordAxisSign", "int", "",1
Property: "UnitScaleFactor", "double", "",1
}
}
}
; Object relations
;------------------------------------------------------------------
Relations: {
Model: "Model::pyramid", "Mesh" {
}
Model: "Model::Producer Perspective", "Camera" {
}
Model: "Model::Producer Top", "Camera" {
}
Model: "Model::Producer Bottom", "Camera" {
}
Model: "Model::Producer Front", "Camera" {
}
Model: "Model::Producer Back", "Camera" {
}
Model: "Model::Producer Right", "Camera" {
}
Model: "Model::Producer Left", "Camera" {
}
Model: "Model::Camera Switcher", "CameraSwitcher" {
}
Material: "Material::unnamed", "" {
}
}
; Object connections
;------------------------------------------------------------------
Connections: {
Connect: "OO", "Model::pyramid", "Model::Scene"
}
;Takes and animation section
;----------------------------------------------------
Takes: {
Current: "Default Take"
Take: "Default Take" {
FileName: "Default_Take.tak"
LocalTime: 0,479181389250
ReferenceTime: 0,479181389250
;Models animation
;----------------------------------------------------
Model: "Model::pyramid" {
Version: 1.1
Channel: "Transform" {
Channel: "T" {
Channel: "X" {
Default: 0.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,0.000000000000000,L
Color: 1,0,0
}
Channel: "Y" {
Default: 0.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,0.000000000000000,L
Color: 0,1,0
}
Channel: "Z" {
Default: 0.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,0.000000000000000,L
Color: 0,0,1
}
LayerType: 1
}
Channel: "R" {
Channel: "X" {
Default: -90.000002504348856
KeyVer: 4005
KeyCount: 1
Key:
1924423250,-90.000002504348856,L
Color: 1,0,0
}
Channel: "Y" {
Default: -0.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,-0.000000000000000,L
Color: 0,1,0
}
Channel: "Z" {
Default: 0.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,0.000000000000000,L
Color: 0,0,1
}
LayerType: 2
}
Channel: "S" {
Channel: "X" {
Default: 1.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,1.000000000000000,L
Color: 1,0,0
}
Channel: "Y" {
Default: 1.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,1.000000000000000,L
Color: 0,1,0
}
Channel: "Z" {
Default: 1.000000000000000
KeyVer: 4005
KeyCount: 1
Key:
1924423250,1.000000000000000,L
Color: 0,0,1
}
LayerType: 3
}
}
}
}
}
;Version 5 settings
;------------------------------------------------------------------
Version5: {
AmbientRenderSettings: {
Version: 101
AmbientLightColor: 0.0,0.0,0.0,0
}
FogOptions: {
FogEnable: 0
FogMode: 0
FogDensity: 0.000
FogStart: 5.000
FogEnd: 25.000
FogColor: 0.1,0.1,0.1,1
}
Settings: {
FrameRate: "24"
TimeFormat: 1
SnapOnFrames: 0
ReferenceTimeIndex: -1
TimeLineStartTime: 0
TimeLineStopTime: 479181389250
}
RendererSetting: {
DefaultCamera: "Producer Perspective"
DefaultViewingMode: 0
}
}

84
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightVolumes/pyramid.fbx.meta


fileFormatVersion: 2
guid: 93e85ba57f65145538a8ac97bd005d40
timeCreated: 1490056799
licenseType: Pro
ModelImporter:
serializedVersion: 19
fileIDToRecycleName:
100000: //RootNode
400000: //RootNode
2300000: //RootNode
3300000: //RootNode
4300000: pyramid
7400000: Default Take
9500000: //RootNode
materials:
importMaterials: 1
materialName: 0
materialSearch: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
importBlendShapes: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
importAnimation: 1
copyAvatar: 0
humanDescription:
serializedVersion: 2
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
rootMotionBoneName:
rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1}
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 2
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

283
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightingTemplate.hlsl


#ifndef __DEFERREDLIGHTINGTEMPLATE_H__
#define __DEFERREDLIGHTINGTEMPLATE_H__
#include "UnityCG.cginc"
#include "UnityStandardBRDF.cginc"
#include "UnityStandardUtils.cginc"
#include "UnityPBSLighting.cginc"
//uniform uint g_nNumDirLights;
//---------------------------------------------------------------------------------------------------------------------------------------------------------
// TODO: clean up.. -va
#define MAX_SHADOW_LIGHTS 10
#define MAX_SHADOWMAP_PER_LIGHT 6
#define MAX_DIRECTIONAL_SPLIT 4
#define CUBEMAPFACE_POSITIVE_X 0
#define CUBEMAPFACE_NEGATIVE_X 1
#define CUBEMAPFACE_POSITIVE_Y 2
#define CUBEMAPFACE_NEGATIVE_Y 3
#define CUBEMAPFACE_POSITIVE_Z 4
#define CUBEMAPFACE_NEGATIVE_Z 5
sampler2D _CameraGBufferTexture0;
sampler2D _CameraGBufferTexture1;
sampler2D _CameraGBufferTexture2;
// from LightDefinitions.cs.hlsl
#define SPOT_LIGHT (0)
#define SPHERE_LIGHT (1)
#define BOX_LIGHT (2)
#define DIRECTIONAL_LIGHT (3)
CBUFFER_START(ShadowLightData)
float4 g_vShadow3x3PCFTerms0;
float4 g_vShadow3x3PCFTerms1;
float4 g_vShadow3x3PCFTerms2;
float4 g_vShadow3x3PCFTerms3;
float4 g_vDirShadowSplitSpheres[MAX_DIRECTIONAL_SPLIT];
float4x4 g_matWorldToShadow[MAX_SHADOW_LIGHTS * MAX_SHADOWMAP_PER_LIGHT];
CBUFFER_END
//---------------------------------------------------------------------------------------------------------------------------------------------------------
UNITY_DECLARE_DEPTH_TEXTURE(_CameraGBufferZ);
// UNITY_DECLARE_TEX2D(_LightTextureB0);
// sampler2D _LightTextureB0;
// UNITY_DECLARE_TEX2DARRAY(_spotCookieTextures);
// UNITY_DECLARE_ABSTRACT_CUBE_ARRAY(_pointCookieTextures);
// StructuredBuffer<DirectionalLight> g_dirLightData;
#define REVERSE_ZBUF
#define DECLARE_SHADOWMAP( tex ) Texture2D tex; SamplerComparisonState sampler##tex
#ifdef REVERSE_ZBUF
#define SAMPLE_SHADOW( tex, coord ) tex.SampleCmpLevelZero( sampler##tex, (coord).xy, (coord).z )
#else
#define SAMPLE_SHADOW( tex, coord ) tex.SampleCmpLevelZero( sampler##tex, (coord).xy, 1.0-(coord).z )
#endif
DECLARE_SHADOWMAP(g_tShadowBuffer);
float ComputeShadow_PCF_3x3_Gaussian(float3 vPositionWs, float4x4 matWorldToShadow)
{
float4 vPositionTextureSpace = mul(float4(vPositionWs.xyz, 1.0), matWorldToShadow);
vPositionTextureSpace.xyz /= vPositionTextureSpace.w;
float2 shadowMapCenter = vPositionTextureSpace.xy;
if ((shadowMapCenter.x < 0.0f) || (shadowMapCenter.x > 1.0f) || (shadowMapCenter.y < 0.0f) || (shadowMapCenter.y > 1.0f))
return 1.0f;
float objDepth = saturate(257.0 / 256.0 - vPositionTextureSpace.z);
float4 v20Taps;
v20Taps.x = SAMPLE_SHADOW(g_tShadowBuffer, float3(shadowMapCenter.xy + g_vShadow3x3PCFTerms1.xy, objDepth)).x; // 1 1
v20Taps.y = SAMPLE_SHADOW(g_tShadowBuffer, float3(shadowMapCenter.xy + g_vShadow3x3PCFTerms1.zy, objDepth)).x; // -1 1
v20Taps.z = SAMPLE_SHADOW(g_tShadowBuffer, float3(shadowMapCenter.xy + g_vShadow3x3PCFTerms1.xw, objDepth)).x; // 1 -1
v20Taps.w = SAMPLE_SHADOW(g_tShadowBuffer, float3(shadowMapCenter.xy + g_vShadow3x3PCFTerms1.zw, objDepth)).x; // -1 -1
float flSum = dot(v20Taps.xyzw, float4(0.25, 0.25, 0.25, 0.25));
if ((flSum == 0.0) || (flSum == 1.0))
return flSum;
flSum *= g_vShadow3x3PCFTerms0.x * 4.0;
float4 v33Taps;
v33Taps.x = SAMPLE_SHADOW(g_tShadowBuffer, float3(shadowMapCenter.xy + g_vShadow3x3PCFTerms2.xz, objDepth)).x; // 1 0
v33Taps.y = SAMPLE_SHADOW(g_tShadowBuffer, float3(shadowMapCenter.xy + g_vShadow3x3PCFTerms3.xz, objDepth)).x; // -1 0
v33Taps.z = SAMPLE_SHADOW(g_tShadowBuffer, float3(shadowMapCenter.xy + g_vShadow3x3PCFTerms3.zy, objDepth)).x; // 0 -1
v33Taps.w = SAMPLE_SHADOW(g_tShadowBuffer, float3(shadowMapCenter.xy + g_vShadow3x3PCFTerms2.zy, objDepth)).x; // 0 1
flSum += dot(v33Taps.xyzw, g_vShadow3x3PCFTerms0.yyyy);
flSum += SAMPLE_SHADOW(g_tShadowBuffer, float3(shadowMapCenter.xy, objDepth)).x * g_vShadow3x3PCFTerms0.z;
return flSum;
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------
/**
* Gets the cascade weights based on the world position of the fragment and the positions of the split spheres for each cascade.
* Returns an invalid split index if past shadowDistance (ie 4 is invalid for cascade)
*/
float GetSplitSphereIndexForDirshadows(float3 wpos)
{
float3 fromCenter0 = wpos.xyz - g_vDirShadowSplitSpheres[0].xyz;
float3 fromCenter1 = wpos.xyz - g_vDirShadowSplitSpheres[1].xyz;
float3 fromCenter2 = wpos.xyz - g_vDirShadowSplitSpheres[2].xyz;
float3 fromCenter3 = wpos.xyz - g_vDirShadowSplitSpheres[3].xyz;
float4 distances2 = float4(dot(fromCenter0, fromCenter0), dot(fromCenter1, fromCenter1), dot(fromCenter2, fromCenter2), dot(fromCenter3, fromCenter3));
float4 vDirShadowSplitSphereSqRadii;
vDirShadowSplitSphereSqRadii.x = g_vDirShadowSplitSpheres[0].w;
vDirShadowSplitSphereSqRadii.y = g_vDirShadowSplitSpheres[1].w;
vDirShadowSplitSphereSqRadii.z = g_vDirShadowSplitSpheres[2].w;
vDirShadowSplitSphereSqRadii.w = g_vDirShadowSplitSpheres[3].w;
fixed4 weights = float4(distances2 < vDirShadowSplitSphereSqRadii);
weights.yzw = saturate(weights.yzw - weights.xyz);
return 4 - dot(weights, float4(4, 3, 2, 1));
}
float SampleShadow(uint type, float3 vPositionWs, float3 vPositionToLightDirWs, uint lightIndex)
{
float flShadowScalar = 1.0;
int shadowSplitIndex = 0;
if (type == DIRECTIONAL_LIGHT)
{
shadowSplitIndex = GetSplitSphereIndexForDirshadows(vPositionWs);
}
else if (type == SPHERE_LIGHT)
{
float3 absPos = abs(vPositionToLightDirWs);
shadowSplitIndex = (vPositionToLightDirWs.z > 0) ? CUBEMAPFACE_NEGATIVE_Z : CUBEMAPFACE_POSITIVE_Z;
if (absPos.x > absPos.y)
{
if (absPos.x > absPos.z)
{
shadowSplitIndex = (vPositionToLightDirWs.x > 0) ? CUBEMAPFACE_NEGATIVE_X : CUBEMAPFACE_POSITIVE_X;
}
}
else
{
if (absPos.y > absPos.z)
{
shadowSplitIndex = (vPositionToLightDirWs.y > 0) ? CUBEMAPFACE_NEGATIVE_Y : CUBEMAPFACE_POSITIVE_Y;
}
}
}
flShadowScalar = ComputeShadow_PCF_3x3_Gaussian(vPositionWs.xyz, g_matWorldToShadow[lightIndex * MAX_SHADOWMAP_PER_LIGHT + shadowSplitIndex]);
return flShadowScalar;
}
// --------------------------------------------------------
// Common lighting data calculation (direction, attenuation, ...)
void MyDeferredCalculateLightParams (
unity_v2f_deferred i,
out float3 outWorldPos,
out float2 outUV,
out half3 outLightDir,
out float outAtten,
out float outFadeDist,
float depth
)
{
i.ray = i.ray * (_ProjectionParams.z / i.ray.z);
float2 uv = i.uv.xy / i.uv.w;
// read depth and reconstruct world position
#ifndef UNITY_FRAMEBUFFER_FETCH_AVAILABLE
depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv);
#else
// depth = SAMPLE_DEPTH_TEXTURE(_CameraGBufferZ, uv);
#endif
depth = Linear01Depth (depth);
float4 vpos = float4(i.ray * depth,1);
float3 wpos = mul (unity_CameraToWorld, vpos).xyz;
float fadeDist = UnityComputeShadowFadeDistance(wpos, vpos.z);
// spot light case
#if defined (SPOT)
float3 tolight = _LightPos.xyz - wpos;
half3 lightDir = normalize (tolight);
float4 uvCookie = mul (unity_WorldToLight, float4(wpos,1));
// negative bias because http://aras-p.info/blog/2010/01/07/screenspace-vs-mip-mapping/
float atten = tex2Dbias (_LightTexture0, float4(uvCookie.xy / uvCookie.w, 0, -8)).w;
atten *= uvCookie.w < 0;
float att = dot(tolight, tolight) * _LightPos.w;
atten *= tex2D (_LightTextureB0, att.rr).UNITY_ATTEN_CHANNEL;
atten *= SampleShadow(SPOT_LIGHT, wpos, 0, 0);
//atten *= UnityDeferredComputeShadow (wpos, fadeDist, uv);
// directional light case
#elif defined (DIRECTIONAL) || defined (DIRECTIONAL_COOKIE)
half3 lightDir = -_LightDir.xyz;
float atten = 1.0;
//half UnityDeferredComputeShadow(float3 vec, float fadeDist, float2 uv)
//atten *= UnityDeferredComputeShadow (wpos, fadeDist, uv);
//SampleShadow(uint type, float3 vPositionWs, float3 vPositionToLightDirWs, uint lightIndex)
atten *= SampleShadow(DIRECTIONAL_LIGHT, wpos, 0, 0);
#if defined (DIRECTIONAL_COOKIE)
atten *= tex2Dbias (_LightTexture0, float4(mul(unity_WorldToLight, half4(wpos,1)).xy, 0, -8)).w;
#endif //DIRECTIONAL_COOKIE
// point light case
#elif defined (POINT) || defined (POINT_COOKIE)
float3 tolight = wpos - _LightPos.xyz;
half3 lightDir = -normalize (tolight);
float att = dot(tolight, tolight) * _LightPos.w;
float atten = tex2D (_LightTextureB0, att.rr).UNITY_ATTEN_CHANNEL;
// atten *= UnityDeferredComputeShadow (tolight, fadeDist, uv);
#if defined (POINT_COOKIE)
atten *= texCUBEbias(_LightTexture0, float4(mul(unity_WorldToLight, half4(wpos,1)).xyz, -8)).w;
#endif //POINT_COOKIE
#else
half3 lightDir = 0;
float atten = 0;
#endif
outWorldPos = wpos;
outUV = uv;
outLightDir = lightDir;
outAtten = atten;
outFadeDist = fadeDist;
}
#ifdef UNITY_FRAMEBUFFER_FETCH_AVAILABLE
half4 CalculateLight (unity_v2f_deferred i, inout half4 gbuffer0, inout half4 gbuffer1, inout half4 gbuffer2, inout float vpDepth)
#else
half4 CalculateLight (unity_v2f_deferred i)
#endif
{
float3 wpos;
float2 uv;
float atten, fadeDist;
UnityLight light;
UNITY_INITIALIZE_OUTPUT(UnityLight, light);
#ifdef UNITY_FRAMEBUFFER_FETCH_AVAILABLE
MyDeferredCalculateLightParams (i, wpos, uv, light.dir, atten, fadeDist, vpDepth);
#else
MyDeferredCalculateLightParams (i, wpos, uv, light.dir, atten, fadeDist, 0.0);
#endif
light.color = _LightColor.rgb * atten;
#ifndef UNITY_FRAMEBUFFER_FETCH_AVAILABLE
// unpack Gbuffer
half4 gbuffer0 = tex2D (_CameraGBufferTexture0, uv);
half4 gbuffer1 = tex2D (_CameraGBufferTexture1, uv);
half4 gbuffer2 = tex2D (_CameraGBufferTexture2, uv);
#endif
UnityStandardData data = UnityStandardDataFromGbuffer(gbuffer0, gbuffer1, gbuffer2);
float3 eyeVec = normalize(wpos-_WorldSpaceCameraPos);
half oneMinusReflectivity = 1 - SpecularStrength(data.specularColor.rgb);
UnityIndirect ind;
UNITY_INITIALIZE_OUTPUT(UnityIndirect, ind);
ind.diffuse = 0;
ind.specular = 0;
half4 res = UNITY_BRDF_PBS (data.diffuseColor, data.specularColor, oneMinusReflectivity, data.smoothness, data.normalWorld, -eyeVec, light, ind);
return res;
}
#endif

9
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightingTemplate.hlsl.meta


fileFormatVersion: 2
guid: 068992864aeb14817a5c38232ac25e6e
timeCreated: 1490056564
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

79
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/Skybox-Cubed.shader


Shader "MobileRenderloop/Skybox-Cubemap" {
Properties {
_Tint ("Tint Color", Color) = (.5, .5, .5, .5)
[Gamma] _Exposure ("Exposure", Range(0, 8)) = 1.0
_Rotation ("Rotation", Range(0, 360)) = 0
[NoScaleOffset] _Tex ("Cubemap (HDR)", Cube) = "grey" {}
}
SubShader {
Tags { "Queue"="Background" "RenderType"="Background" "PreviewType"="Skybox" }
Cull Off ZWrite Off
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#include "UnityCG.cginc"
samplerCUBE _Tex;
half4 _Tex_HDR;
half4 _Tint;
half _Exposure;
float _Rotation;
float3 RotateAroundYInDegrees (float3 vertex, float degrees)
{
float alpha = degrees * UNITY_PI / 180.0;
float sina, cosa;
sincos(alpha, sina, cosa);
float2x2 m = float2x2(cosa, -sina, sina, cosa);
return float3(mul(m, vertex.xz), vertex.y).xzy;
}
struct appdata_t {
float4 vertex : POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f {
float4 vertex : SV_POSITION;
float3 texcoord : TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert (appdata_t v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
float3 rotated = RotateAroundYInDegrees(v.vertex, _Rotation);
o.vertex = UnityObjectToClipPos(rotated);
o.texcoord = v.vertex.xyz;
return o;
}
#ifdef UNITY_FRAMEBUFFER_FETCH_AVAILABLE
half4 frag (v2f i) : SV_Target3
#else
half4 frag (v2f i) : SV_Target
#endif
{
half4 tex = texCUBE (_Tex, i.texcoord);
half3 c = DecodeHDR (tex, _Tex_HDR);
c = c * _Tint.rgb * unity_ColorSpaceDouble.rgb;
c *= _Exposure;
return half4(c, 1);
}
ENDCG
}
}
Fallback Off
}

9
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/Skybox-Cubed.shader.meta


fileFormatVersion: 2
guid: d9ca174c419bb4eeaa2f4fb1b332eed6
timeCreated: 1490056564
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

336
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/Standard.shader


Shader "Standard-SRP"
{
Properties
{
_Color("Color", Color) = (1,1,1,1)
_MainTex("Albedo", 2D) = "white" {}
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
_Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5
_GlossMapScale("Smoothness Scale", Range(0.0, 1.0)) = 1.0
[Enum(Metallic Alpha,0,Albedo Alpha,1)] _SmoothnessTextureChannel ("Smoothness texture channel", Float) = 0
[Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0.0
_MetallicGlossMap("Metallic", 2D) = "white" {}
[ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0
[ToggleOff] _GlossyReflections("Glossy Reflections", Float) = 1.0
_BumpScale("Scale", Float) = 1.0
_BumpMap("Normal Map", 2D) = "bump" {}
_Parallax ("Height Scale", Range (0.005, 0.08)) = 0.02
_ParallaxMap ("Height Map", 2D) = "black" {}
_OcclusionStrength("Strength", Range(0.0, 1.0)) = 1.0
_OcclusionMap("Occlusion", 2D) = "white" {}
_EmissionColor("Color", Color) = (0,0,0)
_EmissionMap("Emission", 2D) = "white" {}
_DetailMask("Detail Mask", 2D) = "white" {}
_DetailAlbedoMap("Detail Albedo x2", 2D) = "grey" {}
_DetailNormalMapScale("Scale", Float) = 1.0
_DetailNormalMap("Normal Map", 2D) = "bump" {}
[Enum(UV0,0,UV1,1)] _UVSec ("UV Set for secondary textures", Float) = 0
// Blending state
[HideInInspector] _Mode ("__mode", Float) = 0.0
[HideInInspector] _SrcBlend ("__src", Float) = 1.0
[HideInInspector] _DstBlend ("__dst", Float) = 0.0
[HideInInspector] _ZWrite ("__zw", Float) = 1.0
}
CGINCLUDE
#define UNITY_SETUP_BRDF_INPUT MetallicSetup
ENDCG
SubShader
{
Tags { "RenderType"="Opaque" "PerformanceChecks"="False" }
LOD 300
// ------------------------------------------------------------------
// Base forward pass (directional light, emission, lightmaps, ...)
Pass
{
Name "FORWARD"
Tags { "LightMode" = "ForwardBase" }
Blend [_SrcBlend] [_DstBlend]
ZWrite [_ZWrite]
CGPROGRAM
#pragma target 3.0
// -------------------------------------
#pragma shader_feature _NORMALMAP
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
#pragma shader_feature _EMISSION
#pragma shader_feature _METALLICGLOSSMAP
#pragma shader_feature ___ _DETAIL_MULX2
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
#pragma shader_feature _ _GLOSSYREFLECTIONS_OFF
#pragma shader_feature _PARALLAXMAP
#pragma multi_compile_fwdbase
#pragma multi_compile_fog
#pragma multi_compile_instancing
#pragma vertex vertBase
#pragma fragment fragBase
#include "UnityStandardCoreForward.cginc"
ENDCG
}
// ------------------------------------------------------------------
// Additive forward pass (one light per pass)
Pass
{
Name "FORWARD_DELTA"
Tags { "LightMode" = "ForwardAdd" }
Blend [_SrcBlend] One
Fog { Color (0,0,0,0) } // in additive pass fog should be black
ZWrite Off
ZTest LEqual
CGPROGRAM
#pragma target 3.0
// -------------------------------------
#pragma shader_feature _NORMALMAP
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
#pragma shader_feature _METALLICGLOSSMAP
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
#pragma shader_feature ___ _DETAIL_MULX2
#pragma shader_feature _PARALLAXMAP
#pragma multi_compile_fwdadd_fullshadows
#pragma multi_compile_fog
#pragma vertex vertAdd
#pragma fragment fragAdd
#include "UnityStandardCoreForward.cginc"
ENDCG
}
// ------------------------------------------------------------------
// Shadow rendering pass
Pass {
Name "ShadowCaster"
Tags { "LightMode" = "ShadowCaster" }
ZWrite On ZTest LEqual
CGPROGRAM
#pragma target 3.0
// -------------------------------------
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
#pragma shader_feature _METALLICGLOSSMAP
#pragma shader_feature _PARALLAXMAP
#pragma multi_compile_shadowcaster
#pragma multi_compile_instancing
#pragma vertex vertShadowCaster
#pragma fragment fragShadowCaster
#include "UnityStandardShadow.cginc"
ENDCG
}
// ------------------------------------------------------------------
// Deferred pass
Pass
{
Name "DEFERRED"
Tags { "LightMode" = "Deferred" }
CGPROGRAM
#pragma target 3.0
#pragma exclude_renderers nomrt
// -------------------------------------
#pragma shader_feature _NORMALMAP
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
#pragma shader_feature _EMISSION
#pragma shader_feature _METALLICGLOSSMAP
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
#pragma shader_feature ___ _DETAIL_MULX2
#pragma shader_feature _PARALLAXMAP
#pragma multi_compile_prepassfinal
#pragma multi_compile_instancing
#pragma vertex vertDeferred
#pragma fragment fragDeferred
#include "UnityStandardCore.cginc"
ENDCG
}
// ------------------------------------------------------------------
// Extracts information for lightmapping, GI (emission, albedo, ...)
// This pass it not used during regular rendering.
Pass
{
Name "META"
Tags { "LightMode"="Meta" }
Cull Off
CGPROGRAM
#pragma vertex vert_meta
#pragma fragment frag_meta
#pragma shader_feature _EMISSION
#pragma shader_feature _METALLICGLOSSMAP
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature ___ _DETAIL_MULX2
#pragma shader_feature EDITOR_VISUALIZATION
#include "UnityStandardMeta.cginc"
ENDCG
}
}
SubShader
{
Tags { "RenderType"="Opaque" "PerformanceChecks"="False" }
LOD 150
// ------------------------------------------------------------------
// Base forward pass (directional light, emission, lightmaps, ...)
Pass
{
Name "FORWARD"
Tags { "LightMode" = "ForwardBase" }
Blend [_SrcBlend] [_DstBlend]
ZWrite [_ZWrite]
CGPROGRAM
#pragma target 2.0
#pragma shader_feature _NORMALMAP
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
#pragma shader_feature _EMISSION
#pragma shader_feature _METALLICGLOSSMAP
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
#pragma shader_feature _ _GLOSSYREFLECTIONS_OFF
// SM2.0: NOT SUPPORTED shader_feature ___ _DETAIL_MULX2
// SM2.0: NOT SUPPORTED shader_feature _PARALLAXMAP
#pragma skip_variants SHADOWS_SOFT DIRLIGHTMAP_COMBINED
#pragma multi_compile_fwdbase
#pragma multi_compile_fog
#pragma vertex vertBase
#pragma fragment fragBase
#include "UnityStandardCoreForward.cginc"
ENDCG
}
// ------------------------------------------------------------------
// Additive forward pass (one light per pass)
Pass
{
Name "FORWARD_DELTA"
Tags { "LightMode" = "ForwardAdd" }
Blend [_SrcBlend] One
Fog { Color (0,0,0,0) } // in additive pass fog should be black
ZWrite Off
ZTest LEqual
CGPROGRAM
#pragma target 2.0
#pragma shader_feature _NORMALMAP
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
#pragma shader_feature _METALLICGLOSSMAP
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
#pragma shader_feature ___ _DETAIL_MULX2
// SM2.0: NOT SUPPORTED shader_feature _PARALLAXMAP
#pragma skip_variants SHADOWS_SOFT
#pragma multi_compile_fwdadd_fullshadows
#pragma multi_compile_fog
#pragma vertex vertAdd
#pragma fragment fragAdd
#include "UnityStandardCoreForward.cginc"
ENDCG
}
// ------------------------------------------------------------------
// Shadow rendering pass
Pass {
Name "ShadowCaster"
Tags { "LightMode" = "ShadowCaster" }
ZWrite On ZTest LEqual
CGPROGRAM
#pragma target 2.0
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
#pragma shader_feature _METALLICGLOSSMAP
#pragma skip_variants SHADOWS_SOFT
#pragma multi_compile_shadowcaster
#pragma vertex vertShadowCaster
#pragma fragment fragShadowCaster
#include "UnityStandardShadow.cginc"
ENDCG
}
// ------------------------------------------------------------------
// Extracts information for lightmapping, GI (emission, albedo, ...)
// This pass it not used during regular rendering.
Pass
{
Name "META"
Tags { "LightMode"="Meta" }
Cull Off
CGPROGRAM
#pragma vertex vert_meta
#pragma fragment frag_meta
#pragma shader_feature _EMISSION
#pragma shader_feature _METALLICGLOSSMAP
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature ___ _DETAIL_MULX2
#pragma shader_feature EDITOR_VISUALIZATION
#include "UnityStandardMeta.cginc"
ENDCG
}
}
FallBack "VertexLit"
CustomEditor "StandardShaderGUI"
}

9
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/Standard.shader.meta


fileFormatVersion: 2
guid: b262af00aeb504b0a8eba68d77150908
timeCreated: 1490056886
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

335
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/StandardSpecular.shader


Shader "Standard-SRP (Specular setup)"
{
Properties
{
_Color("Color", Color) = (1,1,1,1)
_MainTex("Albedo", 2D) = "white" {}
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
_Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5
_GlossMapScale("Smoothness Factor", Range(0.0, 1.0)) = 1.0
[Enum(Specular Alpha,0,Albedo Alpha,1)] _SmoothnessTextureChannel ("Smoothness texture channel", Float) = 0
_SpecColor("Specular", Color) = (0.2,0.2,0.2)
_SpecGlossMap("Specular", 2D) = "white" {}
[ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0
[ToggleOff] _GlossyReflections("Glossy Reflections", Float) = 1.0
_BumpScale("Scale", Float) = 1.0
_BumpMap("Normal Map", 2D) = "bump" {}
_Parallax ("Height Scale", Range (0.005, 0.08)) = 0.02
_ParallaxMap ("Height Map", 2D) = "black" {}
_OcclusionStrength("Strength", Range(0.0, 1.0)) = 1.0
_OcclusionMap("Occlusion", 2D) = "white" {}
_EmissionColor("Color", Color) = (0,0,0)
_EmissionMap("Emission", 2D) = "white" {}
_DetailMask("Detail Mask", 2D) = "white" {}
_DetailAlbedoMap("Detail Albedo x2", 2D) = "grey" {}
_DetailNormalMapScale("Scale", Float) = 1.0
_DetailNormalMap("Normal Map", 2D) = "bump" {}
[Enum(UV0,0,UV1,1)] _UVSec ("UV Set for secondary textures", Float) = 0
// Blending state
[HideInInspector] _Mode ("__mode", Float) = 0.0
[HideInInspector] _SrcBlend ("__src", Float) = 1.0
[HideInInspector] _DstBlend ("__dst", Float) = 0.0
[HideInInspector] _ZWrite ("__zw", Float) = 1.0
}
CGINCLUDE
#define UNITY_SETUP_BRDF_INPUT SpecularSetup
ENDCG
SubShader
{
Tags { "RenderType"="Opaque" "PerformanceChecks"="False" }
LOD 300
// ------------------------------------------------------------------
// Base forward pass (directional light, emission, lightmaps, ...)
Pass
{
Name "FORWARD"
Tags { "LightMode" = "ForwardBase" }
Blend [_SrcBlend] [_DstBlend]
ZWrite [_ZWrite]
CGPROGRAM
#pragma target 3.0
// -------------------------------------
#pragma shader_feature _NORMALMAP
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
#pragma shader_feature _EMISSION
#pragma shader_feature _SPECGLOSSMAP
#pragma shader_feature ___ _DETAIL_MULX2
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
#pragma shader_feature _ _GLOSSYREFLECTIONS_OFF
#pragma shader_feature _PARALLAXMAP
#pragma multi_compile_fwdbase
#pragma multi_compile_fog
#pragma multi_compile_instancing
#pragma vertex vertBase
#pragma fragment fragBase
#include "UnityStandardCoreForward.cginc"
ENDCG
}
// ------------------------------------------------------------------
// Additive forward pass (one light per pass)
Pass
{
Name "FORWARD_DELTA"
Tags { "LightMode" = "ForwardAdd" }
Blend [_SrcBlend] One
Fog { Color (0,0,0,0) } // in additive pass fog should be black
ZWrite Off
ZTest LEqual
CGPROGRAM
#pragma target 3.0
// -------------------------------------
#pragma shader_feature _NORMALMAP
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
#pragma shader_feature _SPECGLOSSMAP
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
#pragma shader_feature ___ _DETAIL_MULX2
#pragma shader_feature _PARALLAXMAP
#pragma multi_compile_fwdadd_fullshadows
#pragma multi_compile_fog
#pragma vertex vertAdd
#pragma fragment fragAdd
#include "UnityStandardCoreForward.cginc"
ENDCG
}
// ------------------------------------------------------------------
// Shadow rendering pass
Pass {
Name "ShadowCaster"
Tags { "LightMode" = "ShadowCaster" }
ZWrite On ZTest LEqual
CGPROGRAM
#pragma target 3.0
// -------------------------------------
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
#pragma shader_feature _SPECGLOSSMAP
#pragma shader_feature _PARALLAXMAP
#pragma multi_compile_shadowcaster
#pragma multi_compile_instancing
#pragma vertex vertShadowCaster
#pragma fragment fragShadowCaster
#include "UnityStandardShadow.cginc"
ENDCG
}
// ------------------------------------------------------------------
// Deferred pass
Pass
{
Name "DEFERRED"
Tags { "LightMode" = "Deferred" }
CGPROGRAM
#pragma target 3.0
#pragma exclude_renderers nomrt
//#pragma debug
// -------------------------------------
#pragma shader_feature _NORMALMAP
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
#pragma shader_feature _EMISSION
#pragma shader_feature _SPECGLOSSMAP
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
#pragma shader_feature ___ _DETAIL_MULX2
#pragma shader_feature _PARALLAXMAP
#pragma multi_compile_prepassfinal
#pragma multi_compile_instancing
#pragma vertex vertDeferred
#pragma fragment fragDeferred
#include "UnityStandardCore.cginc"
ENDCG
}
// ------------------------------------------------------------------
// Extracts information for lightmapping, GI (emission, albedo, ...)
// This pass it not used during regular rendering.
Pass
{
Name "META"
Tags { "LightMode"="Meta" }
Cull Off
CGPROGRAM
#pragma vertex vert_meta
#pragma fragment frag_meta
#pragma shader_feature _EMISSION
#pragma shader_feature _SPECGLOSSMAP
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature ___ _DETAIL_MULX2
#pragma shader_feature EDITOR_VISUALIZATION
#include "UnityStandardMeta.cginc"
ENDCG
}
}
SubShader
{
Tags { "RenderType"="Opaque" "PerformanceChecks"="False" }
LOD 150
// ------------------------------------------------------------------
// Base forward pass (directional light, emission, lightmaps, ...)
Pass
{
Name "FORWARD"
Tags { "LightMode" = "ForwardBase" }
Blend [_SrcBlend] [_DstBlend]
ZWrite [_ZWrite]
CGPROGRAM
#pragma target 2.0
#pragma shader_feature _NORMALMAP
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
#pragma shader_feature _EMISSION
#pragma shader_feature _SPECGLOSSMAP
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
#pragma shader_feature _ _GLOSSYREFLECTIONS_OFF
#pragma shader_feature ___ _DETAIL_MULX2
// SM2.0: NOT SUPPORTED shader_feature _PARALLAXMAP
#pragma skip_variants SHADOWS_SOFT DYNAMICLIGHTMAP_ON DIRLIGHTMAP_COMBINED
#pragma multi_compile_fwdbase
#pragma multi_compile_fog
#pragma vertex vertBase
#pragma fragment fragBase
#include "UnityStandardCoreForward.cginc"
ENDCG
}
// ------------------------------------------------------------------
// Additive forward pass (one light per pass)
Pass
{
Name "FORWARD_DELTA"
Tags { "LightMode" = "ForwardAdd" }
Blend [_SrcBlend] One
Fog { Color (0,0,0,0) } // in additive pass fog should be black
ZWrite Off
ZTest LEqual
CGPROGRAM
#pragma target 2.0
#pragma shader_feature _NORMALMAP
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
#pragma shader_feature _SPECGLOSSMAP
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
#pragma shader_feature ___ _DETAIL_MULX2
// SM2.0: NOT SUPPORTED shader_feature _PARALLAXMAP
#pragma skip_variants SHADOWS_SOFT
#pragma multi_compile_fwdadd_fullshadows
#pragma multi_compile_fog
#pragma vertex vertAdd
#pragma fragment fragAdd
#include "UnityStandardCoreForward.cginc"
ENDCG
}
// ------------------------------------------------------------------
// Shadow rendering pass
Pass {
Name "ShadowCaster"
Tags { "LightMode" = "ShadowCaster" }
ZWrite On ZTest LEqual
CGPROGRAM
#pragma target 2.0
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
#pragma shader_feature _SPECGLOSSMAP
#pragma skip_variants SHADOWS_SOFT
#pragma multi_compile_shadowcaster
#pragma vertex vertShadowCaster
#pragma fragment fragShadowCaster
#include "UnityStandardShadow.cginc"
ENDCG
}
// ------------------------------------------------------------------
// Extracts information for lightmapping, GI (emission, albedo, ...)
// This pass it not used during regular rendering.
Pass
{
Name "META"
Tags { "LightMode"="Meta" }
Cull Off
CGPROGRAM
#pragma vertex vert_meta
#pragma fragment frag_meta
#pragma shader_feature _EMISSION
#pragma shader_feature _SPECGLOSSMAP
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature ___ _DETAIL_MULX2
#pragma shader_feature EDITOR_VISUALIZATION
#include "UnityStandardMeta.cginc"
ENDCG
}
}
FallBack "VertexLit"
CustomEditor "StandardShaderGUI"
}

9
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/StandardSpecular.shader.meta


fileFormatVersion: 2
guid: 078f6d0e0964240c28f6acc911996f11
timeCreated: 1490056884
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

203
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/UnityDeferredLibrary.cginc


#ifndef UNITY_DEFERRED_LIBRARY_INCLUDED
#define UNITY_DEFERRED_LIBRARY_INCLUDED
// Deferred lighting / shading helpers
// --------------------------------------------------------
// Vertex shader
struct unity_v2f_deferred {
float4 pos : SV_POSITION;
float4 uv : TEXCOORD0;
float3 ray : TEXCOORD1;
};
float _LightAsQuad;
unity_v2f_deferred vert_deferred (float4 vertex : POSITION, float3 normal : NORMAL)
{
unity_v2f_deferred o;
o.pos = UnityObjectToClipPos(vertex);
o.uv = ComputeScreenPos(o.pos);
o.ray = UnityObjectToViewPos(vertex) * float3(-1,-1,1);
// normal contains a ray pointing from the camera to one of near plane's
// corners in camera space when we are drawing a full screen quad.
// Otherwise, when rendering 3D shapes, use the ray calculated here.
o.ray = lerp(o.ray, normal, _LightAsQuad);
return o;
}
// --------------------------------------------------------
// Shared uniforms
UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
float4 _LightDir;
float4 _LightPos;
float4 _LightColor;
float4 unity_LightmapFade;
float4x4 unity_WorldToLight;
sampler2D_float _LightTextureB0;
#if defined (POINT_COOKIE)
samplerCUBE _LightTexture0;
#else
sampler2D _LightTexture0;
#endif
#if defined (SHADOWS_SCREEN)
sampler2D _ShadowMapTexture;
#endif
#if defined (SHADOWS_SHADOWMASK)
sampler2D _CameraGBufferTexture4;
#endif
// --------------------------------------------------------
// Shadow/fade helpers
#include "UnityShadowLibrary.cginc"
//Note :
// SHADOWS_SHADOWMASK + LIGHTMAP_SHADOW_MIXING -> ShadowMask mode
// SHADOWS_SHADOWMASK only -> Distance shadowmask mode
// --------------------------------------------------------
half UnityDeferredSampleShadowMask(float2 uv)
{
half shadowMaskAttenuation = 1.0f;
#if defined (SHADOWS_SHADOWMASK)
half4 shadowMask = tex2D(_CameraGBufferTexture4, uv);
shadowMaskAttenuation = saturate(dot(shadowMask, unity_OcclusionMaskSelector));
#endif
return shadowMaskAttenuation;
}
// --------------------------------------------------------
half UnityDeferredSampleRealtimeShadow(half fade, float3 vec, float2 uv)
{
half shadowAttenuation = 1.0f;
#if defined (DIRECTIONAL) || defined (DIRECTIONAL_COOKIE)
#if defined(SHADOWS_SCREEN)
shadowAttenuation = tex2D(_ShadowMapTexture, uv).r;
#endif
#endif
#if defined(UNITY_FAST_COHERENT_DYNAMIC_BRANCHING) && defined(SHADOWS_SOFT) && !defined(LIGHTMAP_SHADOW_MIXING)
//avoid expensive shadows fetches in the distance where coherency will be good
UNITY_BRANCH
if (fade < (1.0f - 1e-2f))
{
#endif
#if defined(SPOT)
#if defined(SHADOWS_DEPTH)
float4 shadowCoord = mul(unity_WorldToShadow[0], float4(vec, 1));
shadowAttenuation = UnitySampleShadowmap(shadowCoord);
#endif
#endif
#if defined (POINT) || defined (POINT_COOKIE)
#if defined(SHADOWS_CUBE)
shadowAttenuation = UnitySampleShadowmap(vec);
#endif
#endif
#if defined(UNITY_FAST_COHERENT_DYNAMIC_BRANCHING) && defined(SHADOWS_SOFT) && !defined(LIGHTMAP_SHADOW_MIXING)
}
#endif
return shadowAttenuation;
}
// --------------------------------------------------------
half UnityDeferredComputeShadow(float3 vec, float fadeDist, float2 uv)
{
half fade = UnityComputeShadowFade(fadeDist);
half shadowMaskAttenuation = UnityDeferredSampleShadowMask(uv);
half realtimeShadowAttenuation = UnityDeferredSampleRealtimeShadow(fade, vec, uv);
return UnityMixRealtimeAndBakedShadows(realtimeShadowAttenuation, shadowMaskAttenuation, fade);
}
// --------------------------------------------------------
// Common lighting data calculation (direction, attenuation, ...)
void UnityDeferredCalculateLightParams (
unity_v2f_deferred i,
out float3 outWorldPos,
out float2 outUV,
out half3 outLightDir,
out float outAtten,
out float outFadeDist)
{
i.ray = i.ray * (_ProjectionParams.z / i.ray.z);
float2 uv = i.uv.xy / i.uv.w;
// read depth and reconstruct world position
float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv);
depth = Linear01Depth (depth);
float4 vpos = float4(i.ray * depth,1);
float3 wpos = mul (unity_CameraToWorld, vpos).xyz;
float fadeDist = UnityComputeShadowFadeDistance(wpos, vpos.z);
// spot light case
#if defined (SPOT)
float3 tolight = _LightPos.xyz - wpos;
half3 lightDir = normalize (tolight);
float4 uvCookie = mul (unity_WorldToLight, float4(wpos,1));
// negative bias because http://aras-p.info/blog/2010/01/07/screenspace-vs-mip-mapping/
float atten = tex2Dbias (_LightTexture0, float4(uvCookie.xy / uvCookie.w, 0, -8)).w;
atten *= uvCookie.w < 0;
float att = dot(tolight, tolight) * _LightPos.w;
atten *= tex2D (_LightTextureB0, att.rr).UNITY_ATTEN_CHANNEL;
atten *= UnityDeferredComputeShadow (wpos, fadeDist, uv);
// directional light case
#elif defined (DIRECTIONAL) || defined (DIRECTIONAL_COOKIE)
half3 lightDir = -_LightDir.xyz;
float atten = 1.0;
atten *= UnityDeferredComputeShadow (wpos, fadeDist, uv);
#if defined (DIRECTIONAL_COOKIE)
atten *= tex2Dbias (_LightTexture0, float4(mul(unity_WorldToLight, half4(wpos,1)).xy, 0, -8)).w;
#endif //DIRECTIONAL_COOKIE
// point light case
#elif defined (POINT) || defined (POINT_COOKIE)
float3 tolight = wpos - _LightPos.xyz;
half3 lightDir = -normalize (tolight);
float att = dot(tolight, tolight) * _LightPos.w;
float atten = tex2D (_LightTextureB0, att.rr).UNITY_ATTEN_CHANNEL;
atten *= UnityDeferredComputeShadow (tolight, fadeDist, uv);
#if defined (POINT_COOKIE)
atten *= texCUBEbias(_LightTexture0, float4(mul(unity_WorldToLight, half4(wpos,1)).xyz, -8)).w;
#endif //POINT_COOKIE
#else
half3 lightDir = 0;
float atten = 0;
#endif
outWorldPos = wpos;
outUV = uv;
outLightDir = lightDir;
outAtten = atten;
outFadeDist = fadeDist;
}
#endif // UNITY_DEFERRED_LIBRARY_INCLUDED

9
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/UnityDeferredLibrary.cginc.meta


fileFormatVersion: 2
guid: ffafa3f1eadad4fa590822cfd911cd00
timeCreated: 1490056564
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

693
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/UnityStandardCore.cginc


#ifndef UNITY_STANDARD_CORE_INCLUDED
#define UNITY_STANDARD_CORE_INCLUDED
#include "UnityCG.cginc"
#include "UnityShaderVariables.cginc"
#include "UnityInstancing.cginc"
#include "UnityStandardConfig.cginc"
#include "UnityStandardInput.cginc"
#include "UnityPBSLighting.cginc"
#include "UnityStandardUtils.cginc"
#include "UnityGBuffer.cginc"
#include "UnityStandardBRDF.cginc"
#include "AutoLight.cginc"
//-------------------------------------------------------------------------------------
// counterpart for NormalizePerPixelNormal
// skips normalization per-vertex and expects normalization to happen per-pixel
half3 NormalizePerVertexNormal (float3 n) // takes float to avoid overflow
{
#if (SHADER_TARGET < 30) || UNITY_STANDARD_SIMPLE
return normalize(n);
#else
return n; // will normalize per-pixel instead
#endif
}
half3 NormalizePerPixelNormal (half3 n)
{
#if (SHADER_TARGET < 30) || UNITY_STANDARD_SIMPLE
return n;
#else
return normalize(n);
#endif
}
//-------------------------------------------------------------------------------------
UnityLight MainLight ()
{
UnityLight l;
l.color = _LightColor0.rgb;
l.dir = _WorldSpaceLightPos0.xyz;
return l;
}
UnityLight AdditiveLight (half3 lightDir, half atten)
{
UnityLight l;
l.color = _LightColor0.rgb;
l.dir = lightDir;
#ifndef USING_DIRECTIONAL_LIGHT
l.dir = NormalizePerPixelNormal(l.dir);
#endif
// shadow the light
l.color *= atten;
return l;
}
UnityLight DummyLight ()
{
UnityLight l;
l.color = 0;
l.dir = half3 (0,1,0);
return l;
}
UnityIndirect ZeroIndirect ()
{
UnityIndirect ind;
ind.diffuse = 0;
ind.specular = 0;
return ind;
}
//-------------------------------------------------------------------------------------
// Common fragment setup
// deprecated
half3 WorldNormal(half4 tan2world[3])
{
return normalize(tan2world[2].xyz);
}
// deprecated
#ifdef _TANGENT_TO_WORLD
half3x3 ExtractTangentToWorldPerPixel(half4 tan2world[3])
{
half3 t = tan2world[0].xyz;
half3 b = tan2world[1].xyz;
half3 n = tan2world[2].xyz;
#if UNITY_TANGENT_ORTHONORMALIZE
n = NormalizePerPixelNormal(n);
// ortho-normalize Tangent
t = normalize (t - n * dot(t, n));
// recalculate Binormal
half3 newB = cross(n, t);
b = newB * sign (dot (newB, b));
#endif
return half3x3(t, b, n);
}
#else
half3x3 ExtractTangentToWorldPerPixel(half4 tan2world[3])
{
return half3x3(0,0,0,0,0,0,0,0,0);
}
#endif
half3 PerPixelWorldNormal(float4 i_tex, half4 tangentToWorld[3])
{
#ifdef _NORMALMAP
half3 tangent = tangentToWorld[0].xyz;
half3 binormal = tangentToWorld[1].xyz;
half3 normal = tangentToWorld[2].xyz;
#if UNITY_TANGENT_ORTHONORMALIZE
normal = NormalizePerPixelNormal(normal);
// ortho-normalize Tangent
tangent = normalize (tangent - normal * dot(tangent, normal));
// recalculate Binormal
half3 newB = cross(normal, tangent);
binormal = newB * sign (dot (newB, binormal));
#endif
half3 normalTangent = NormalInTangentSpace(i_tex);
half3 normalWorld = NormalizePerPixelNormal(tangent * normalTangent.x + binormal * normalTangent.y + normal * normalTangent.z); // @TODO: see if we can squeeze this normalize on SM2.0 as well
#else
half3 normalWorld = normalize(tangentToWorld[2].xyz);
#endif
return normalWorld;
}
#ifdef _PARALLAXMAP
#define IN_VIEWDIR4PARALLAX(i) NormalizePerPixelNormal(half3(i.tangentToWorldAndPackedData[0].w,i.tangentToWorldAndPackedData[1].w,i.tangentToWorldAndPackedData[2].w))
#define IN_VIEWDIR4PARALLAX_FWDADD(i) NormalizePerPixelNormal(i.viewDirForParallax.xyz)
#else
#define IN_VIEWDIR4PARALLAX(i) half3(0,0,0)
#define IN_VIEWDIR4PARALLAX_FWDADD(i) half3(0,0,0)
#endif
#if UNITY_REQUIRE_FRAG_WORLDPOS
#if UNITY_PACK_WORLDPOS_WITH_TANGENT
#define IN_WORLDPOS(i) half3(i.tangentToWorldAndPackedData[0].w,i.tangentToWorldAndPackedData[1].w,i.tangentToWorldAndPackedData[2].w)
#else
#define IN_WORLDPOS(i) i.posWorld
#endif
#define IN_WORLDPOS_FWDADD(i) i.posWorld
#else
#define IN_WORLDPOS(i) half3(0,0,0)
#define IN_WORLDPOS_FWDADD(i) half3(0,0,0)
#endif
#define IN_LIGHTDIR_FWDADD(i) half3(i.tangentToWorldAndLightDir[0].w, i.tangentToWorldAndLightDir[1].w, i.tangentToWorldAndLightDir[2].w)
#define FRAGMENT_SETUP(x) FragmentCommonData x = \
FragmentSetup(i.tex, i.eyeVec, IN_VIEWDIR4PARALLAX(i), i.tangentToWorldAndPackedData, IN_WORLDPOS(i));
#define FRAGMENT_SETUP_FWDADD(x) FragmentCommonData x = \
FragmentSetup(i.tex, i.eyeVec, IN_VIEWDIR4PARALLAX_FWDADD(i), i.tangentToWorldAndLightDir, IN_WORLDPOS_FWDADD(i));
struct FragmentCommonData
{
half3 diffColor, specColor;
// Note: smoothness & oneMinusReflectivity for optimization purposes, mostly for DX9 SM2.0 level.
// Most of the math is being done on these (1-x) values, and that saves a few precious ALU slots.
half oneMinusReflectivity, smoothness;
half3 normalWorld, eyeVec, posWorld;
half alpha;
#if UNITY_STANDARD_SIMPLE
half3 reflUVW;
#endif
#if UNITY_STANDARD_SIMPLE
half3 tangentSpaceNormal;
#endif
};
#ifndef UNITY_SETUP_BRDF_INPUT
#define UNITY_SETUP_BRDF_INPUT SpecularSetup
#endif
inline FragmentCommonData SpecularSetup (float4 i_tex)
{
half4 specGloss = SpecularGloss(i_tex.xy);
half3 specColor = specGloss.rgb;
half smoothness = specGloss.a;
half oneMinusReflectivity;
half3 diffColor = EnergyConservationBetweenDiffuseAndSpecular (Albedo(i_tex), specColor, /*out*/ oneMinusReflectivity);
FragmentCommonData o = (FragmentCommonData)0;
o.diffColor = diffColor;
o.specColor = specColor;
o.oneMinusReflectivity = oneMinusReflectivity;
o.smoothness = smoothness;
return o;
}
inline FragmentCommonData MetallicSetup (float4 i_tex)
{
half2 metallicGloss = MetallicGloss(i_tex.xy);
half metallic = metallicGloss.x;
half smoothness = metallicGloss.y; // this is 1 minus the square root of real roughness m.
half oneMinusReflectivity;
half3 specColor;
half3 diffColor = DiffuseAndSpecularFromMetallic (Albedo(i_tex), metallic, /*out*/ specColor, /*out*/ oneMinusReflectivity);
FragmentCommonData o = (FragmentCommonData)0;
o.diffColor = diffColor;
o.specColor = specColor;
o.oneMinusReflectivity = oneMinusReflectivity;
o.smoothness = smoothness;
return o;
}
inline FragmentCommonData FragmentSetup (float4 i_tex, half3 i_eyeVec, half3 i_viewDirForParallax, half4 tangentToWorld[3], half3 i_posWorld)
{
i_tex = Parallax(i_tex, i_viewDirForParallax);
half alpha = Alpha(i_tex.xy);
#if defined(_ALPHATEST_ON)
clip (alpha - _Cutoff);
#endif
FragmentCommonData o = UNITY_SETUP_BRDF_INPUT (i_tex);
o.normalWorld = PerPixelWorldNormal(i_tex, tangentToWorld);
o.eyeVec = NormalizePerPixelNormal(i_eyeVec);
o.posWorld = i_posWorld;
// NOTE: shader relies on pre-multiply alpha-blend (_SrcBlend = One, _DstBlend = OneMinusSrcAlpha)
o.diffColor = PreMultiplyAlpha (o.diffColor, alpha, o.oneMinusReflectivity, /*out*/ o.alpha);
return o;
}
inline UnityGI FragmentGI (FragmentCommonData s, half occlusion, half4 i_ambientOrLightmapUV, half atten, UnityLight light, bool reflections)
{
UnityGIInput d;
d.light = light;
d.worldPos = s.posWorld;
d.worldViewDir = -s.eyeVec;
d.atten = atten;
#if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
d.ambient = 0;
d.lightmapUV = i_ambientOrLightmapUV;
#else
d.ambient = i_ambientOrLightmapUV.rgb;
d.lightmapUV = 0;
#endif
d.probeHDR[0] = unity_SpecCube0_HDR;
d.probeHDR[1] = unity_SpecCube1_HDR;
#if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION)
d.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending
#endif
#ifdef UNITY_SPECCUBE_BOX_PROJECTION
d.boxMax[0] = unity_SpecCube0_BoxMax;
d.probePosition[0] = unity_SpecCube0_ProbePosition;
d.boxMax[1] = unity_SpecCube1_BoxMax;
d.boxMin[1] = unity_SpecCube1_BoxMin;
d.probePosition[1] = unity_SpecCube1_ProbePosition;
#endif
if(reflections)
{
Unity_GlossyEnvironmentData g = UnityGlossyEnvironmentSetup(s.smoothness, -s.eyeVec, s.normalWorld, s.specColor);
// Replace the reflUVW if it has been compute in Vertex shader. Note: the compiler will optimize the calcul in UnityGlossyEnvironmentSetup itself
#if UNITY_STANDARD_SIMPLE
g.reflUVW = s.reflUVW;
#endif
return UnityGlobalIllumination (d, occlusion, s.normalWorld, g);
}
else
{
return UnityGlobalIllumination (d, occlusion, s.normalWorld);
}
}
inline UnityGI FragmentGI (FragmentCommonData s, half occlusion, half4 i_ambientOrLightmapUV, half atten, UnityLight light)
{
return FragmentGI(s, occlusion, i_ambientOrLightmapUV, atten, light, true);
}
//-------------------------------------------------------------------------------------
half4 OutputForward (half4 output, half alphaFromSurface)
{
#if defined(_ALPHABLEND_ON) || defined(_ALPHAPREMULTIPLY_ON)
output.a = alphaFromSurface;
#else
UNITY_OPAQUE_ALPHA(output.a);
#endif
return output;
}
inline half4 VertexGIForward(VertexInput v, float3 posWorld, half3 normalWorld)
{
half4 ambientOrLightmapUV = 0;
// Static lightmaps
#ifdef LIGHTMAP_ON
ambientOrLightmapUV.xy = v.uv1.xy * unity_LightmapST.xy + unity_LightmapST.zw;
ambientOrLightmapUV.zw = 0;
// Sample light probe for Dynamic objects only (no static or dynamic lightmaps)
#elif UNITY_SHOULD_SAMPLE_SH
#ifdef VERTEXLIGHT_ON
// Approximated illumination from non-important point lights
ambientOrLightmapUV.rgb = Shade4PointLights (
unity_4LightPosX0, unity_4LightPosY0, unity_4LightPosZ0,
unity_LightColor[0].rgb, unity_LightColor[1].rgb, unity_LightColor[2].rgb, unity_LightColor[3].rgb,
unity_4LightAtten0, posWorld, normalWorld);
#endif
ambientOrLightmapUV.rgb = ShadeSHPerVertex (normalWorld, ambientOrLightmapUV.rgb);
#endif
#ifdef DYNAMICLIGHTMAP_ON
ambientOrLightmapUV.zw = v.uv2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
#endif
return ambientOrLightmapUV;
}
// ------------------------------------------------------------------
// Base forward pass (directional light, emission, lightmaps, ...)
struct VertexOutputForwardBase
{
float4 pos : SV_POSITION;
float4 tex : TEXCOORD0;
half3 eyeVec : TEXCOORD1;
half4 tangentToWorldAndPackedData[3] : TEXCOORD2; // [3x3:tangentToWorld | 1x3:viewDirForParallax or worldPos]
half4 ambientOrLightmapUV : TEXCOORD5; // SH or Lightmap UV
UNITY_SHADOW_COORDS(6)
UNITY_FOG_COORDS(7)
// next ones would not fit into SM2.0 limits, but they are always for SM3.0+
#if UNITY_REQUIRE_FRAG_WORLDPOS && !UNITY_PACK_WORLDPOS_WITH_TANGENT
float3 posWorld : TEXCOORD8;
#endif
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
VertexOutputForwardBase vertForwardBase (VertexInput v)
{
UNITY_SETUP_INSTANCE_ID(v);
VertexOutputForwardBase o;
UNITY_INITIALIZE_OUTPUT(VertexOutputForwardBase, o);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
float4 posWorld = mul(unity_ObjectToWorld, v.vertex);
#if UNITY_REQUIRE_FRAG_WORLDPOS
#if UNITY_PACK_WORLDPOS_WITH_TANGENT
o.tangentToWorldAndPackedData[0].w = posWorld.x;
o.tangentToWorldAndPackedData[1].w = posWorld.y;
o.tangentToWorldAndPackedData[2].w = posWorld.z;
#else
o.posWorld = posWorld.xyz;
#endif
#endif
o.pos = UnityObjectToClipPos(v.vertex);
o.tex = TexCoords(v);
o.eyeVec = NormalizePerVertexNormal(posWorld.xyz - _WorldSpaceCameraPos);
float3 normalWorld = UnityObjectToWorldNormal(v.normal);
#ifdef _TANGENT_TO_WORLD
float4 tangentWorld = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w);
float3x3 tangentToWorld = CreateTangentToWorldPerVertex(normalWorld, tangentWorld.xyz, tangentWorld.w);
o.tangentToWorldAndPackedData[0].xyz = tangentToWorld[0];
o.tangentToWorldAndPackedData[1].xyz = tangentToWorld[1];
o.tangentToWorldAndPackedData[2].xyz = tangentToWorld[2];
#else
o.tangentToWorldAndPackedData[0].xyz = 0;
o.tangentToWorldAndPackedData[1].xyz = 0;
o.tangentToWorldAndPackedData[2].xyz = normalWorld;
#endif
//We need this for shadow receving
UNITY_TRANSFER_SHADOW(o, v.uv1);
o.ambientOrLightmapUV = VertexGIForward(v, posWorld, normalWorld);
#ifdef _PARALLAXMAP
TANGENT_SPACE_ROTATION;
half3 viewDirForParallax = mul (rotation, ObjSpaceViewDir(v.vertex));
o.tangentToWorldAndPackedData[0].w = viewDirForParallax.x;
o.tangentToWorldAndPackedData[1].w = viewDirForParallax.y;
o.tangentToWorldAndPackedData[2].w = viewDirForParallax.z;
#endif
UNITY_TRANSFER_FOG(o,o.pos);
return o;
}
half4 fragForwardBaseInternal (VertexOutputForwardBase i)
{
FRAGMENT_SETUP(s)
UNITY_SETUP_INSTANCE_ID(i);
UnityLight mainLight = MainLight ();
UNITY_LIGHT_ATTENUATION(atten, i, s.posWorld);
half occlusion = Occlusion(i.tex.xy);
UnityGI gi = FragmentGI (s, occlusion, i.ambientOrLightmapUV, atten, mainLight);
half4 c = UNITY_BRDF_PBS (s.diffColor, s.specColor, s.oneMinusReflectivity, s.smoothness, s.normalWorld, -s.eyeVec, gi.light, gi.indirect);
c.rgb += Emission(i.tex.xy);
UNITY_APPLY_FOG(i.fogCoord, c.rgb);
return OutputForward (c, s.alpha);
}
half4 fragForwardBase (VertexOutputForwardBase i) : SV_Target // backward compatibility (this used to be the fragment entry function)
{
return fragForwardBaseInternal(i);
}
// ------------------------------------------------------------------
// Additive forward pass (one light per pass)
struct VertexOutputForwardAdd
{
float4 pos : SV_POSITION;
float4 tex : TEXCOORD0;
half3 eyeVec : TEXCOORD1;
half4 tangentToWorldAndLightDir[3] : TEXCOORD2; // [3x3:tangentToWorld | 1x3:lightDir]
float3 posWorld : TEXCOORD5;
UNITY_SHADOW_COORDS(6)
UNITY_FOG_COORDS(7)
// next ones would not fit into SM2.0 limits, but they are always for SM3.0+
#if defined(_PARALLAXMAP)
half3 viewDirForParallax : TEXCOORD8;
#endif
UNITY_VERTEX_OUTPUT_STEREO
};
VertexOutputForwardAdd vertForwardAdd (VertexInput v)
{
VertexOutputForwardAdd o;
UNITY_INITIALIZE_OUTPUT(VertexOutputForwardAdd, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
float4 posWorld = mul(unity_ObjectToWorld, v.vertex);
o.pos = UnityObjectToClipPos(v.vertex);
o.tex = TexCoords(v);
o.eyeVec = NormalizePerVertexNormal(posWorld.xyz - _WorldSpaceCameraPos);
o.posWorld = posWorld.xyz;
float3 normalWorld = UnityObjectToWorldNormal(v.normal);
#ifdef _TANGENT_TO_WORLD
float4 tangentWorld = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w);
float3x3 tangentToWorld = CreateTangentToWorldPerVertex(normalWorld, tangentWorld.xyz, tangentWorld.w);
o.tangentToWorldAndLightDir[0].xyz = tangentToWorld[0];
o.tangentToWorldAndLightDir[1].xyz = tangentToWorld[1];
o.tangentToWorldAndLightDir[2].xyz = tangentToWorld[2];
#else
o.tangentToWorldAndLightDir[0].xyz = 0;
o.tangentToWorldAndLightDir[1].xyz = 0;
o.tangentToWorldAndLightDir[2].xyz = normalWorld;
#endif
//We need this for shadow receiving
UNITY_TRANSFER_SHADOW(o, v.uv1);
float3 lightDir = _WorldSpaceLightPos0.xyz - posWorld.xyz * _WorldSpaceLightPos0.w;
#ifndef USING_DIRECTIONAL_LIGHT
lightDir = NormalizePerVertexNormal(lightDir);
#endif
o.tangentToWorldAndLightDir[0].w = lightDir.x;
o.tangentToWorldAndLightDir[1].w = lightDir.y;
o.tangentToWorldAndLightDir[2].w = lightDir.z;
#ifdef _PARALLAXMAP
TANGENT_SPACE_ROTATION;
o.viewDirForParallax = mul (rotation, ObjSpaceViewDir(v.vertex));
#endif
UNITY_TRANSFER_FOG(o,o.pos);
return o;
}
half4 fragForwardAddInternal (VertexOutputForwardAdd i)
{
FRAGMENT_SETUP_FWDADD(s)
UNITY_LIGHT_ATTENUATION(atten, i, s.posWorld)
UnityLight light = AdditiveLight (IN_LIGHTDIR_FWDADD(i), atten);
UnityIndirect noIndirect = ZeroIndirect ();
half4 c = UNITY_BRDF_PBS (s.diffColor, s.specColor, s.oneMinusReflectivity, s.smoothness, s.normalWorld, -s.eyeVec, light, noIndirect);
UNITY_APPLY_FOG_COLOR(i.fogCoord, c.rgb, half4(0,0,0,0)); // fog towards black in additive pass
return OutputForward (c, s.alpha);
}
half4 fragForwardAdd (VertexOutputForwardAdd i) : SV_Target // backward compatibility (this used to be the fragment entry function)
{
return fragForwardAddInternal(i);
}
// ------------------------------------------------------------------
// Deferred pass
struct VertexOutputDeferred
{
float4 pos : SV_POSITION;
float4 tex : TEXCOORD0;
half3 eyeVec : TEXCOORD1;
half4 tangentToWorldAndPackedData[3]: TEXCOORD2; // [3x3:tangentToWorld | 1x3:viewDirForParallax or worldPos]
half4 ambientOrLightmapUV : TEXCOORD5; // SH or Lightmap UVs
#if UNITY_REQUIRE_FRAG_WORLDPOS && !UNITY_PACK_WORLDPOS_WITH_TANGENT
float3 posWorld : TEXCOORD6;
#endif
UNITY_VERTEX_OUTPUT_STEREO
};
VertexOutputDeferred vertDeferred (VertexInput v)
{
UNITY_SETUP_INSTANCE_ID(v);
VertexOutputDeferred o;
UNITY_INITIALIZE_OUTPUT(VertexOutputDeferred, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
float4 posWorld = mul(unity_ObjectToWorld, v.vertex);
#if UNITY_REQUIRE_FRAG_WORLDPOS
#if UNITY_PACK_WORLDPOS_WITH_TANGENT
o.tangentToWorldAndPackedData[0].w = posWorld.x;
o.tangentToWorldAndPackedData[1].w = posWorld.y;
o.tangentToWorldAndPackedData[2].w = posWorld.z;
#else
o.posWorld = posWorld.xyz;
#endif
#endif
o.pos = UnityObjectToClipPos(v.vertex);
o.tex = TexCoords(v);
o.eyeVec = NormalizePerVertexNormal(posWorld.xyz - _WorldSpaceCameraPos);
float3 normalWorld = UnityObjectToWorldNormal(v.normal);
#ifdef _TANGENT_TO_WORLD
float4 tangentWorld = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w);
float3x3 tangentToWorld = CreateTangentToWorldPerVertex(normalWorld, tangentWorld.xyz, tangentWorld.w);
o.tangentToWorldAndPackedData[0].xyz = tangentToWorld[0];
o.tangentToWorldAndPackedData[1].xyz = tangentToWorld[1];
o.tangentToWorldAndPackedData[2].xyz = tangentToWorld[2];
#else
o.tangentToWorldAndPackedData[0].xyz = 0;
o.tangentToWorldAndPackedData[1].xyz = 0;
o.tangentToWorldAndPackedData[2].xyz = normalWorld;
#endif
o.ambientOrLightmapUV = 0;
#ifdef LIGHTMAP_ON
o.ambientOrLightmapUV.xy = v.uv1.xy * unity_LightmapST.xy + unity_LightmapST.zw;
#elif UNITY_SHOULD_SAMPLE_SH
o.ambientOrLightmapUV.rgb = ShadeSHPerVertex (normalWorld, o.ambientOrLightmapUV.rgb);
#endif
#ifdef DYNAMICLIGHTMAP_ON
o.ambientOrLightmapUV.zw = v.uv2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
#endif
#ifdef _PARALLAXMAP
TANGENT_SPACE_ROTATION;
half3 viewDirForParallax = mul (rotation, ObjSpaceViewDir(v.vertex));
o.tangentToWorldAndPackedData[0].w = viewDirForParallax.x;
o.tangentToWorldAndPackedData[1].w = viewDirForParallax.y;
o.tangentToWorldAndPackedData[2].w = viewDirForParallax.z;
#endif
return o;
}
void fragDeferred (
VertexOutputDeferred i,
//in float inDepth : SV_Depth,
out half4 outGBuffer0 : SV_Target0,
out half4 outGBuffer1 : SV_Target1,
out half4 outGBuffer2 : SV_Target2,
out half4 outEmission : SV_Target3 // RT3: emission (rgb), --unused-- (a)
#if (UNITY_ALLOWED_MRT_COUNT > 4)
#if defined(UNITY_FRAMEBUFFER_FETCH_AVAILABLE)
,out float outDepth : SV_Target4 // RT4: zData (F32)
#elif defined(SHADOWS_SHADOWMASK)
,out half4 outShadowMask : SV_Target4 // RT4: shadowmask (rgba)
#endif
#endif
)
{
#if (SHADER_TARGET < 30)
outGBuffer0 = 1;
outGBuffer1 = 1;
outGBuffer2 = 0;
outEmission = 0;
#if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4)
outShadowMask = 1;
#endif
return;
#endif
FRAGMENT_SETUP(s)
// no analytic lights in this pass
UnityLight dummyLight = DummyLight ();
half atten = 1;
// only GI
half occlusion = Occlusion(i.tex.xy);
#if UNITY_ENABLE_REFLECTION_BUFFERS
bool sampleReflectionsInDeferred = false;
#else
bool sampleReflectionsInDeferred = true;
#endif
UnityGI gi = FragmentGI (s, occlusion, i.ambientOrLightmapUV, atten, dummyLight, sampleReflectionsInDeferred);
half3 emissiveColor = UNITY_BRDF_PBS (s.diffColor, s.specColor, s.oneMinusReflectivity, s.smoothness, s.normalWorld, -s.eyeVec, gi.light, gi.indirect).rgb;
#ifdef _EMISSION
emissiveColor += Emission (i.tex.xy);
#endif
#ifndef UNITY_HDR_ON
emissiveColor.rgb = exp2(-emissiveColor.rgb);
#endif
UnityStandardData data;
data.diffuseColor = s.diffColor;
data.occlusion = occlusion;
data.specularColor = s.specColor;
data.smoothness = s.smoothness;
data.normalWorld = s.normalWorld;
UnityStandardDataToGbuffer(data, outGBuffer0, outGBuffer1, outGBuffer2);
// Emissive lighting buffer
outEmission = half4(emissiveColor*0.0, 1);
// Baked direct lighting occlusion if any
#if (UNITY_ALLOWED_MRT_COUNT > 4)
#if defined(UNITY_FRAMEBUFFER_FETCH_AVAILABLE)
outDepth = i.pos.z;
#elif defined(SHADOWS_SHADOWMASK)
outShadowMask = UnityGetRawBakedOcclusions(i.ambientOrLightmapUV.xy, IN_WORLDPOS(i));
#endif
#endif
}
//
// Old FragmentGI signature. Kept only for backward compatibility and will be removed soon
//
inline UnityGI FragmentGI(
float3 posWorld,
half occlusion, half4 i_ambientOrLightmapUV, half atten, half smoothness, half3 normalWorld, half3 eyeVec,
UnityLight light,
bool reflections)
{
// we init only fields actually used
FragmentCommonData s = (FragmentCommonData)0;
s.smoothness = smoothness;
s.normalWorld = normalWorld;
s.eyeVec = eyeVec;
s.posWorld = posWorld;
return FragmentGI(s, occlusion, i_ambientOrLightmapUV, atten, light, reflections);
}
inline UnityGI FragmentGI (
float3 posWorld,
half occlusion, half4 i_ambientOrLightmapUV, half atten, half smoothness, half3 normalWorld, half3 eyeVec,
UnityLight light)
{
return FragmentGI (posWorld, occlusion, i_ambientOrLightmapUV, atten, smoothness, normalWorld, eyeVec, light, true);
}
#endif // UNITY_STANDARD_CORE_INCLUDED

9
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/UnityStandardCore.cginc.meta


fileFormatVersion: 2
guid: f031ebf7573824c49b7aa8406db0e3ce
timeCreated: 1490056564
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

29
Assets/TestScenes/MobileDeferredTest/ClassicDeferredPipeline.asset


%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: d22b2b0343c2d4b1586e009e1bb0a736, type: 3}
m_Name: ClassicDeferredPipeline
m_EditorClassIdentifier:
m_ShadowSettings:
enabled: 1
shadowAtlasWidth: 2048
shadowAtlasHeight: 2048
maxShadowDistance: 600
directionalLightCascadeCount: 4
directionalLightCascades: {x: 0, y: 0.05, z: 0.1}
directionalLightNearPlaneOffset: 5
m_PointLightMesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
m_SpotLightMesh: {fileID: 4300000, guid: 93e85ba57f65145538a8ac97bd005d40, type: 3}
m_QuadMesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
finalPassShader: {fileID: 4800000, guid: 5590f54ad211f594da4e687b698f2258, type: 3}
deferredShader: {fileID: 4800000, guid: eeee2c879e4754d958204f0816f646c7, type: 3}
deferredReflectionShader: {fileID: 4800000, guid: eabc0a21ba0ff47268d9a58c92b8b40b,
type: 3}
m_DefaultSpotCookie: {fileID: 2800000, guid: 32c4b9c8ddc1c5d49ac7d10122540447, type: 3}

9
Assets/TestScenes/MobileDeferredTest/ClassicDeferredPipeline.asset.meta


fileFormatVersion: 2
guid: b82519cc2833741caabd7ef92f39d4fa
timeCreated: 1490057013
licenseType: Pro
NativeFormatImporter:
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

430
Assets/TestScenes/MobileDeferredTest/ClassicDeferredTest.unity


%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, 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_PVRFiltering: 0
m_PVRFilteringMode: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousColorSigma: 1
m_PVRFilteringAtrousNormalSigma: 1
m_PVRFilteringAtrousPositionSigma: 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
m_NavMeshData: {fileID: 0}
--- !u!1 &95697982
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 95697987}
- component: {fileID: 95697986}
- component: {fileID: 95697985}
- component: {fileID: 95697984}
- component: {fileID: 95697983}
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 &95697983
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 95697982}
m_Enabled: 1
--- !u!124 &95697984
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 95697982}
m_Enabled: 1
--- !u!92 &95697985
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 95697982}
m_Enabled: 1
--- !u!20 &95697986
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 95697982}
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: 1000
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: 1
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
m_StereoMirrorMode: 0
--- !u!4 &95697987
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 95697982}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
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 &109823935
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 109823939}
- component: {fileID: 109823938}
- component: {fileID: 109823937}
- component: {fileID: 109823936}
m_Layer: 0
m_Name: Sphere
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!23 &109823936
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 109823935}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 2100000, guid: 5e146c8b9317245e58468ba06403b2f7, 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_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!135 &109823937
SphereCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 109823935}
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!33 &109823938
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 109823935}
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &109823939
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 109823935}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -29, y: -6.4, z: 11.2}
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!1 &267028023
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 267028025}
- component: {fileID: 267028024}
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 &267028024
Light:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 267028023}
m_Enabled: 1
serializedVersion: 8
m_Type: 1
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, 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 &267028025
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 267028023}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1655058087
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1655058091}
- component: {fileID: 1655058090}
- component: {fileID: 1655058089}
- component: {fileID: 1655058088}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!23 &1655058088
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1655058087}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
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_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 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!64 &1655058089
MeshCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1655058087}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Convex: 0
m_InflateMesh: 0
m_SkinWidth: 0.01
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!33 &1655058090
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1655058087}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1655058091
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1655058087}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -29.552406, y: -7.7469068, z: -2.267387}
m_LocalScale: {x: 100, y: 1, z: 100}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

8
Assets/TestScenes/MobileDeferredTest/ClassicDeferredTest.unity.meta


fileFormatVersion: 2
guid: 853960de486d34173bab633322438e67
timeCreated: 1490056722
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

9
Assets/TestScenes/MobileDeferredTest/Materials.meta


fileFormatVersion: 2
guid: 28cf7415e87c648aaaad26aa06d605b9
folderAsset: yes
timeCreated: 1490056743
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

80
Assets/TestScenes/MobileDeferredTest/Materials/SRP_StandardSpec.mat


%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: SRP_StandardSpec
m_Shader: {fileID: 4800000, guid: 587e4753e582041cb8f86166d829d4c4, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 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}
- _SpecGlossMap:
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.5
- _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: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}

9
Assets/TestScenes/MobileDeferredTest/Materials/SRP_StandardSpec.mat.meta


fileFormatVersion: 2
guid: dd33fc7fd2c844efa8c209610ff06074
timeCreated: 1490056989
licenseType: Pro
NativeFormatImporter:
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

80
Assets/TestScenes/MobileDeferredTest/Materials/sphereGloss.mat


%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: sphereGloss
m_Shader: {fileID: 4800000, guid: 078f6d0e0964240c28f6acc911996f11, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 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}
- _SpecGlossMap:
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.77
- _GlossyReflections: 1
- _Metallic: 0.804
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0, g: 0.751724, b: 1, a: 1}
- _EmissionColor: {r: 0.43685117, g: 0.5631786, b: 0.58823526, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}

9
Assets/TestScenes/MobileDeferredTest/Materials/sphereGloss.mat.meta


fileFormatVersion: 2
guid: 5e146c8b9317245e58468ba06403b2f7
timeCreated: 1490056989
licenseType: Pro
NativeFormatImporter:
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

9
Assets/TestScenes/MobileDeferredTest/Model.meta


fileFormatVersion: 2
guid: 8003331d858314d2b879438b55225267
folderAsset: yes
timeCreated: 1490057573
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存