浏览代码

Merge remote-tracking branch 'origin/master' into HDRP-GraphicTests

/namespace
Remy 7 年前
当前提交
0df8117b
共有 6 个文件被更改,包括 61 次插入54 次删除
  1. 2
      ScriptableRenderPipeline/Core/package.json
  2. 35
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl
  3. 4
      ScriptableRenderPipeline/HDRenderPipeline/package.json
  4. 68
      ScriptableRenderPipeline/LightweightPipeline/Data/LightweightPipelineAsset.cs
  5. 4
      ScriptableRenderPipeline/LightweightPipeline/package.json
  6. 2
      ScriptableRenderPipeline/master-package.json

2
ScriptableRenderPipeline/Core/package.json


{
"name": "com.unity.render-pipelines.core",
"description": "Core library for Unity render pipelines.",
"version": "0.1.20",
"version": "0.1.21",
"unity": "2018.1",
"dependencies": {
"com.unity.postprocessing": "0.1.7"

35
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl


// we need to push the shading position back to avoid self-shadowing problems.
float3 ComputeThicknessDisplacement(BSDFData bsdfData, float3 L, float NdotL)
{
// Compute the thickness in world units along the normal.
float thicknessInMeters = bsdfData.thickness * METERS_PER_MILLIMETER;
float thicknessInUnits = thicknessInMeters * _WorldScales[bsdfData.subsurfaceProfile].y;
float displacement = 0;
[flatten] if (bsdfData.useThickObjectMode && NdotL < 0)
{
// Compute the thickness in world units along the normal.
float thicknessInMeters = bsdfData.thickness * METERS_PER_MILLIMETER;
float thicknessInUnits = thicknessInMeters * _WorldScales[bsdfData.subsurfaceProfile].y;
// Compute the thickness in world units along the light vector.
float unprojectedThickness = thicknessInUnits / -NdotL;
// Compute the thickness in world units along the light vector.
displacement = thicknessInUnits / -NdotL;
}
return unprojectedThickness * L;
return displacement * L;
}
// Currently, we only model diffuse transmission. Specular transmission is not yet supported.

float3 L = -lightData.forward; // Lights point backward in Unity
float NdotL = dot(N, L);
[flatten] if (bsdfData.useThickObjectMode && NdotL < 0)
{
posInput.positionWS += ComputeThicknessDisplacement(bsdfData, L, NdotL);
}
posInput.positionWS += ComputeThicknessDisplacement(bsdfData, L, NdotL);
float3 color; float attenuation;
EvaluateLight_Directional(lightLoopContext, posInput, lightData, bakeLightingData, N, L,

[branch] if (intensity > 0.0)
[branch] if (intensity > 0)
{
BSDF(V, L, posInput.positionWS, preLightData, bsdfData, lighting.diffuse, lighting.specular);

[flatten] if (bsdfData.enableTransmission)
[branch] if (bsdfData.enableTransmission)
{
// We use diffuse lighting for accumulation since it is going to be blurred during the SSS pass.
lighting.diffuse += EvaluateTransmission(bsdfData, NdotL, preLightData.NdotV, attenuation * lightData.diffuseScale);

float3 L = unL * distRcp;
float NdotL = dot(N, L);
[flatten] if (bsdfData.useThickObjectMode && NdotL < 0)
{
posInput.positionWS += ComputeThicknessDisplacement(bsdfData, L, NdotL);
}
posInput.positionWS += ComputeThicknessDisplacement(bsdfData, L, NdotL);
float3 color; float attenuation;
EvaluateLight_Punctual(lightLoopContext, posInput, lightData, bakeLightingData, N, L, dist, distSq,

[branch] if (intensity > 0.0)
[branch] if (intensity > 0)
{
// Simulate a sphere light with this hack.
bsdfData.roughnessT = max(bsdfData.roughnessT, lightData.minRoughness);

lighting.specular *= intensity * lightData.specularScale;
}
[flatten] if (bsdfData.enableTransmission)
[branch] if (bsdfData.enableTransmission)
{
// We use diffuse lighting for accumulation since it is going to be blurred during the SSS pass.
lighting.diffuse += EvaluateTransmission(bsdfData, NdotL, preLightData.NdotV, attenuation * lightData.diffuseScale);

4
ScriptableRenderPipeline/HDRenderPipeline/package.json


{
"name": "com.unity.render-pipelines.high-definition",
"description": "HD Render Pipeline for Unity.",
"version": "0.1.20",
"version": "0.1.21",
"com.unity.render-pipelines.core": "0.1.20"
"com.unity.render-pipelines.core": "0.1.21"
}
}

68
ScriptableRenderPipeline/LightweightPipeline/Data/LightweightPipelineAsset.cs


using UnityEditor;
using UnityEditor.ProjectWindowCallback;
namespace UnityEngine.Experimental.Rendering.LightweightPipeline
{
public enum ShadowCascades

public class LightweightPipelineAsset : RenderPipelineAsset
{
public static readonly string[] m_SearchPaths = {"Assets", "Packages/com.unity.render-pipelines"};
public static readonly string[] m_SearchPaths = {"Assets", "Packages/com.unity.render-pipelines.lightweight"};
// Default values set when a new LightweightPipeline asset is created
[SerializeField] private int m_MaxPixelLights = 4;

[SerializeField] private Material m_DefaultParticleMaterial;
[SerializeField] private Material m_DefaultTerrainMaterial;
[UnityEditor.MenuItem("Assets/Create/Render Pipeline/Lightweight/Pipeline Asset", priority = CoreUtils.assetCreateMenuPriority1)]
[MenuItem("Assets/Create/Render Pipeline/Lightweight/Pipeline Asset", priority = CoreUtils.assetCreateMenuPriority1)]
var instance = CreateInstance<LightweightPipelineAsset>();
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, CreateInstance<CreateLightweightPipelineAsset>(),
"LightweightAsset.asset", null, null);
}
string[] guids = UnityEditor.AssetDatabase.FindAssets("LightweightPipelineResource t:scriptableobject", m_SearchPaths);
LightweightPipelineResource resourceAsset = null;
foreach (string guid in guids)
class CreateLightweightPipelineAsset : EndNameEditAction
{
public override void Action(int instanceId, string pathName, string resourceFile)
string path = UnityEditor.AssetDatabase.GUIDToAssetPath(guid);
resourceAsset = UnityEditor.AssetDatabase.LoadAssetAtPath<LightweightPipelineResource>(path);
if (resourceAsset != null)
break;
}
var instance = CreateInstance<LightweightPipelineAsset>();
// There's currently an issue that prevents FindAssets from find resources withing the package folder.
if (resourceAsset == null)
{
string path = "Packages/com.unity.render-pipelines.lightweight/Data/LightweightPipelineResource.asset";
resourceAsset = UnityEditor.AssetDatabase.LoadAssetAtPath<LightweightPipelineResource>(path);
}
string[] guids = AssetDatabase.FindAssets("LightweightPipelineResource t:scriptableobject", m_SearchPaths);
LightweightPipelineResource resourceAsset = null;
foreach (string guid in guids)
{
string path = AssetDatabase.GUIDToAssetPath(guid);
resourceAsset = AssetDatabase.LoadAssetAtPath<LightweightPipelineResource>(path);
if (resourceAsset != null)
break;
}
if (resourceAsset != null)
{
instance.m_DefaultMaterial = resourceAsset.DefaultMaterial;
instance.m_DefaultParticleMaterial = resourceAsset.DefaultParticleMaterial;
instance.m_DefaultTerrainMaterial = resourceAsset.DefaultTerrainMaterial;
}
// There's currently an issue that prevents FindAssets from find resources withing the package folder.
if (resourceAsset == null)
{
string path = "Packages/com.unity.render-pipelines.lightweight/Data/LightweightPipelineResource.asset";
resourceAsset = AssetDatabase.LoadAssetAtPath<LightweightPipelineResource>(path);
}
instance.m_DefaultShader = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.STANDARD_PBS));
instance.m_BlitShader = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.HIDDEN_BLIT));
instance.m_CopyDepthShader = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.HIDDEN_DEPTH_COPY));
if (resourceAsset != null)
{
instance.m_DefaultMaterial = resourceAsset.DefaultMaterial;
instance.m_DefaultParticleMaterial = resourceAsset.DefaultParticleMaterial;
instance.m_DefaultTerrainMaterial = resourceAsset.DefaultTerrainMaterial;
}
string assetPath = UnityEditor.EditorUtility.SaveFilePanelInProject("Save Lightweight Asset", "LightweightAsset", "asset",
"Please enter a file name to save the asset to");
instance.m_DefaultShader = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.STANDARD_PBS));
instance.m_BlitShader = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.HIDDEN_BLIT));
instance.m_CopyDepthShader = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.HIDDEN_DEPTH_COPY));
if (assetPath.Length > 0)
UnityEditor.AssetDatabase.CreateAsset(instance, assetPath);
AssetDatabase.CreateAsset(instance, pathName);
}
}
#endif

4
ScriptableRenderPipeline/LightweightPipeline/package.json


{
"name": "com.unity.render-pipelines.lightweight",
"description": "Lightweight Render Pipeline for Unity.",
"version": "0.1.20",
"version": "0.1.21",
"com.unity.render-pipelines.core": "0.1.20"
"com.unity.render-pipelines.core": "0.1.21"
}
}

2
ScriptableRenderPipeline/master-package.json


{
"version": "0.1.20",
"version": "0.1.21",
"unity": "2018.1",
"dependencies": {
"com.unity.postprocessing": "0.1.7"

正在加载...
取消
保存