您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
47 行
1.4 KiB
47 行
1.4 KiB
#if SHADERPASS != SHADERPASS_FORWARD_UNLIT
|
|
#error SHADERPASS_is_not_correctly_define
|
|
#endif
|
|
|
|
#include "VertMesh.hlsl"
|
|
|
|
PackedVaryingsType Vert(AttributesMesh inputMesh)
|
|
{
|
|
VaryingsType varyingsType;
|
|
varyingsType.vmesh = VertMesh(inputMesh);
|
|
return PackVaryingsType(varyingsType);
|
|
}
|
|
|
|
#ifdef TESSELLATION_ON
|
|
|
|
PackedVaryingsToPS VertTesselation(VaryingsToDS input)
|
|
{
|
|
VaryingsToPS output;
|
|
output.vmesh = VertMeshTesselation(input.vmesh);
|
|
return PackVaryingsToPS(output);
|
|
}
|
|
|
|
#include "TessellationShare.hlsl"
|
|
|
|
#endif // TESSELLATION_ON
|
|
|
|
float4 Frag(PackedVaryingsToPS packedInput) : SV_Target
|
|
{
|
|
FragInputs input = UnpackVaryingsMeshToFragInputs(packedInput.vmesh);
|
|
|
|
// input.unPositionSS is SV_Position
|
|
PositionInputs posInput = GetPositionInput(input.unPositionSS.xy, _ScreenSize.zw);
|
|
UpdatePositionInput(input.unPositionSS.z, input.unPositionSS.w, input.positionWS, posInput);
|
|
float3 V = GetWorldSpaceNormalizeViewDir(input.positionWS);
|
|
|
|
SurfaceData surfaceData;
|
|
BuiltinData builtinData;
|
|
GetSurfaceAndBuiltinData(input, V, posInput, surfaceData, builtinData);
|
|
|
|
// Not lit here (but emissive is allowed)
|
|
|
|
BSDFData bsdfData = ConvertSurfaceDataToBSDFData(surfaceData);
|
|
|
|
// TODO: we must not access bsdfData here, it break the genericity of the code!
|
|
return float4(bsdfData.color + builtinData.emissiveColor, builtinData.opacity);
|
|
}
|
|
|