Exemplo n.º 1
0
        protected void BlitMixtureIcon(Texture preview, RenderTexture target, bool realtime = false)
        {
            var blitMaterial = (realtime) ? MixtureUtils.blitRealtimeIconMaterial : MixtureUtils.blitIconMaterial;

            MixtureUtils.SetupDimensionKeyword(blitMaterial, preview.dimension);

            switch (preview.dimension)
            {
            case TextureDimension.Tex2D:
                blitMaterial.SetTexture("_Texture2D", preview);
                Graphics.Blit(preview, target, blitMaterial, 0);
                break;

            case TextureDimension.Tex2DArray:
                blitMaterial.SetTexture("_Texture2DArray", preview);
                Graphics.Blit(preview, target, blitMaterial, 0);
                break;

            case TextureDimension.Tex3D:
                blitMaterial.SetTexture("_Texture3D", preview);
                Graphics.Blit(preview, target, blitMaterial, 0);
                break;

            case TextureDimension.Cube:
                blitMaterial.SetTexture("_Cubemap", preview);
                Graphics.Blit(preview, target, blitMaterial, 0);
                break;

            default:
                Debug.LogError($"{preview.dimension} is not supported for icon preview");
                break;
            }
        }
Exemplo n.º 2
0
        protected override bool ProcessNode()
        {
            UpdateTempRenderTexture(ref output);

            if (material == null || material.shader == null)
            {
                Debug.LogError($"Can't process {name}, missing material/shader.");
                return(false);
            }

            var outputDimension = rtSettings.GetTextureDimension(graph);

            MixtureUtils.SetupDimensionKeyword(material, outputDimension);

#if UNITY_EDITOR // IsShaderCompiled is editor only
            if (!IsShaderCompiled(material.shader))
            {
                output.material = null;
                Debug.LogError($"Can't process {name}, shader has errors.");
                LogShaderErrors(material.shader);
            }
            else
#endif
            {
                output.material = material;
            }

            return(true);
        }
        public override void OnInteractivePreviewGUI(Rect previewRect, GUIStyle background)
        {
            HandleZoomAndPan(previewRect);

            if (firstLockedPreviewTarget?.previewTexture != null && e.type == EventType.Repaint)
            {
                MixtureUtils.SetupDimensionKeyword(previewMaterial, firstLockedPreviewTarget.previewTexture.dimension);

                // Set texture property based on the dimension
                MixtureUtils.SetTextureWithDimension(previewMaterial, "_MainTex0", firstLockedPreviewTarget.previewTexture);
                MixtureUtils.SetTextureWithDimension(previewMaterial, "_MainTex1", secondLockedPreviewTarget.previewTexture);

                previewMaterial.SetFloat("_ComparisonSlider", compareSlider);
                previewMaterial.SetFloat("_ComparisonEnabled", compareEnabled ? 1 : 0);
                previewMaterial.SetFloat("_CompareMode", (int)compareMode);
                previewMaterial.SetFloat("_PreviewMip", mipLevel);
                previewMaterial.SetFloat("_YRatio", previewRect.height / previewRect.width);
                previewMaterial.SetFloat("_Zoom", zoom);
                previewMaterial.SetVector("_Pan", shaderPos / previewRect.size);
                previewMaterial.SetFloat("_FilterMode", (int)filterMode);
                previewMaterial.SetFloat("_Exp", exposure);
                previewMaterial.SetVector("_TextureSize", new Vector4(firstLockedPreviewTarget.previewTexture.width, firstLockedPreviewTarget.previewTexture.height, 1.0f / firstLockedPreviewTarget.previewTexture.width, 1.0f / firstLockedPreviewTarget.previewTexture.height));
                previewMaterial.SetVector("_Channels", MixtureEditorUtils.GetChannelsMask(channels));
                previewMaterial.SetFloat("_IsSRGB0", firstLockedPreviewTarget is OutputNode o0 && o0.mainOutput.sRGB ? 1 : 0);
                previewMaterial.SetFloat("_IsSRGB1", secondLockedPreviewTarget is OutputNode o1 && o1.mainOutput.sRGB ? 1 : 0);
                EditorGUI.DrawPreviewTexture(previewRect, Texture2D.whiteTexture, previewMaterial);
            }
            else
            {
                EditorGUI.DrawRect(previewRect, new Color(1, 0, 1, 1));
            }
        }
