Skip to content

Add import dialog to add a new diffusion profile to the global settings #4743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 38 commits into from
Jun 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
5945333
[HDRP] Fix AxF debug output in certain configurations (#4641)
pmavridis May 26, 2021
64a6c13
Fix SSR accumulation white flash (#4648)
FrancescoC-unity May 26, 2021
f49b710
Display Info Box when MSAA + ray tracing is onr (#4627)
FrancescoC-unity May 26, 2021
05cc16a
Fix distortion when resizing the window in player builds with the Gra…
pmavridis May 28, 2021
2325e3f
Add support for the camera bridge in the graphics compositor (#4599)
pmavridis May 28, 2021
c09379f
Merge branch 'master' into hd/bugfix
sebastienlagarde May 28, 2021
b5962c9
Fix Jittered Project Matrix Infinite Far Clip Plane (#4638)
johnpars May 29, 2021
77b6b7f
Fixed a memory leak related to not disposing of the RTAS at the end H…
anisunity May 29, 2021
bf941a9
Fix custom pass utils Blur + Copy overdraw. (#4623)
alelievr May 29, 2021
806dfbe
Fix draw procedural invalid pass idx 1 on first template load (#4632)
FrancescoC-unity May 29, 2021
88779ea
Changed light reset to preserve type (#4624)
adrien-de-tocqueville May 29, 2021
30fffd5
Revert "Add support for the camera bridge in the graphics compositor …
sebastienlagarde May 29, 2021
aabbb4b
AxF carpaint: Fix a compilation issue on Vulkan until the cpp HLSLcc …
slunity May 29, 2021
dfdb311
Revert "Revert "Add support for the camera bridge in the graphics com…
sebastienlagarde May 29, 2021
891fda0
revert: Fix distortion when resizing the window in player builds with…
sebastienlagarde May 29, 2021
7b17e06
Merge branch 'master' into hd/bugfix
sebastienlagarde May 29, 2021
32df1bf
Merge branch 'master' into hd/bugfix
sebastienlagarde May 29, 2021
8fd1108
Fixed the ray traced sub subsurface scattering debug mode not display…
anisunity May 29, 2021
0032b9c
Fix for discrepancies in saturation and intensity between screen spac…
FrancescoC-unity May 29, 2021
41716f0
Fix a Divide-by-Zero Warning for some Anisotropic Models (Fabric, Lit…
johnpars May 29, 2021
333c800
[HDRP] Fix VfX lit particle AOV output color space (#4646)
pmavridis May 29, 2021
809316c
[HDRP][Path Tracing] Fixed transparent unlit (#4605)
eturquin May 31, 2021
7b1ad29
Merge branch 'master' into hd/bugfix
sebastienlagarde May 31, 2021
08a578d
Fix distortion with MSAA (#4711)
sebastienlagarde May 31, 2021
3c418c0
Fix contact shadow debug views (#4720)
FrancescoC-unity May 31, 2021
352f65d
Update Decal-Projector.md (#4695)
adrien-de-tocqueville May 31, 2021
acc5073
[HDRP] Fixed nullref when deleting the texture asset assigned in a lo…
alelievr May 31, 2021
fd54a00
Merge branch 'master' into hd/bugfix
sebastienlagarde May 31, 2021
ee4320f
Add import dialog for diffusion profile import
FrancescoC-unity Jun 1, 2021
04b03fc
Don't display pop up if we can't add it.
FrancescoC-unity Jun 1, 2021
f177bb9
changelog
FrancescoC-unity Jun 1, 2021
87db1ec
Review code fixes
FrancescoC-unity Jun 2, 2021
81b6b60
changelog
FrancescoC-unity Jun 2, 2021
c23f321
Check tag instead of name for SG
FrancescoC-unity Jun 2, 2021
27f3a55
Merge branch 'master' into HDRP/diffusion-profile-import-add
sebastienlagarde Jun 7, 2021
72f9bda
Merge branch 'master' into HDRP/diffusion-profile-import-add
sebastienlagarde Jun 7, 2021
e4068e2
Adding early guard as a tentative fix for yamato.
FrancescoC-unity Jun 8, 2021
991813a
Merge branch 'master' into HDRP/diffusion-profile-import-add
sebastienlagarde Jun 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added two toggles to control occluder rejection and receiver rejection for the ray traced ambient occlusion (case 1330168).
- Added the receiver motion rejection toggle to RTGI (case 1330168).
- Added info box when low resolution transparency is selected, but its not enabled in the HDRP settings. This will help new users find the correct knob in the HDRP Asset.
- Added a dialog box when you import a Material that has a diffusion profile to add the diffusion profile to global settings.

### Fixed
- Fixed Intensity Multiplier not affecting realtime global illumination.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,68 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse
if (!HDShaderUtils.IsHDRPShader(material.shader, upgradable: true))
continue;


void AddDiffusionProfileToSettings(string propName)
{
if (Application.isBatchMode || HDRenderPipelineGlobalSettings.instance == null
|| HDRenderPipelineGlobalSettings.instance.diffusionProfileSettingsList == null) return;

bool diffusionProfileCanBeAdded = HDRenderPipelineGlobalSettings.instance.diffusionProfileSettingsList.Length < 15;
DiffusionProfileSettings diffusionProfile = null;

if (material.HasProperty(propName))
{
var diffusionProfileAsset = material.GetVector(propName);
string guid = HDUtils.ConvertVector4ToGUID(diffusionProfileAsset);
diffusionProfile = AssetDatabase.LoadAssetAtPath<DiffusionProfileSettings>(AssetDatabase.GUIDToAssetPath(guid));

if (diffusionProfile != null && !HDRenderPipelineGlobalSettings.instance.diffusionProfileSettingsList.Any(d => d == diffusionProfile))
{
string materialName = material.name;
string diffusionProfileName = diffusionProfile.name;

if (!diffusionProfileCanBeAdded)
Debug.LogWarning("There is no space in the global settings to add the diffusion profile " + diffusionProfileName);
else if ((!Application.isBatchMode) &&
(EditorUtility.DisplayDialog("Diffusion Profile Import",
"A Material (" + materialName + ") is being imported with a diffusion profile (" + diffusionProfileName + ") not already added to the HDRP Global Settings.\n If the Diffusion Profile is not referenced in the global settings, HDRP cannot use it.\nDo you want to add the diffusion profile to the HDRP Global Settings asset?", "Yes", "No")))
{
diffusionProfileCanBeAdded = HDRenderPipelineGlobalSettings.instance.AddDiffusionProfile(diffusionProfile);
}
}
}
}

AddDiffusionProfileToSettings("_DiffusionProfileAsset");

// Special Eye case that uses a node with diffusion profiles.
if (material.shader.IsShaderGraphAsset())
{
var matProperties = MaterialEditor.GetMaterialProperties(new UnityEngine.Object[] { material });
for (int propIdx = 0; propIdx < matProperties.Length; ++propIdx)
{
var attributes = material.shader.GetPropertyAttributes(propIdx);
bool hasDiffusionProfileAttribute = false;
foreach (var attribute in attributes)
{
if (attribute == "DiffusionProfile")
{
propIdx++;
hasDiffusionProfileAttribute = true;
break;
}
}

var propName = ShaderUtil.GetPropertyName(material.shader, propIdx);
var type = ShaderUtil.GetPropertyType(material.shader, propIdx);
if (hasDiffusionProfileAttribute &&
type == ShaderUtil.ShaderPropertyType.Vector)
{
AddDiffusionProfileToSettings(propName);
}
}
}

(HDShaderUtils.ShaderID id, GUID subTargetGUID) = HDShaderUtils.GetShaderIDsFromShader(material.shader);
var latestVersion = k_Migrations.Length;

Expand Down