浏览代码

Merge pull request #1474 from Unity-Technologies/Fix-issue-with-.template-and-emissive-in-shader-graph-for-HDRP

Fix issue with .template and emissive in shader graph for HDRP
/main
GitHub 7 年前
当前提交
ac68380c
共有 2 个文件被更改,包括 13 次插入15 次删除
  1. 13
      com.unity.render-pipelines.high-definition/HDRP/Editor/ShaderGraph/HDPBRPass.template
  2. 15
      com.unity.render-pipelines.high-definition/HDRP/Editor/ShaderGraph/HDUnlitPassForward.template

13
com.unity.render-pipelines.high-definition/HDRP/Editor/ShaderGraph/HDPBRPass.template


//-------------------------------------------------------------------------------------
HLSLPROGRAM
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
//#pragma enable_d3d11_debug_symbols

//-------------------------------------------------------------------------------------
// End Defines
//-------------------------------------------------------------------------------------
#include "HDRP/ShaderVariables.hlsl"
#ifdef DEBUG_DISPLAY
#include "HDRP/Debug/DebugDisplay.hlsl"

// TODO: positionSS is SV_Position, graph input expects screenPosition to be 0..1 across the active viewport (?)
$SurfaceDescriptionInputs.screenPosition: output.screenPosition = input.positionSS;
$SurfaceDescriptionInputs.vertexColor: output.vertexColor = input.color;
return output;

builtinData.opacity = surfaceDescription.Alpha;
builtinData.bakeDiffuseLighting = SampleBakedGI(fragInputs.positionWS, bentNormalWS, fragInputs.texCoord1, fragInputs.texCoord2); // see GetBuiltinData()
// It is safe to call this function here as surfaceData have been filled
// We want to know if we must enable transmission on GI for SSS material, if the material have no SSS, this code will be remove by the compiler.
BSDFData bsdfData = ConvertSurfaceDataToBSDFData(surfaceData);

builtinData.bakeDiffuseLighting += SampleBakedGI(fragInputs.positionWS, -fragInputs.worldToTangent[2], fragInputs.texCoord1, fragInputs.texCoord2) * bsdfData.transmittance;
}
builtinData.emissiveIntensity = 1.0f;
$SurfaceDescription.Emission: builtinData.emissiveColor = surfaceDescription.Emission;
builtinData.velocity = float2(0.0, 0.0);
#ifdef SHADOWS_SHADOWMASK

//-------------------------------------------------------------------------------------
ENDHLSL
}
}

15
com.unity.render-pipelines.high-definition/HDRP/Editor/ShaderGraph/HDUnlitPassForward.template


//-------------------------------------------------------------------------------------
HLSLPROGRAM
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
//#pragma enable_d3d11_debug_symbols

//-------------------------------------------------------------------------------------
// End Defines
//-------------------------------------------------------------------------------------
#include "HDRP/ShaderVariables.hlsl"
#ifdef DEBUG_DISPLAY
#include "HDRP/Debug/DebugDisplay.hlsl"

$SurfaceDescriptionInputs.ViewSpacePosition: float4 posViewSpace = mul(UNITY_MATRIX_V, float4(input.positionWS, 1.0f));
$SurfaceDescriptionInputs.ViewSpacePosition: output.ViewSpacePosition = posViewSpace.xyz / posViewSpace.w;
$SurfaceDescriptionInputs.TangentSpacePosition: output.TangentSpacePosition = float3(0.0f, 0.0f, 0.0f);
$SurfaceDescriptionInputs.vertexColor: output.vertexColor = input.color;
return output;

builtinData.opacity = surfaceDescription.Alpha;
builtinData.bakeDiffuseLighting = float3(0.0, 0.0, 0.0);
builtinData.emissiveIntensity = 1.0f;
$SurfaceDescription.Emission: builtinData.emissiveColor = surfaceDescription.Emission;
builtinData.velocity = float2(0.0, 0.0);
builtinData.shadowMask0 = 0.0;

//-------------------------------------------------------------------------------------
ENDHLSL
}
}
正在加载...
取消
保存