Exemplo n.º 4
0
        protected override bool ProcessNode(CommandBuffer cmd)
        {
            if (!base.ProcessNode(cmd) || input == null)
            {
                return(false);
            }

            HistogramUtility.ComputeLuminanceMinMax(cmd, minMaxBuffer, input);
            TextureUtils.UpdateTextureFromCurve(interpolationCurve, ref curveTexture);

            var mat = tempRenderTexture.material = GetTempMaterial("Hidden/Mixture/Levels");

            mat.SetFloat("_Mode", (int)mode);
            mat.SetFloat("_ManualMin", min);
            mat.SetFloat("_ManualMax", max);
            mat.SetVector("_RcpTextureSize", new Vector4(1.0f / input.width, 1.0f / input.height, 1.0f / TextureUtils.GetSliceCount(input), 0));
            MixtureUtils.SetupDimensionKeyword(mat, tempRenderTexture.dimension);
            MixtureUtils.SetTextureWithDimension(mat, "_Input", input);
            mat.SetBuffer("_Luminance", minMaxBuffer);
            mat.SetTexture("_InterpolationCurve", curveTexture);

            tempRenderTexture.Update();
            CustomTextureManager.UpdateCustomRenderTexture(cmd, tempRenderTexture);

            output = tempRenderTexture;

            return(true);
        }
Exemplo n.º 5
0
        protected override bool ProcessNode(CommandBuffer cmd)
        {
            if (output == null)
            {
                return(false);
            }

            var outputDimension = rtSettings.GetTextureDimension(graph);

            MixtureUtils.SetupDimensionKeyword(material, outputDimension);

            var s = material.shader;

            for (int i = 0; i < s.GetPropertyCount(); i++)
            {
                if (s.GetPropertyType(i) != ShaderPropertyType.Texture)
                {
                    continue;
                }

                int id = s.GetPropertyNameId(i);
                if (material.GetTexture(id) != null)
                {
                    continue;                     // Avoid overriding existing textures
                }
                var dim = s.GetPropertyTextureDimension(i);
                if (dim == TextureDimension.Tex2D)
                {
                    continue;                     // Texture2D don't need this feature
                }
                // default texture names doesn't work with cubemap and 3D textures so we do it ourselves...
                switch (s.GetPropertyTextureDefaultName(i))
                {
                case "black":
                    material.SetTexture(id, TextureUtils.GetBlackTexture(dim));
                    break;

                case "white":
                    material.SetTexture(id, TextureUtils.GetWhiteTexture(dim));
                    break;
                    // TODO: grey and bump
                }
            }

            output.material = material;

            bool useCustomUV = material.HasTextureBound("_UV", rtSettings.GetTextureDimension(graph));

            material.SetKeywordEnabled("USE_CUSTOM_UV", useCustomUV);

            return(true);
        }
