public void Denoise() { //this.progressBar1.Value = 0; //this.lock_Buttons(); //if (!Directory.Exists("Cache")) Directory.CreateDirectory("Cache"); //int Get(int i) => (byte)Mathf.Range(main.buff[i] * 255 / main.Changes[i / 4] + 0.5f, 0, 255f); //var pic = new Bitmap(width, height, PixelFormat.Format32bppArgb); //for (var i = 0; i < main.buff.Length; i += 4) //{ // var c = Color.FromArgb(Get(i + 3), Get(i + 2), Get(i + 1), Get(i)); // pic.SetPixel(i % (width * 4) / 4, i / (width * 4), c); //} //pic.Save("Cache/img.png"); Denoiser.input_image = "Cache/img.png"; Denoiser.output_image = "Cache/de_img.png"; Denoiser.blend = (float)10 / 100f; Denoiser.Denoise(ImageCallBack, ProgressCallBack, DenoiseFinishedCallBack); }
internal DenoiserShould(Denoiser denoiser) : base(denoiser) { this.denoiser = denoiser; }
public override void OnInspectorGUI() { HDRenderPipelineAsset currentAsset = HDRenderPipeline.currentAsset; if (!currentAsset?.currentPlatformRenderPipelineSettings.supportRayTracing ?? false) { EditorGUILayout.Space(); EditorGUILayout.HelpBox("The current HDRP Asset does not support Ray Tracing.", MessageType.Error, wide: true); return; } // If ray tracing is supported display the content of the volume component if (HDRenderPipeline.assetSupportsRayTracing) { PropertyField(m_Enable); if (m_Enable.overrideState.boolValue && m_Enable.value.boolValue) { using (new IndentLevelScope()) { PropertyField(m_LayerMask); PropertyField(m_MaxSamples); PropertyField(m_MinDepth); PropertyField(m_MaxDepth); PropertyField(m_MaxIntensity); PropertyField(m_SkyImportanceSampling); #if ENABLE_UNITY_DENOISING_PLUGIN PropertyField(m_Denoising); var denoiserType = m_Denoising.value.GetEnumValue <DenoiserType>(); bool supported = Denoiser.IsDenoiserTypeSupported(denoiserType); if (m_Denoising.value.intValue != (int)DenoiserType.None) { using (new IndentLevelScope()) { if (supported) { PropertyField(m_UseAOV); if (m_Denoising.value.intValue == (int)DenoiserType.Optix) { PropertyField(m_Temporal); } } else { EditorGUILayout.HelpBox($"The denoiser selected is not supported by this hardware configuration.", MessageType.Error, wide: true); } } } #else CoreEditorUtils.DrawFixMeBox("Path Tracing Denoising is not active in this project. To activate it, install the Unity Denoising Plugin package.", MessageType.Info, () => { PackageManager.Client.Add("com.unity.rendering.denoising"); }); #endif } // Make sure MaxDepth is always greater or equal than MinDepth m_MaxDepth.value.intValue = Math.Max(m_MinDepth.value.intValue, m_MaxDepth.value.intValue); } } }