User avatar
stonstad
Topic Author
Posts: 241
Joined: 06 Jun 2016, 18:14
Location: Lesser Magellanic Cloud
Contact:

Re: Background Effect and Texture Formats w/ HDR

18 May 2023, 19:27

Thank you!

Image


 
public class CopyRenderTexture : MonoBehaviour
{
     public RenderTexture OutputRenderTexture { get; set; }

     private void Awake()
     {
         OutputRenderTexture = new RenderTexture(Screen.width, Screen.height, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear);
         UIStateMachine.Instance.ConfigureRenderTexture(OutputRenderTexture);
     }

     private void OnRenderImage(RenderTexture source, RenderTexture destination)
     {
         Graphics.Blit(source, OutputRenderTexture);
         Graphics.SetRenderTarget(destination);
     }
}
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: Background Effect and Texture Formats w/ HDR

18 May 2023, 20:45

Congratulations! I love the screenshot :)
 
User avatar
stonstad
Topic Author
Posts: 241
Joined: 06 Jun 2016, 18:14
Location: Lesser Magellanic Cloud
Contact:

Re: Background Effect and Texture Formats w/ HDR

25 May 2023, 05:15

Hey JSantos! I just keep bringing this topic up! Thank you for the assistance moving this forward.

After building out my new UI with BackgroundEffect and Blurs I noticed subtle banding in rendered scenes. I'm seeing it with Render texture formats ARGB32, R8G8B8A_UNorm, and a few others, which make senses given they are 8 bits per channel.

If I disable the BackgroundEffect workflow and render straight to the backbuffer, which uses 16-bit per channel precision, I don't see the banding. I think it comes down the lack of 16-bit precision or HDR support in Noesis.

Here is an example of what I am seeing. I increased the brightness to make the banding more visible because, without motion, it is less visible.
Image

Realistically, how likely is it that Noesis will support 16-bit precision or HDR TextureSources? The reason I ask is because I think I might have to revert my use of BackgroundEffect until a remedy exists.

Thank you!
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: Background Effect and Texture Formats w/ HDR

25 May 2023, 14:10

You can keep using the HDR texture for the background and just send the tone mapped SDR version to the BackgroundEffect or at least that's what I understood you were doing.
 
User avatar
stonstad
Topic Author
Posts: 241
Joined: 06 Jun 2016, 18:14
Location: Lesser Magellanic Cloud
Contact:

Re: Background Effect and Texture Formats w/ HDR

25 May 2023, 20:00

> just send the tone mapped SDR version to the BackgroundEffect

I'm binding BackgroundEffectBehavior.Source to a Border control which exists in the visual tree. The Border control updates its Background property from the ImageBrush + TextureSource. Is there a way to point BackgroundEffectBehavior.Source to a UIElement that isn't in the visual tree, or hide the Border element from appearing somehow? I'm not sure I understand what the alternatives are. If it is visible, the blur works but the displayed control overlaps the camera backbuffer.

e.g.
<Grid
  <Border x:Name="source" Background="{DynamicResource BackgroundBlur.Brush.Background}"/>
  <Ellipse Width="600" Height="200">
    <b:Interaction.Behaviors>
      <noesis:BackgroundEffectBehavior Source="{Binding ElementName=source}">
        <BlurEffect Radius="20"/>
      </noesis:BackgroundEffectBehavior>
    </b:Interaction.Behaviors>
  </Ellipse>
</Grid>
 
User avatar
sfernandez
Site Admin
Posts: 2983
Joined: 22 Dec 2011, 19:20

Re: Background Effect and Texture Formats w/ HDR

26 May 2023, 13:20

You shouldn't be rendering the background with the UI, it can be hidden and only available as the source of the effect, something like this:
<Grid
  <Border Opacity="0">
    <Border x:Name="source" Background="{DynamicResource BackgroundBlur.Brush.Background}"/>
  </Border>
  <Ellipse Width="600" Height="200">
    <b:Interaction.Behaviors>
      <noesis:BackgroundEffectBehavior Source="{Binding ElementName=source}">
        <BlurEffect Radius="20"/>
      </noesis:BackgroundEffectBehavior>
    </b:Interaction.Behaviors>
  </Ellipse>
</Grid>
 
User avatar
stonstad
Topic Author
Posts: 241
Joined: 06 Jun 2016, 18:14
Location: Lesser Magellanic Cloud
Contact:

Re: Background Effect and Texture Formats w/ HDR

05 Jul 2023, 17:49

I'm just circling back on this topic. The solution works well but I do run into a problem when I have layered UI with background effect blur. I work around this by rendering to a RenderTexture, and then compositing in Noesis. The downside is that I am once again limited to non-HDR textures in Unity:

Image
I switch between non-HDR and HDR textures based on workflow, but it would be terrific if Unity's HDR format was supported (R16G16B16A16_SFloat). https://docs.unity3d.com/ScriptReferenc ... ltHDR.html

The associated feature request is https://www.noesisengine.com/bugs/view.php?id=2601.

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 85 guests