Exemplo n.º 6
0
        bool UpdateFinalCopyMaterial(OutputTextureSettings targetOutput)
        {
            if (targetOutput.finalCopyMaterial == null)
            {
                targetOutput.finalCopyMaterial = CreateFinalCopyMaterial();
                if (!graph.IsObjectInGraph(targetOutput.finalCopyMaterial))
                {
                    graph.AddObjectToGraph(targetOutput.finalCopyMaterial);
                }
            }

            // Manually reset all texture inputs
            ResetMaterialPropertyToDefault(targetOutput.finalCopyMaterial, "_Source_2D");
            ResetMaterialPropertyToDefault(targetOutput.finalCopyMaterial, "_Source_3D");
            ResetMaterialPropertyToDefault(targetOutput.finalCopyMaterial, "_Source_Cube");

            var input = targetOutput.inputTexture;

            if (input != null)
            {
                if (input.dimension != (TextureDimension)rtSettings.dimension)
                {
                    Debug.LogError("Error: Expected texture type input for the OutputNode is " + graph.mainOutputTexture.dimension + " but " + input?.dimension + " was provided");
                    return(false);
                }

                MixtureUtils.SetupDimensionKeyword(targetOutput.finalCopyMaterial, input.dimension);

                if (input.dimension == TextureDimension.Tex2D)
                {
                    targetOutput.finalCopyMaterial.SetTexture("_Source_2D", input);
                }
                else if (input.dimension == TextureDimension.Tex3D)
                {
                    targetOutput.finalCopyMaterial.SetTexture("_Source_3D", input);
                }
                else
                {
                    targetOutput.finalCopyMaterial.SetTexture("_Source_Cube", input);
                }

                targetOutput.finalCopyMaterial.SetInt("_IsSRGB", targetOutput.sRGB ? 1 : 0);
            }

            if (targetOutput.finalCopyRT != null)
            {
                targetOutput.finalCopyRT.material = targetOutput.finalCopyMaterial;
            }

            return(true);
        }
Exemplo n.º 7
0
        void GenerateCustomMipMaps()
        {
#if UNITY_EDITOR
            mipchainCmd.Clear();

            mipchainCmd.name = "Generate Custom MipMaps";

            if (mipMapPropertyBlock == null)
            {
                mipMapPropertyBlock = new MaterialPropertyBlock();
            }

            int slice = 0;
            // TODO: support 3D textures and Cubemaps
            // for (int slice = 0; slice < tempRenderTexture.volumeDepth; slice++)
            {
                for (int i = 0; i < tempRenderTexture.mipmapCount - 1; i++)
                {
                    int mipLevel = i + 1;
                    mipmapRenderTexture.name = "Tmp mipmap";
                    mipchainCmd.SetRenderTarget(mipmapRenderTexture, mipLevel, CubemapFace.Unknown, 0);

                    Vector4 textureSize = new Vector4(tempRenderTexture.width, tempRenderTexture.height, tempRenderTexture.volumeDepth, 0);
                    textureSize /= 1 << (mipLevel);
                    Vector4 textureSizeRcp = new Vector4(1.0f / textureSize.x, 1.0f / textureSize.y, 1.0f / textureSize.z, 0);

                    mipMapPropertyBlock.SetTexture("_InputTexture_2D", tempRenderTexture);
                    mipMapPropertyBlock.SetTexture("_InputTexture_3D", tempRenderTexture);
                    mipMapPropertyBlock.SetFloat("_CurrentMipLevel", mipLevel - 1);
                    mipMapPropertyBlock.SetFloat("_MaxMipLevel", tempRenderTexture.mipmapCount);
                    mipMapPropertyBlock.SetVector("_InputTextureSize", textureSize);
                    mipMapPropertyBlock.SetVector("_InputTextureSizeRcp", textureSizeRcp);
                    mipMapPropertyBlock.SetFloat("_CurrentSlice", slice / (float)tempRenderTexture.width);

                    MixtureUtils.SetupDimensionKeyword(customMipMapMaterial, tempRenderTexture.dimension);
                    mipchainCmd.DrawProcedural(Matrix4x4.identity, customMipMapMaterial, 0, MeshTopology.Triangles, 3, 1, mipMapPropertyBlock);

                    mipchainCmd.CopyTexture(mipmapRenderTexture, slice, mipLevel, tempRenderTexture, slice, mipLevel);
                }
            }

            // Dirty hack to enqueue the command buffer but it's okay because it's the builtin renderer.
            if (GraphicsSettings.renderPipelineAsset == null)
            {
                Camera.main.RemoveCommandBuffer(CameraEvent.BeforeDepthTexture, mipchainCmd);
                Camera.main.AddCommandBuffer(CameraEvent.BeforeDepthTexture, mipchainCmd);
            }
#endif
        }
