浏览代码

cleanup commented code and unused variables and rename renderloop more appropriatly

/main
Filip Iliescu 7 年前
当前提交
7b6589ed
共有 16 个文件被更改,包括 1015 次插入1055 次删除
  1. 4
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/Shaders/Internal-DeferredReflections.shader
  2. 29
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/Shaders/LightingTemplate.hlsl
  3. 10
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/Shaders/UnityStandardForwardMobile.cginc
  4. 6
      Assets/TestScenes/MobileDeferredTest/OnTileDeferredPipeline.asset
  5. 1001
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/OnTileDeferredRenderPipeline.cs
  6. 10
      Assets/TestScenes/MobileDeferredTest/OnTileDeferredPipeline.asset.meta
  7. 1001
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/Shaders/ClassicDeferredPipeline.cs
  8. 9
      Assets/TestScenes/MobileDeferredTest/ClassicDeferredPipeline.asset.meta
  9. 0
      /Assets/ScriptableRenderPipeline/MobileRenderPipeline/Shaders.meta
  10. 0
      /Assets/ScriptableRenderPipeline/MobileRenderPipeline/Shaders
  11. 0
      /Assets/TestScenes/MobileDeferredTest/OnTileDeferredPipeline.asset
  12. 0
      /Assets/ScriptableRenderPipeline/MobileRenderPipeline/OnTileDeferredRenderPipeline.cs.meta
  13. 0
      /Assets/ScriptableRenderPipeline/MobileRenderPipeline/LightVolumes.meta
  14. 0
      /Assets/ScriptableRenderPipeline/MobileRenderPipeline/LightVolumes
  15. 0
      /Assets/ScriptableRenderPipeline/MobileRenderPipeline/Soft.psd
  16. 0
      /Assets/ScriptableRenderPipeline/MobileRenderPipeline/Soft.psd.meta

4
Assets/ScriptableRenderPipeline/MobileRenderPipeline/Shaders/Internal-DeferredReflections.shader


half4 ret = half4(rgb*falloff, 1-falloff);
//debug
//if (all(worldPos>specMin && worldPos<specMax))
//ret = half4(frac(0.2*worldPos), 1);
// UNITY_BRDF_PBS1 writes out alpha 1 to our emission alpha. TODO: Should preclear emission alpha after gbuffer pass in case this ever changes
#ifdef UNITY_FRAMEBUFFER_FETCH_AVAILABLE
outEmission = ret;

29
Assets/ScriptableRenderPipeline/MobileRenderPipeline/Shaders/LightingTemplate.hlsl


#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

# include "../../ShaderLibrary/Shadow/Shadow.hlsl"
#undef SHADOW_FPTL
//#include "../../ShaderLibrary/Shadow/Shadow.hlsl"
//#include "../../fptl/ShadowContext.hlsl"
//#include "../../fptl/ShadowDispatch.hlsl"
CBUFFER_START(ShadowLightData)
float4 g_vShadow3x3PCFTerms0;

UNITY_DECLARE_DEPTH_TEXTURE(_CameraGBufferZ);
//debug
//float3 GetViewPosFromLinDepth(float2 v2ScrPos, float fLinDepth)
//{
// float fSx = UNITY_MATRIX_P[0].x;
// float fCx = UNITY_MATRIX_P[0].z;
// float fSy = UNITY_MATRIX_P[1].y;
// float fCy = UNITY_MATRIX_P[1].z;
//
// return fLinDepth*float3( ((v2ScrPos.x-fCx)/fSx), ((v2ScrPos.y-fCy)/fSy), 1.0 );
//}
// --------------------------------------------------------
// Common lighting data calculation (direction, attenuation, ...)

{
i.ray = i.ray * (_ProjectionParams.z / i.ray.z);
float2 uv = i.uv.xy / i.uv.w;
//float2 uv = i.pos.xy / float2(_ScreenParams.xy);
// read depth and reconstruct world position
// if we have framebuffer fetch, its expected depth was passed in the parameter from the framebuffer so no need to fetch

depth = Linear01Depth (depth);
//debug
//float linDepth = depth * (_ProjectionParams.z-_ProjectionParams.y) + _ProjectionParams.y;
//float4 vpos = float4(GetViewPosFromLinDepth((2*uv-1)*float2(1, -1), linDepth), 1);
float4 vpos = float4(i.ray * depth,1);
float3 wpos = mul (unity_CameraToWorld, vpos).xyz;

OnChipDeferredFragSetup(i, uv, vpos, wpos, depth);
// needed? old shadow code is commented out, we switched to new shadow code .. aka sampleShadow()
float fadeDist = UnityComputeShadowFadeDistance(wpos, vpos.z);
// spot light case

UnityLight light;
UNITY_INITIALIZE_OUTPUT(UnityLight, light);
//debugLighting = float4(0.0, 0.0, 0.0, 0.0);
#ifdef UNITY_FRAMEBUFFER_FETCH_AVAILABLE
OnChipDeferredCalculateLightParams (i, wpos, uv, light.dir, atten, fadeDist, colorCookie, vpDepth);
#else

// UNITY_BRDF_PBS1 writes out alpha 1 to our emission alpha.
half4 res = UNITY_BRDF_PBS (data.diffuseColor, data.specularColor, oneMinusReflectivity, data.smoothness, data.normalWorld, -eyeVec, light, ind);
//return debugLighting;
return res;
}

