Skip to content
Merged
5 changes: 4 additions & 1 deletion com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added support for alpha to coverage for HDRP shaders and shader graph
- Added support for Quality Levels to Subsurface Scattering.
- Added option to disable XR rendering on the camera settings.
- Added a frame setting for alpha to mask.
- Added support for specular AA from geometric curvature in AxF
- Added support for baked AO (no input for now) in AxF

### Fixed
- Fix when rescale probe all direction below zero (1219246)
Expand Down Expand Up @@ -516,6 +517,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed a regression in the ray traced indirect diffuse due to the new probe system.
- Fix for range compression factor for probes going negative (now clamped to positive values).
- Fixed path validation when creating new volume profile (case 1229933)
- Fix reflection hierarchy for CARPAINT in AxF.
- Fix precise fresnel for delta lights for SVBRDF in AxF.

### Changed
- Color buffer pyramid is not allocated anymore if neither refraction nor distortion are enabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AxFGUI : ShaderGUI
{
new SurfaceOptionUIBlock(MaterialUIBlock.Expandable.Base, features: SurfaceOptionUIBlock.Features.Unlit | SurfaceOptionUIBlock.Features.ReceiveSSR),
new AxfSurfaceInputsUIBlock(MaterialUIBlock.Expandable.Input),
new AdvancedOptionsUIBlock(MaterialUIBlock.Expandable.Advance, AdvancedOptionsUIBlock.Features.Instancing | AdvancedOptionsUIBlock.Features.AddPrecomputedVelocity),
new AdvancedOptionsUIBlock(MaterialUIBlock.Expandable.Advance, AdvancedOptionsUIBlock.Features.Instancing | AdvancedOptionsUIBlock.Features.SpecularOcclusion | AdvancedOptionsUIBlock.Features.AddPrecomputedVelocity),
};

public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
Expand All @@ -46,15 +46,17 @@ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] pro

/////////////////////////////////////////////////////////////////////////////////////////////////
// AxF material keywords
static string m_AxF_BRDFTypeText = "_AxF_BRDFType";
const string kAxF_BRDFType = "_AxF_BRDFType";
const string kEnableGeometricSpecularAA = "_EnableGeometricSpecularAA";
const string kSpecularOcclusionMode = "_SpecularOcclusionMode"; // match AdvancedOptionsUIBlock.kSpecularOcclusionMode : TODO move both to HDStringConstants.