Exemplo n.º 8
0
        void GenerateCustomMipMaps(CommandBuffer cmd, OutputTextureSettings targetOutput)
        {
#if UNITY_EDITOR
            if (targetOutput.mipmapTempRT == null || targetOutput.finalCopyRT == null)
            {
                return;
            }

            cmd.BeginSample(generateMipMapSampler);

            if (targetOutput.mipMapPropertyBlock == null)
            {
                targetOutput.mipMapPropertyBlock = new MaterialPropertyBlock();
            }

            int slice = 0;
            // TODO: support 3D textures and Cubemaps
            // for (int slice = 0; slice < targetOutput.finalCopyRT.volumeDepth; slice++)
            {
                for (int i = 0; i < targetOutput.finalCopyRT.mipmapCount - 1; i++)
                {
                    int mipLevel = i + 1;
                    targetOutput.mipmapTempRT.name = "Tmp mipmap";
                    cmd.SetRenderTarget(targetOutput.mipmapTempRT, mipLevel, CubemapFace.Unknown, 0);

                    Vector4 textureSize = new Vector4(targetOutput.finalCopyRT.width, targetOutput.finalCopyRT.height, targetOutput.finalCopyRT.volumeDepth, 0);
                    textureSize /= 1 << (mipLevel);
                    Vector4 textureSizeRcp = new Vector4(1.0f / textureSize.x, 1.0f / textureSize.y, 1.0f / textureSize.z, 0);

                    targetOutput.mipMapPropertyBlock.SetTexture("_InputTexture_2D", targetOutput.finalCopyRT);
                    targetOutput.mipMapPropertyBlock.SetTexture("_InputTexture_3D", targetOutput.finalCopyRT);
                    targetOutput.mipMapPropertyBlock.SetFloat("_CurrentMipLevel", mipLevel - 1);
                    targetOutput.mipMapPropertyBlock.SetFloat("_MaxMipLevel", targetOutput.finalCopyRT.mipmapCount);
                    targetOutput.mipMapPropertyBlock.SetVector("_InputTextureSize", textureSize);
                    targetOutput.mipMapPropertyBlock.SetVector("_InputTextureSizeRcp", textureSizeRcp);
                    targetOutput.mipMapPropertyBlock.SetFloat("_CurrentSlice", slice / (float)targetOutput.finalCopyRT.width);

                    MixtureUtils.SetupDimensionKeyword(targetOutput.customMipMapMaterial, targetOutput.finalCopyRT.dimension);
                    cmd.DrawProcedural(Matrix4x4.identity, targetOutput.customMipMapMaterial, 0, MeshTopology.Triangles, 3, 1, targetOutput.mipMapPropertyBlock);

                    cmd.CopyTexture(targetOutput.mipmapTempRT, slice, mipLevel, targetOutput.finalCopyRT, slice, mipLevel);
                }
            }

            cmd.EndSample(generateMipMapSampler);
#endif
        }
