Mikhail Yanakayev
Topic Author
Posts: 4
Joined: 20 Sep 2023, 12:13

Dynamic texture loading with fallback local image

13 Oct 2024, 17:13

Hello! We're using DynamicTextureSource for rendering our image rendered into texture. Also we want to show some default local image while real texture is loading in separate thread. Problem is we don't have any way to get some Noesis::Texture object from BitmapImage with local value to show it in DynamicTextureSource until our real image is loaded.
Do you have tips how to do it better? Converter? Texture provider? Something else?
Some examples would be appreciated.
Thank you!
 
User avatar
jsantos
Site Admin
Posts: 4095
Joined: 20 Jan 2012, 17:18
Contact:

Re: Dynamic texture loading with fallback local image

15 Oct 2024, 13:05

For asynchronous texture loading, we recommend using the hot-reloading mechanism provided by the texture providers, as explained here.

Could you clarify why you're using DynamicTextureSource? This class is typically used when you need to dynamically update a render texture with the GPU, such as for video rendering
 
Mikhail Yanakayev
Topic Author
Posts: 4
Joined: 20 Sep 2023, 12:13

Re: Dynamic texture loading with fallback local image

15 Oct 2024, 17:25

Actually, we're using it because we need rendering Noesis::Texture into Image. AFAIK, there are only 2 variants:
1. BitmapImage that doesn't have any textures under it
2. DynamicTextureSource, that allows to render into texture and display it. Even if texture was rendered just once (as we do)

If I'm wrong, please correct me

Also there's another question, if we can call PropertyChanged callback for only visible elements of ScrollViewer any time when elements are scrolled? Or, maybe, add/remove invisible elements dynamically?
 
User avatar
jsantos
Site Admin
Posts: 4095
Joined: 20 Jan 2012, 17:18
Contact:

Re: Dynamic texture loading with fallback local image

15 Oct 2024, 20:06

Actually, we're using it because we need rendering Noesis::Texture into Image. AFAIK, there are only 2 variants:
Have you tried using a TextureSource for this? If you have a Texture object, created with your renderer or from your texture provider, you can easily pass it to the TextureSource.
Also there's another question, if we can call PropertyChanged callback for only visible elements of ScrollViewer any time when elements are scrolled? Or, maybe, add/remove invisible elements dynamically?
Do you have a performance problem if you call PropertyChanged for all elements (not only visible) ?
 
Mikhail Yanakayev
Topic Author
Posts: 4
Joined: 20 Sep 2023, 12:13

Re: Dynamic texture loading with fallback local image

15 Oct 2024, 21:00

Have you tried using a TextureSource for this? If you have a Texture object, created with your renderer or from your texture provider, you can easily pass it to the TextureSource.
For now, for debug purposes, we need DynamicTexture. But in the future I'll consider this variant, thank you!
Do you have a performance problem if you call PropertyChanged for all elements (not only visible) ?
For now, PropertyChanged called for every element when we add it and change Source for Image inside it. Inside it we set either BitmapImage or DynamicTextureSource as Image source. But it occurs only during element addition.
It would be great for memory to unload textures for elements that become invisible in ScrollViewer and replace them back by BitmapImage.
And yeah, we've thought about just replacing rendered Texture with dummy Texture inside DynamicTextureSource's Render callback depending on element visibility. but unfortunately it's complicated to load dummy texture as Texture with our architecture, so now I wonder if some another solution exists.
 
User avatar
jsantos
Site Admin
Posts: 4095
Joined: 20 Jan 2012, 17:18
Contact:

Re: Dynamic texture loading with fallback local image

21 Oct 2024, 12:47

I don't think using DynamicTextureSource is a good idea in this scenario. What renderer implementation are you using? Could you just handle the textures externally to Noesis and just wrap then into a Noesis texture using somethng like D3D11Factory::WrapTexture?
 
Mikhail Yanakayev
Topic Author
Posts: 4
Joined: 20 Sep 2023, 12:13

Re: Dynamic texture loading with fallback local image

21 Oct 2024, 13:47

Yeah, we can wrap our engine textures into Noesis::Texture. But now problem actually solved by some changes inside the game outside of Noesis. We just loading our dummy texture and show it for any visible element while actual textures are rendering. I guess, for now this thread can be closed. If some related tasks will appear, I'll ask.
Thank you!
 
User avatar
jsantos
Site Admin
Posts: 4095
Joined: 20 Jan 2012, 17:18
Contact:

Re: Dynamic texture loading with fallback local image

21 Oct 2024, 16:39

Thanks for the feedback!

Who is online

Users browsing this forum: Bing [Bot] and 8 guests