Skip to content

Commit 28e2493

Browse files
FrancescoC-unitypmavridissebastienlagardejohnparsanisunity
authored
Add import dialog to add a new diffusion profile to the global settings (#4743)
* [HDRP] Fix AxF debug output in certain configurations (#4641) * Fix AxF debug output in certain configurations. * Update comment * Fix SSR accumulation white flash (#4648) * Fix white flash * changelog Co-authored-by: sebastienlagarde <[email protected]> * Display Info Box when MSAA + ray tracing is onr (#4627) * Show info box when ray tracing is enabled. * Changelog * Move below MSAA Co-authored-by: sebastienlagarde <[email protected]> * Fix distortion when resizing the window in player builds with the Graphics Compositor enabled (#4593) Co-authored-by: sebastienlagarde <[email protected]> * Add support for the camera bridge in the graphics compositor (#4599) * Fix Jittered Project Matrix Infinite Far Clip Plane (#4638) * Reconstruct jittered projection matrix far plane (for Infinite ) * Changelog Co-authored-by: sebastienlagarde <[email protected]> * Fixed a memory leak related to not disposing of the RTAS at the end HDRP's lifecycle. (#4688) Co-authored-by: sebastienlagarde <[email protected]> * Fix custom pass utils Blur + Copy overdraw. (#4623) * Fix overdraw in custom pass utils blur function * Updated changelog Co-authored-by: sebastienlagarde <[email protected]> * Fix draw procedural invalid pass idx 1 on first template load (#4632) * Fix * changelog * Force sync compilation for TAA Co-authored-by: CifaCia <[email protected]> Co-authored-by: sebastienlagarde <[email protected]> * Changed light reset to preserve type (#4624) Co-authored-by: sebastienlagarde <[email protected]> * Revert "Add support for the camera bridge in the graphics compositor (#4599)" This reverts commit 2325e3f. * AxF carpaint: Fix a compilation issue on Vulkan until the cpp HLSLcc side is updated. (case 1335737, related to 1314040) (#4691) Co-authored-by: sebastienlagarde <[email protected]> * Revert "Revert "Add support for the camera bridge in the graphics compositor (#4599)"" This reverts commit 30fffd5. * revert: Fix distortion when resizing the window in player builds with the Graphi * Fixed the ray traced sub subsurface scattering debug mode not displaying only the RTSSS Data (case 1332904). (#4626) * Fixed the ray traced sub subsurface scattering debug mode not displaying only the RTSSS Data (case 1332904). * Add test scene Co-authored-by: Remi Chapelain <[email protected]> Co-authored-by: Sebastien Lagarde <[email protected]> * Fix for discrepancies in saturation and intensity between screen space refraction and probe refraction (#4653) * Delete the second transmittance mul * Changelog Co-authored-by: Sebastien Lagarde <[email protected]> * Fix a Divide-by-Zero Warning for some Anisotropic Models (Fabric, Lit) (#4636) * Initialize the shading normal to a non-zero value for anisotropy * Changelog Co-authored-by: sebastienlagarde <[email protected]> * [HDRP] Fix VfX lit particle AOV output color space (#4646) * Fix VfX lit particle aov output color space * Update comment Co-authored-by: sebastienlagarde <[email protected]> * [HDRP][Path Tracing] Fixed transparent unlit (#4605) * Fixed issue with transparent unlit. * Updated changelog. * Reverted accidental change to default mtl. Co-authored-by: sebastienlagarde <[email protected]> * Fix distortion with MSAA (#4711) * Fix contact shadow debug views (#4720) * Fix * changelog Co-authored-by: sebastienlagarde <[email protected]> * Update Decal-Projector.md (#4695) * [HDRP] Fixed nullref when deleting the texture asset assigned in a local volumetric fog volume (#4728) * Fixed nullref when deleting the 3D mask of a density volume (case 1339330) * Updated changelog Co-authored-by: sebastienlagarde <[email protected]> * Add import dialog for diffusion profile import * Don't display pop up if we can't add it. * changelog * Review code fixes * changelog * Check tag instead of name for SG * Adding early guard as a tentative fix for yamato. Co-authored-by: Pavlos Mavridis <[email protected]> Co-authored-by: sebastienlagarde <[email protected]> Co-authored-by: John Parsaie <[email protected]> Co-authored-by: anisunity <[email protected]> Co-authored-by: Antoine Lelievre <[email protected]> Co-authored-by: CifaCia <[email protected]> Co-authored-by: Adrien de Tocqueville <[email protected]> Co-authored-by: slunity <[email protected]> Co-authored-by: Remi Chapelain <[email protected]> Co-authored-by: Emmanuel Turquin <[email protected]>
1 parent 80ca6b3 commit 28e2493

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6969
- Added two toggles to control occluder rejection and receiver rejection for the ray traced ambient occlusion (case 1330168).
7070
- Added the receiver motion rejection toggle to RTGI (case 1330168).
7171
- 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.
72+
- Added a dialog box when you import a Material that has a diffusion profile to add the diffusion profile to global settings.
7273

7374
### Fixed
7475
- Fixed Intensity Multiplier not affecting realtime global illumination.

com.unity.render-pipelines.high-definition/Editor/AssetProcessors/MaterialPostProcessor.cs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,68 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse
362362
if (!HDShaderUtils.IsHDRPShader(material.shader, upgradable: true))
363363
continue;
364364

365+
366+
void AddDiffusionProfileToSettings(string propName)
367+
{
368+
if (Application.isBatchMode || HDRenderPipelineGlobalSettings.instance == null
369+
|| HDRenderPipelineGlobalSettings.instance.diffusionProfileSettingsList == null) return;
370+
371+
bool diffusionProfileCanBeAdded = HDRenderPipelineGlobalSettings.instance.diffusionProfileSettingsList.Length < 15;
372+
DiffusionProfileSettings diffusionProfile = null;
373+
374+
if (material.HasProperty(propName))
375+
{
376+
var diffusionProfileAsset = material.GetVector(propName);
377+
string guid = HDUtils.ConvertVector4ToGUID(diffusionProfileAsset);
378+
diffusionProfile = AssetDatabase.LoadAssetAtPath<DiffusionProfileSettings>(AssetDatabase.GUIDToAssetPath(guid));
379+
380+
if (diffusionProfile != null && !HDRenderPipelineGlobalSettings.instance.diffusionProfileSettingsList.Any(d => d == diffusionProfile))
381+
{
382+
string materialName = material.name;
383+
string diffusionProfileName = diffusionProfile.name;
384+
385+
if (!diffusionProfileCanBeAdded)
386+
Debug.LogWarning("There is no space in the global settings to add the diffusion profile " + diffusionProfileName);
387+
else if ((!Application.isBatchMode) &&
388+
(EditorUtility.DisplayDialog("Diffusion Profile Import",
389+
"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")))
390+
{
391+
diffusionProfileCanBeAdded = HDRenderPipelineGlobalSettings.instance.AddDiffusionProfile(diffusionProfile);
392+
}
393+
}
394+
}
395+
}
396+
397+
AddDiffusionProfileToSettings("_DiffusionProfileAsset");
398+
399+
// Special Eye case that uses a node with diffusion profiles.
400+
if (material.shader.IsShaderGraphAsset())
401+
{
402+
var matProperties = MaterialEditor.GetMaterialProperties(new UnityEngine.Object[] { material });
403+
for (int propIdx = 0; propIdx < matProperties.Length; ++propIdx)
404+
{
405+
var attributes = material.shader.GetPropertyAttributes(propIdx);
406+
bool hasDiffusionProfileAttribute = false;
407+
foreach (var attribute in attributes)
408+
{
409+
if (attribute == "DiffusionProfile")
410+
{
411+
propIdx++;
412+
hasDiffusionProfileAttribute = true;
413+
break;
414+
}
415+
}
416+
417+
var propName = ShaderUtil.GetPropertyName(material.shader, propIdx);
418+
var type = ShaderUtil.GetPropertyType(material.shader, propIdx);
419+
if (hasDiffusionProfileAttribute &&
420+
type == ShaderUtil.ShaderPropertyType.Vector)
421+
{
422+
AddDiffusionProfileToSettings(propName);
423+
}
424+
}
425+
}
426+
365427
(HDShaderUtils.ShaderID id, GUID subTargetGUID) = HDShaderUtils.GetShaderIDsFromShader(material.shader);
366428
var latestVersion = k_Migrations.Length;
367429

0 commit comments

Comments
 (0)