private void Update(EvaluationContext context) { // Parameters var parameterBufferContent = new PbrMaterialParams { BaseColor = BaseColor.GetValue(context), EmissiveColor = EmissiveColor.GetValue(context), Roughness = Roughness.GetValue(context), Specular = Specular.GetValue(context), Metal = Metal.GetValue(context) }; ResourceManager.Instance().SetupConstBuffer(parameterBufferContent, ref _parameterBuffer); // Textures var resourceManager = ResourceManager.Instance(); var device = resourceManager.Device; Utilities.Dispose(ref _baseColorMapSrv); var tex = BaseColorMap.GetValue(context) ?? PbrContextSettings.WhitePixelTexture; _baseColorMapSrv = new ShaderResourceView(device, tex); context.PbrMaterialTextures.AlbedoColorMap = _baseColorMapSrv; Utilities.Dispose(ref _normalMapSrv); var tex2 = NormalMap.GetValue(context) ?? PbrContextSettings.NormalFallbackTexture; _normalMapSrv = new ShaderResourceView(device, tex2); context.PbrMaterialTextures.NormalMap = _normalMapSrv; Utilities.Dispose(ref _rsmoMapSrv); var tex3 = RoughnessSpecularMetallicOcclusionMap.GetValue(context) ?? PbrContextSettings.RsmoFallbackTexture; _rsmoMapSrv = new ShaderResourceView(device, tex3); context.PbrMaterialTextures.RoughnessSpecularMetallicOcclusionMap = _rsmoMapSrv; Utilities.Dispose(ref _emissiveColorMapSrv); var tex4 = EmissiveColorMap.GetValue(context) ?? PbrContextSettings.WhitePixelTexture; _emissiveColorMapSrv = new ShaderResourceView(device, tex4); context.PbrMaterialTextures.EmissiveColorMap = _emissiveColorMapSrv; var previousParameters = context.PbrMaterialParams; context.PbrMaterialParams = _parameterBuffer; SubTree.GetValue(context); context.PbrMaterialParams = previousParameters; }