Exemplo n.º 9
0
        public override void OnInteractivePreviewGUI(Rect previewRect, GUIStyle background)
        {
            HandleZoomAndPan(previewRect);

            if (mixtureInspector.firstLockedPreviewTarget?.previewTexture != null && e.type == EventType.Repaint)
            {
                mixtureInspector.volumeCameraMatrix = Matrix4x4.Rotate(Quaternion.Euler(mixtureInspector.cameraYAxis, mixtureInspector.cameraXAxis, 0));

                MixtureUtils.SetupDimensionKeyword(previewMaterial, mixtureInspector.firstLockedPreviewTarget.previewTexture.dimension);

                // Set texture property based on the dimension
                MixtureUtils.SetTextureWithDimension(previewMaterial, "_MainTex0", mixtureInspector.firstLockedPreviewTarget.previewTexture);
                MixtureUtils.SetTextureWithDimension(previewMaterial, "_MainTex1", mixtureInspector.secondLockedPreviewTarget.previewTexture);

                previewMaterial.SetFloat("_ComparisonSlider", mixtureInspector.compareSlider);
                previewMaterial.SetFloat("_ComparisonSlider3D", mixtureInspector.compareSlider3D);
                previewMaterial.SetVector("_MouseUV", mixtureInspector.mouseUV);
                previewMaterial.SetMatrix("_CameraMatrix", mixtureInspector.volumeCameraMatrix);
                previewMaterial.SetFloat("_CameraZoom", mixtureInspector.cameraZoom);
                previewMaterial.SetFloat("_ComparisonEnabled", mixtureInspector.compareEnabled ? 1 : 0);
                previewMaterial.SetFloat("_CompareMode", (int)mixtureInspector.compareMode);
                previewMaterial.SetFloat("_PreviewMip", mixtureInspector.mipLevel);
                previewMaterial.SetFloat("_YRatio", previewRect.height / previewRect.width);
                previewMaterial.SetFloat("_Zoom", mixtureInspector.zoom);
                previewMaterial.SetVector("_Pan", mixtureInspector.shaderPos / previewRect.size);
                previewMaterial.SetFloat("_FilterMode", (int)mixtureInspector.filterMode);
                previewMaterial.SetFloat("_Exp", mixtureInspector.exposure);
                previewMaterial.SetVector("_TextureSize", new Vector4(mixtureInspector.firstLockedPreviewTarget.previewTexture.width, mixtureInspector.firstLockedPreviewTarget.previewTexture.height, 1.0f / mixtureInspector.firstLockedPreviewTarget.previewTexture.width, 1.0f / mixtureInspector.firstLockedPreviewTarget.previewTexture.height));
                previewMaterial.SetVector("_Channels", MixtureEditorUtils.GetChannelsMask(mixtureInspector.channels));
                previewMaterial.SetFloat("_IsSRGB0", mixtureInspector.firstLockedPreviewTarget is OutputNode o0 && o0.mainOutput.sRGB ? 1 : 0);
                previewMaterial.SetFloat("_IsSRGB1", mixtureInspector.secondLockedPreviewTarget is OutputNode o1 && o1.mainOutput.sRGB ? 1 : 0);
                previewMaterial.SetFloat("_PreserveAspect", mixtureInspector.preserveAspect ? 1 : 0);
                previewMaterial.SetFloat("_Texture3DMode", (int)mixtureInspector.texture3DPreviewMode);
                previewMaterial.SetFloat("_Density", mixtureInspector.texture3DDensity);
                previewMaterial.SetFloat("_SDFOffset", mixtureInspector.texture3DDistanceFieldOffset);
                previewMaterial.SetFloat("_SDFChannel", (int)mixtureInspector.sdfChannel);
                previewMaterial.SetFloat("_ShowCubeBackface", mixtureInspector.showCubeBackface ? 1 : 0);
                previewMaterial.SetFloat("_InvertSurface", mixtureInspector.invertSurface ? 1 : 0);
                previewMaterial.SetFloat("_VolumetricDensityChannel", mixtureInspector.volumetricDensityChannel);
                EditorGUI.DrawPreviewTexture(previewRect, Texture2D.whiteTexture, previewMaterial);
            }
            else
            {
                EditorGUI.DrawRect(previewRect, new Color(1, 0, 1, 1));
            }
        }
