浏览代码

Merge branch 'master'

/main
Evgenii Golubev 7 年前
当前提交
5e60f635
共有 11 个文件被更改,包括 47 次插入18 次删除
  1. 2
      Assets/ScriptableRenderPipeline/Core/Shadow/ShadowBase.cs.hlsl
  2. 5
      Assets/ScriptableRenderPipeline/HDRenderPipeline/AdditionalData/HDAdditionalLightData.cs
  3. 6
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightDefinition.cs
  4. 6
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightDefinition.cs.hlsl
  5. 6
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs
  6. 11
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl
  7. 4
      Assets/ScriptableRenderPipeline/ShaderLibrary/CommonMaterial.hlsl
  8. 2
      ProjectSettings/ProjectVersion.txt
  9. 10
      Packages/Config.meta
  10. 4
      Packages/manifest.json
  11. 9
      Packages/manifest.json.meta

2
Assets/ScriptableRenderPipeline/Core/Shadow/ShadowBase.cs.hlsl


//
// This file was automatically generated from Assets/ScriptableRenderPipeline/core/Shadow/ShadowBase.cs. Please don't edit by hand.
// This file was automatically generated from Assets/ScriptableRenderPipeline/Core/Shadow/ShadowBase.cs. Please don't edit by hand.
//
#ifndef SHADOWBASE_CS_HLSL

5
Assets/ScriptableRenderPipeline/HDRenderPipeline/AdditionalData/HDAdditionalLightData.cs


[Range(0.0f, 20.0f)]
public float lightWidth = 0.0f; // Area & projector lights
[Range(0.0f, 1.0f)]
public float maxSmoothness = 1.0f; // this is use with punctual light to fake an area lights
public bool applyRangeAttenuation = true; // If true, we apply the smooth attenuation factor on the range attenuation to get 0 value, else the attenuation is juste inverse square and never reach 0
}
}

6
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightDefinition.cs


[GenerateHLSL]
public struct LightData
{
// DirectionalLightData >>>
public Vector3 positionWS;
public float invSqrAttenuationRadius;

public Vector3 up; // If spot: rescaled by cot(outerHalfAngle); if projector: rescaled by * (2 / lightWidth)
public float diffuseScale;
// <<< DirectionalLightData
public float angleScale; // Spot light
public float angleOffset; // Spot light
public float shadowDimmer;

public GPULightType lightType;
public float unused;
public float minRoughness; // This is use to give a small "area" to punctual light, as if we have a light with a radius.
};

6
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightDefinition.cs.hlsl


int IESIndex;
float2 size;
int lightType;
float unused;
float minRoughness;
};
// Generated from UnityEngine.Experimental.Rendering.HDPipeline.EnvLightData

{
return value.lightType;
}
float GetUnused(LightData value)
float GetMinRoughness(LightData value)
return value.unused;
return value.minRoughness;
}
//

6
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs


lightData.lightType = gpuLightType;
lightData.positionWS = light.light.transform.position;
lightData.invSqrAttenuationRadius = 1.0f / (light.range * light.range);
// Setting 0 for invSqrAttenuationRadius mean we have no range attenuation, but still have inverse square attenuation.
lightData.invSqrAttenuationRadius = additionalLightData.applyRangeAttenuation ? 1.0f / (light.range * light.range) : 0.0f;
lightData.color = GetLightColor(light);
lightData.forward = light.light.transform.forward; // Note: Light direction is oriented backward (-Z)

{
lightData.shadowIndex = shadowIdx;
}
// Value of max smoothness is from artists point of view, need to convert from perceptual smoothness to roughness
lightData.minRoughness = (1.0f - additionalLightData.maxSmoothness) * (1.0f - additionalLightData.maxSmoothness);
m_lightList.lights.Add(lightData);

11
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl


// For point light and directional GetAngleAttenuation() return 1
float3 lightToSurface = positionWS - lightData.positionWS;
float3 unL = -lightToSurface;
float3 L = (lightType != GPULIGHTTYPE_PROJECTOR_BOX) ? normalize(unL) : -lightData.forward;
float NdotL = dot(bsdfData.normalWS, L);
float illuminance = saturate(NdotL);
float3 unL = -lightToSurface;
float3 L = (lightType != GPULIGHTTYPE_PROJECTOR_BOX) ? normalize(unL) : -lightData.forward;
float NdotL = dot(bsdfData.normalWS, L);
float illuminance = saturate(NdotL);
// Note: lightData.invSqrAttenuationRadius is 0 when applyRangeAttenuation is false
float attenuation = (lightType != GPULIGHTTYPE_PROJECTOR_BOX) ? GetDistanceAttenuation(unL, lightData.invSqrAttenuationRadius) : 1;
// Reminder: lights are oriented backward (-Z)
attenuation *= GetAngleAttenuation(L, -lightData.forward, lightData.angleScale, lightData.angleOffset);

[branch] if (illuminance > 0.0)
{
bsdfData.roughness = max(bsdfData.roughness, lightData.minRoughness); // Simulate that a punctual ligth have a radius with this hack
BSDF(V, L, positionWS, preLightData, bsdfData, diffuseLighting, specularLighting);
diffuseLighting *= lightData.color * (illuminance * lightData.diffuseScale);

4
Assets/ScriptableRenderPipeline/ShaderLibrary/CommonMaterial.hlsl


float PerceptualSmoothnessToRoughness(float perceptualSmoothness)
{
return (1 - perceptualSmoothness) * (1 - perceptualSmoothness);
return (1.0 - perceptualSmoothness) * (1.0 - perceptualSmoothness);
return (1 - perceptualSmoothness);
return (1.0 - perceptualSmoothness);
}
// ----------------------------------------------------------------------------

2
ProjectSettings/ProjectVersion.txt


m_EditorVersion: 2017.3.0a3
m_EditorVersion: 2017.3.0a4

10
Packages/Config.meta


fileFormatVersion: 2
guid: 22bd21b14b6bd62419780a5148913c06
folderAsset: yes
timeCreated: 1501162961
licenseType: Pro
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

4
Packages/manifest.json


{
"dependencies": {
}
}

9
Packages/manifest.json.meta


fileFormatVersion: 2
guid: a07771d9fceebb14b8c0701c90b62577
timeCreated: 1502115272
licenseType: Pro
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存