10
Assets/ScriptableRenderPipeline/MobileRenderPipeline/Shaders/UnityStandardForwardMobile.cginc


float att = dot(toLight, toLight) * gLightPos[lightIndex].w;
float atten = tex2Dlod (_LightTextureB0, float4(att.rr, 0.0, 0.0)).UNITY_ATTEN_CHANNEL;
// For debug: spot attenuation -- programatic no cookie
//const float fProjVec = -dot(vL, gLightDirection[lightIndex].xyz); // spotDir = lgtDat.lightAxisZ.xyz
//float2 cookCoord = (-lgtDat.cotan)*float2( dot(vLw, lgtDat.lightAxisX.xyz), dot(vL, lgtDat.lightAxisY.xyz) ) / fProjVec;
float4 uvCookie = mul (gLightMatrix[lightIndex], float4(vPw,1));
float2 cookCoord = uvCookie.xy / uvCookie.w;

// fragment shader main
half4 singlePassForward(VertexOutputForwardNew i)
{
//float linZ = GetLinearZFromSVPosW(i.pos.w); // matching script side where camera space is right handed.
//float3 vP = GetViewPosFromLinDepth(i.pos.xy, linZ);
//float3 vPw = mul(g_mViewToWorld, float4(vP,1.0)).xyz;
//float3 Vworld = normalize(mul((float3x3) g_mViewToWorld, -vP).xyz); // not same as unity_CameraToWorld
// matching script side where camera space is right handed.
float3 vP = i.posView;
float3 vPw = i.posWorld;
float3 Vworld = normalize(_WorldSpaceCameraPos.xyz - vPw);

6
Assets/TestScenes/MobileDeferredTest/OnTileDeferredPipeline.asset


m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d22b2b0343c2d4b1586e009e1bb0a736, type: 3}
m_Name: ClassicDeferredPipeline
m_Name: OnTileDeferredPipeline
m_EditorClassIdentifier:
m_ShadowSettings:
enabled: 1

spotCookieSize: 512
pointCookieSize: 128
spotCookieSize: 256
pointCookieSize: 512
reflectionCubemapSize: 256
UseLegacyCookies: 1
TransparencyShadows: 0

1001
Assets/ScriptableRenderPipeline/MobileRenderPipeline/OnTileDeferredRenderPipeline.cs
文件差异内容过多而无法显示
查看文件

10
Assets/TestScenes/MobileDeferredTest/OnTileDeferredPipeline.asset.meta


fileFormatVersion: 2
guid: 33d9927db5e524331aa1c00a95f2e96b
timeCreated: 1499728757
licenseType: Pro
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

1001
Assets/ScriptableRenderPipeline/MobileRenderPipeline/Shaders/ClassicDeferredPipeline.cs
文件差异内容过多而无法显示
查看文件

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


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

/Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred.meta → /Assets/ScriptableRenderPipeline/MobileRenderPipeline/Shaders.meta

/Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred → /Assets/ScriptableRenderPipeline/MobileRenderPipeline/Shaders

/Assets/TestScenes/MobileDeferredTest/ClassicDeferredPipeline.asset → /Assets/TestScenes/MobileDeferredTest/OnTileDeferredPipeline.asset

/Assets/ScriptableRenderPipeline/MobileRenderPipeline/Shaders/ClassicDeferredPipeline.cs.meta → /Assets/ScriptableRenderPipeline/MobileRenderPipeline/OnTileDeferredRenderPipeline.cs.meta

/Assets/ScriptableRenderPipeline/MobileRenderPipeline/Shaders/LightVolumes.meta → /Assets/ScriptableRenderPipeline/MobileRenderPipeline/LightVolumes.meta

/Assets/ScriptableRenderPipeline/MobileRenderPipeline/Shaders/LightVolumes → /Assets/ScriptableRenderPipeline/MobileRenderPipeline/LightVolumes

/Assets/ScriptableRenderPipeline/MobileRenderPipeline/Shaders/Soft.psd → /Assets/ScriptableRenderPipeline/MobileRenderPipeline/Soft.psd

/Assets/ScriptableRenderPipeline/MobileRenderPipeline/Shaders/Soft.psd.meta → /Assets/ScriptableRenderPipeline/MobileRenderPipeline/Soft.psd.meta

正在加载...
取消
保存