Exemplo n.º 10
0
        protected override bool ProcessNode()
        {
            if (graph.outputTexture == null)
            {
                Debug.LogError("Output Node can't write to target texture, Graph references a null output texture");
                return(false);
            }

            // Update the renderTexture reference for realtime graph
            if (graph.isRealtime)
            {
                if (tempRenderTexture != graph.outputTexture)
                {
                    onTempRenderTextureUpdated?.Invoke();
                }
                tempRenderTexture = graph.outputTexture as CustomRenderTexture;
            }

            var inputPort = GetPort(nameof(input), nameof(input));

            if (inputPort.GetEdges().Count == 0)
            {
                if (uniqueMessages.Add("OutputNotConnected"))
                {
                    AddMessage("Output node input is not connected", NodeMessageType.Warning);
                }
            }
            else
            {
                uniqueMessages.Clear();
                ClearMessages();
            }

            // Update the renderTexture size and format:
            if (UpdateTempRenderTexture(ref tempRenderTexture, hasMips, customMipMapShader == null))
            {
                onTempRenderTextureUpdated?.Invoke();
            }

            // Manually reset all texture inputs
            ResetMaterialPropertyToDefault(finalCopyMaterial, "_Source_2D");
            ResetMaterialPropertyToDefault(finalCopyMaterial, "_Source_3D");
            ResetMaterialPropertyToDefault(finalCopyMaterial, "_Source_Cube");

            if (input != null && inputPort.GetEdges().Count != 0)
            {
                if (input.dimension != graph.outputTexture.dimension)
                {
                    Debug.LogError("Error: Expected texture type input for the OutputNode is " + graph.outputTexture.dimension + " but " + input?.dimension + " was provided");
                    return(false);
                }

                MixtureUtils.SetupDimensionKeyword(finalCopyMaterial, input.dimension);

                if (input.dimension == TextureDimension.Tex2D)
                {
                    finalCopyMaterial.SetTexture("_Source_2D", input);
                }
                else if (input.dimension == TextureDimension.Tex3D)
                {
                    finalCopyMaterial.SetTexture("_Source_3D", input);
                }
                else
                {
                    finalCopyMaterial.SetTexture("_Source_Cube", input);
                }
            }

            tempRenderTexture.material = finalCopyMaterial;

            // The CustomRenderTexture update will be triggered at the begining of the next frame so we wait one frame to generate the mipmaps
            // We need to do this because we can't generate custom mipMaps with CustomRenderTextures
            if (customMipMapShader != null && hasMips)
            {
                UpdateTempRenderTexture(ref mipmapRenderTexture, true, false);
                GenerateCustomMipMaps();
            }
            else
            {
                Camera.main.RemoveCommandBuffers(CameraEvent.BeforeDepthTexture);
            }

            return(true);
        }