// All Setup Keyword functions must be static. It allow to create script to automatically update the shaders with a script if code change
static public void SetupMaterialKeywordsAndPass(Material material)
{
material.SetupBaseUnlitKeywords();
material.SetupBaseUnlitPass();

AxfBrdfType BRDFType = (AxfBrdfType)material.GetFloat(m_AxF_BRDFTypeText);
AxfBrdfType BRDFType = (AxfBrdfType)material.GetFloat(kAxF_BRDFType);

CoreUtils.SetKeyword(material, "_AXF_BRDF_TYPE_SVBRDF", BRDFType == AxfBrdfType.SVBRDF);
CoreUtils.SetKeyword(material, "_AXF_BRDF_TYPE_CAR_PAINT", BRDFType == AxfBrdfType.CAR_PAINT);
Expand All @@ -65,6 +67,8 @@ static public void SetupMaterialKeywordsAndPass(Material material)
CoreUtils.SetKeyword(material, "_DISABLE_DECALS", decalsEnabled == false);
bool ssrEnabled = material.HasProperty(kEnableSSR) && material.GetFloat(kEnableSSR) > 0.0f;
CoreUtils.SetKeyword(material, "_DISABLE_SSR", ssrEnabled == false);
CoreUtils.SetKeyword(material, "_ENABLE_GEOMETRIC_SPECULAR_AA", material.HasProperty(kEnableGeometricSpecularAA) && material.GetFloat(kEnableGeometricSpecularAA) > 0.0f);
CoreUtils.SetKeyword(material, "_SPECULAR_OCCLUSION_NONE", material.HasProperty(kSpecularOcclusionMode) && material.GetFloat(kSpecularOcclusionMode) == 0.0f);

BaseLitGUI.SetupStencil(material, receivesSSR: ssrEnabled, useSplitLighting: false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ public enum FeatureFlags
[GenerateHLSL(PackingRules.Exact, false, false, true, 1200)]
public struct SurfaceData
{
[MaterialSharedPropertyMapping(MaterialSharedProperty.AmbientOcclusion)]
[SurfaceDataAttributes("Ambient Occlusion")]
public float ambientOcclusion;

[SurfaceDataAttributes("Specular Occlusion")]
public float specularOcclusion;

[MaterialSharedPropertyMapping(MaterialSharedProperty.Normal)]
[SurfaceDataAttributes(new string[] {"Normal", "Normal View Space"}, true)]
public Vector3 normalWS;
Expand All @@ -64,7 +71,7 @@ public struct SurfaceData
public Vector3 fresnelF0;

[SurfaceDataAttributes("Specular Lobe")]
public Vector2 specularLobe;
public Vector3 specularLobe; // .xy for SVBRDF, .xyz for CARPAINT2, for _CarPaint2_CTSpreads per lobe roughnesses

[SurfaceDataAttributes("Height")]
public float height_mm;
Expand Down Expand Up @@ -102,6 +109,9 @@ public struct SurfaceData
[GenerateHLSL(PackingRules.Exact, false, false, true, 1250)]
public struct BSDFData
{
public float ambientOcclusion;
public float specularOcclusion;

[SurfaceDataAttributes(new string[] { "Normal WS", "Normal View Space" }, true)]
public Vector3 normalWS;
[SurfaceDataAttributes("", true)]
Expand All @@ -113,7 +123,7 @@ public struct BSDFData
public Vector3 diffuseColor;
public Vector3 specularColor;
public Vector3 fresnelF0;
public Vector2 roughness;
public Vector3 roughness; // .xy for SVBRDF, .xyz for CARPAINT2, for _CarPaint2_CTSpreads per lobe roughnesses
public float height_mm;

// Car Paint Variables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,53 +18,59 @@
//
// UnityEngine.Rendering.HighDefinition.AxF+SurfaceData: static fields
//
#define DEBUGVIEW_AXF_SURFACEDATA_NORMAL (1200)
#define DEBUGVIEW_AXF_SURFACEDATA_NORMAL_VIEW_SPACE (1201)
#define DEBUGVIEW_AXF_SURFACEDATA_TANGENT (1202)
#define DEBUGVIEW_AXF_SURFACEDATA_DIFFUSE_COLOR (1203)
#define DEBUGVIEW_AXF_SURFACEDATA_SPECULAR_COLOR (1204)
#define DEBUGVIEW_AXF_SURFACEDATA_FRESNEL_F0 (1205)
#define DEBUGVIEW_AXF_SURFACEDATA_SPECULAR_LOBE (1206)
#define DEBUGVIEW_AXF_SURFACEDATA_HEIGHT (1207)
#define DEBUGVIEW_AXF_SURFACEDATA_ANISOTROPIC_ANGLE (1208)
#define DEBUGVIEW_AXF_SURFACEDATA_FLAKES_UV (1209)
#define DEBUGVIEW_AXF_SURFACEDATA_FLAKES_MIP (1210)
#define DEBUGVIEW_AXF_SURFACEDATA_CLEARCOAT_COLOR (1211)
#define DEBUGVIEW_AXF_SURFACEDATA_CLEARCOAT_NORMAL (1212)
#define DEBUGVIEW_AXF_SURFACEDATA_CLEARCOAT_IOR (1213)
#define DEBUGVIEW_AXF_SURFACEDATA_GEOMETRIC_NORMAL (1214)
#define DEBUGVIEW_AXF_SURFACEDATA_GEOMETRIC_NORMAL_VIEW_SPACE (1215)
#define DEBUGVIEW_AXF_SURFACEDATA_AMBIENT_OCCLUSION (1200)
#define DEBUGVIEW_AXF_SURFACEDATA_SPECULAR_OCCLUSION (1201)
#define DEBUGVIEW_AXF_SURFACEDATA_NORMAL (1202)
#define DEBUGVIEW_AXF_SURFACEDATA_NORMAL_VIEW_SPACE (1203)
#define DEBUGVIEW_AXF_SURFACEDATA_TANGENT (1204)
#define DEBUGVIEW_AXF_SURFACEDATA_DIFFUSE_COLOR (1205)
#define DEBUGVIEW_AXF_SURFACEDATA_SPECULAR_COLOR (1206)
#define DEBUGVIEW_AXF_SURFACEDATA_FRESNEL_F0 (1207)
#define DEBUGVIEW_AXF_SURFACEDATA_SPECULAR_LOBE (1208)
#define DEBUGVIEW_AXF_SURFACEDATA_HEIGHT (1209)
#define DEBUGVIEW_AXF_SURFACEDATA_ANISOTROPIC_ANGLE (1210)
#define DEBUGVIEW_AXF_SURFACEDATA_FLAKES_UV (1211)
#define DEBUGVIEW_AXF_SURFACEDATA_FLAKES_MIP (1212)
#define DEBUGVIEW_AXF_SURFACEDATA_CLEARCOAT_COLOR (1213)
#define DEBUGVIEW_AXF_SURFACEDATA_CLEARCOAT_NORMAL (1214)
#define DEBUGVIEW_AXF_SURFACEDATA_CLEARCOAT_IOR (1215)
#define DEBUGVIEW_AXF_SURFACEDATA_GEOMETRIC_NORMAL (1216)
#define DEBUGVIEW_AXF_SURFACEDATA_GEOMETRIC_NORMAL_VIEW_SPACE (1217)

//
// UnityEngine.Rendering.HighDefinition.AxF+BSDFData: static fields
//
#define DEBUGVIEW_AXF_BSDFDATA_NORMAL_WS (1250)
#define DEBUGVIEW_AXF_BSDFDATA_NORMAL_VIEW_SPACE (1251)
#define DEBUGVIEW_AXF_BSDFDATA_TANGENT_WS (1252)
#define DEBUGVIEW_AXF_BSDFDATA_BI_TANGENT_WS (1253)
#define DEBUGVIEW_AXF_BSDFDATA_DIFFUSE_COLOR (1254)
#define DEBUGVIEW_AXF_BSDFDATA_SPECULAR_COLOR (1255)
#define DEBUGVIEW_AXF_BSDFDATA_FRESNEL_F0 (1256)
#define DEBUGVIEW_AXF_BSDFDATA_ROUGHNESS (1257)
#define DEBUGVIEW_AXF_BSDFDATA_HEIGHT_MM (1258)
#define DEBUGVIEW_AXF_BSDFDATA_FLAKES_UV (1259)
#define DEBUGVIEW_AXF_BSDFDATA_FLAKES_MIP (1260)
#define DEBUGVIEW_AXF_BSDFDATA_CLEARCOAT_COLOR (1261)
#define DEBUGVIEW_AXF_BSDFDATA_CLEARCOAT_NORMAL_WS (1262)
#define DEBUGVIEW_AXF_BSDFDATA_CLEARCOAT_IOR (1263)
#define DEBUGVIEW_AXF_BSDFDATA_GEOMETRIC_NORMAL (1264)
#define DEBUGVIEW_AXF_BSDFDATA_GEOMETRIC_NORMAL_VIEW_SPACE (1265)
#define DEBUGVIEW_AXF_BSDFDATA_AMBIENT_OCCLUSION (1250)
#define DEBUGVIEW_AXF_BSDFDATA_SPECULAR_OCCLUSION (1251)
#define DEBUGVIEW_AXF_BSDFDATA_NORMAL_WS (1252)
#define DEBUGVIEW_AXF_BSDFDATA_NORMAL_VIEW_SPACE (1253)
#define DEBUGVIEW_AXF_BSDFDATA_TANGENT_WS (1254)
#define DEBUGVIEW_AXF_BSDFDATA_BI_TANGENT_WS (1255)
#define DEBUGVIEW_AXF_BSDFDATA_DIFFUSE_COLOR (1256)
#define DEBUGVIEW_AXF_BSDFDATA_SPECULAR_COLOR (1257)
#define DEBUGVIEW_AXF_BSDFDATA_FRESNEL_F0 (1258)
#define DEBUGVIEW_AXF_BSDFDATA_ROUGHNESS (1259)
#define DEBUGVIEW_AXF_BSDFDATA_HEIGHT_MM (1260)
#define DEBUGVIEW_AXF_BSDFDATA_FLAKES_UV (1261)
#define DEBUGVIEW_AXF_BSDFDATA_FLAKES_MIP (1262)
#define DEBUGVIEW_AXF_BSDFDATA_CLEARCOAT_COLOR (1263)
#define DEBUGVIEW_AXF_BSDFDATA_CLEARCOAT_NORMAL_WS (1264)
#define DEBUGVIEW_AXF_BSDFDATA_CLEARCOAT_IOR (1265)
#define DEBUGVIEW_AXF_BSDFDATA_GEOMETRIC_NORMAL (1266)
#define DEBUGVIEW_AXF_BSDFDATA_GEOMETRIC_NORMAL_VIEW_SPACE (1267)

// Generated from UnityEngine.Rendering.HighDefinition.AxF+SurfaceData
// PackingRules = Exact
struct SurfaceData
{
float ambientOcclusion;
float specularOcclusion;
float3 normalWS;
float3 tangentWS;
float3 diffuseColor;
float3 specularColor;
float3 fresnelF0;
float2 specularLobe;
float3 specularLobe;
float height_mm;
float anisotropyAngle;
float2 flakesUV;
Expand All @@ -79,13 +85,15 @@ struct SurfaceData
// PackingRules = Exact
struct BSDFData
{
float ambientOcclusion;
float specularOcclusion;
float3 normalWS;
float3 tangentWS;
float3 biTangentWS;
float3 diffuseColor;
float3 specularColor;
float3 fresnelF0;
float2 roughness;
float3 roughness;
float height_mm;
float2 flakesUV;
float flakesMipLevel;
Expand All @@ -102,6 +110,12 @@ void GetGeneratedSurfaceDataDebug(uint paramId, SurfaceData surfacedata, inout f
{
switch (paramId)
{
case DEBUGVIEW_AXF_SURFACEDATA_AMBIENT_OCCLUSION:
result = surfacedata.ambientOcclusion.xxx;
break;
case DEBUGVIEW_AXF_SURFACEDATA_SPECULAR_OCCLUSION:
result = surfacedata.specularOcclusion.xxx;
break;
case DEBUGVIEW_AXF_SURFACEDATA_NORMAL:
result = surfacedata.normalWS * 0.5 + 0.5;
break;
Expand All @@ -123,7 +137,7 @@ void GetGeneratedSurfaceDataDebug(uint paramId, SurfaceData surfacedata, inout f
result = surfacedata.fresnelF0;
break;
case DEBUGVIEW_AXF_SURFACEDATA_SPECULAR_LOBE:
result = float3(surfacedata.specularLobe, 0.0);
result = surfacedata.specularLobe;
break;
case DEBUGVIEW_AXF_SURFACEDATA_HEIGHT:
result = surfacedata.height_mm.xxx;
Expand Down Expand Up @@ -162,6 +176,12 @@ void GetGeneratedBSDFDataDebug(uint paramId, BSDFData bsdfdata, inout float3 res
{
switch (paramId)
{
case DEBUGVIEW_AXF_BSDFDATA_AMBIENT_OCCLUSION:
result = bsdfdata.ambientOcclusion.xxx;
break;
case DEBUGVIEW_AXF_BSDFDATA_SPECULAR_OCCLUSION:
result = bsdfdata.specularOcclusion.xxx;
break;
case DEBUGVIEW_AXF_BSDFDATA_NORMAL_WS:
result = bsdfdata.normalWS * 0.5 + 0.5;
break;
Expand All @@ -184,7 +204,7 @@ void GetGeneratedBSDFDataDebug(uint paramId, BSDFData bsdfdata, inout float3 res
result = bsdfdata.fresnelF0;
break;
case DEBUGVIEW_AXF_BSDFDATA_ROUGHNESS:
result = float3(bsdfdata.roughness, 0.0);
result = bsdfdata.roughness;
break;
case DEBUGVIEW_AXF_BSDFDATA_HEIGHT_MM:
result = bsdfdata.height_mm.xxx;
Expand Down
Loading