Exemplo n.º 11
0
        protected override bool ProcessNode(CommandBuffer cmd)
        {
            rtSettings.doubleBuffered = true;
            if (!base.ProcessNode(cmd) || input == null)
            {
                return(false);
            }

            TextureUtils.CopyTexture(cmd, input, output, false);

            var mipmapGenMat = GetTempMaterial("Hidden/Mixture/GenerateMipMaps");

            if (mode == Mode.Custom)
            {
                mipmapGenMat = material;
            }
            else
            {
                output.material = null;
            }

            if (mode == Mode.Auto)
            {
                cmd.GenerateMips(output);
            }
            else
            {
                var props = new MaterialPropertyBlock();
                MixtureUtils.SetupDimensionKeyword(mipmapGenMat, rtSettings.GetTextureDimension(graph));
                mipmapGenMat.SetFloat("_Mode", (int)mode);
                MixtureUtils.SetTextureWithDimension(props, "_PreviousMip", input);
                // Manually generate mips:
                for (int i = 0; i < output.mipmapCount - 1; i++)
                {
                    props.SetFloat("_SourceMip", i);
                    float width  = Mathf.Max(1, input.width >> i);
                    float height = Mathf.Max(1, input.width >> i);
                    float depth  = Mathf.Max(1, TextureUtils.GetSliceCount(input) >> i);
                    props.SetVector("_RcpTextureSize", new Vector4(1.0f / width, 1.0f / height, 1.0f / depth, 0.0f));
                    output.material = mipmapGenMat;

                    if (mode == Mode.Gaussian)
                    {
                        // 2 passes of gaussian blur for 2D and Cubemaps
                        props.SetVector("_GaussianBlurDirection", Vector3.right);
                        CustomTextureManager.UpdateCustomRenderTexture(cmd, output, 1, i + 1, props);
                        TextureUtils.CopyTexture(cmd, output.GetDoubleBufferRenderTexture(), output, i + 1);

                        props.SetFloat("_SourceMip", i + 1);
                        MixtureUtils.SetTextureWithDimension(props, "_PreviousMip", output);
                        props.SetVector("_GaussianBlurDirection", Vector3.up);
                        CustomTextureManager.UpdateCustomRenderTexture(cmd, output, 1, i + 1, props);

                        // And a third pass if we're in 3D
                        if (input.dimension == TextureDimension.Tex3D)
                        {
                            props.SetVector("_GaussianBlurDirection", Vector3.forward);
                            TextureUtils.CopyTexture(cmd, output.GetDoubleBufferRenderTexture(), output, i + 1);
                            CustomTextureManager.UpdateCustomRenderTexture(cmd, output, 1, i + 1, props);
                        }
                    }
                    else
                    {
                        CustomTextureManager.UpdateCustomRenderTexture(cmd, output, 1, i + 1, props);
                    }

                    TextureUtils.CopyTexture(cmd, output.GetDoubleBufferRenderTexture(), output, i + 1);
                    MixtureUtils.SetTextureWithDimension(props, "_PreviousMip", output);
                }
            }
            output.material = null;

            return(true);
        }
Exemplo n.º 12
0
        protected override bool ProcessNode()
        {
            if (graph.outputTexture == null)
            {
                Debug.LogError("Output Node can't write to target texture, Graph references a null output texture");
                return(false);
            }

            // Update the renderTexture reference for realtime graph
            if (graph.isRealtime)
            {
                if (tempRenderTexture != graph.outputTexture)
                {
                    onTempRenderTextureUpdated?.Invoke();
                }
                tempRenderTexture = graph.outputTexture as CustomRenderTexture;
            }

            var inputPort = GetPort(nameof(input), nameof(input));

            if (inputPort.GetEdges().Count == 0)
            {
                if (uniqueMessages.Add("OutputNotConnected"))
                {
                    AddMessage("Output node input is not connected", NodeMessageType.Warning);
                }
                input = TextureUtils.GetBlackTexture(rtSettings);
                // TODO: set a black texture of texture dimension as default value
                return(false);
            }
            else
            {
                uniqueMessages.Clear();
                ClearMessages();
            }

            // Update the renderTexture size and format:
            if (UpdateTempRenderTexture(ref tempRenderTexture))
            {
                onTempRenderTextureUpdated?.Invoke();
            }

            if (input.dimension != graph.outputTexture.dimension)
            {
                Debug.LogError("Error: Expected texture type input for the OutputNode is " + graph.outputTexture.dimension + " but " + input?.dimension + " was provided");
                return(false);
            }

            MixtureUtils.SetupDimensionKeyword(finalCopyMaterial, input.dimension);

            // Manually reset all texture inputs
            ResetMaterialPropertyToDefault(finalCopyMaterial, "_Source_2D");
            ResetMaterialPropertyToDefault(finalCopyMaterial, "_Source_3D");
            ResetMaterialPropertyToDefault(finalCopyMaterial, "_Source_Cube");

            if (input.dimension == TextureDimension.Tex2D)
            {
                finalCopyMaterial.SetTexture("_Source_2D", input);
            }
            else if (input.dimension == TextureDimension.Tex3D)
            {
                finalCopyMaterial.SetTexture("_Source_3D", input);
            }
            else
            {
                finalCopyMaterial.SetTexture("_Source_Cube", input);
            }

            tempRenderTexture.material = finalCopyMaterial;

            return(true);
        }