Forum

VL.Stride.TextureArray

Hi, tried to create a TextureArray for VL.Stride.

For now there is a working blocking version that creates a TextureArray from given files and one that does the same for given Textures.
The texture version is very costly - because it doesn’t make use of staging textures I guess (couldn’t get that to work).
Neither version does work async. Would really appreciate if some wizard could get that working.
Maybe some completely different approach is necessary for it to work.

Inspiration:

Edit:
Now contains a version that uses GraphicsContext.CommandList.CopyRegion.
TextureArray_1.1.7z (3.2 MB)

the method that copies texture subresources is this: CommandList.CopyRegion

a usage example is here: Stride.Engine/Rendering/Skyboxes/CubemapRendererBase.cs#L85

I had a look into the SRgb issue and that was easy to fix. please try with latest: https://visualprogramming.net

Yep works thanks. Any idea why the jpgs are loaded as BGRA?

BGR is the natural order most images are stored on disk. If you load bitmaps, jpg or png on skia or opencv, they are also BGR: https://superuser.com/questions/904978/does-the-jpeg-file-format-support-rgb-data

So it just loads much faster if you don’t have to touch each pixel and re-order it.

Could be an option, though, but I don’t know whether Stride has functionality to do that automatically.

Updated the original post with a version using CommandList.CopyRegion.

Thanks for the effort, the nodes seem to run quite stable now. one nice to have would be an automatic rescale of the textures to a specific size, so one can add any textures to build an array.

and here is a solution for your other question, how to render an array texture with instancing:

RenderTextureArray.7z (3.2 MB)

needs the latest preview to run, it adds an easy way to manually add any kind of input value to custom shader fx nodes: https://visualprogramming.net

1 Like

Is there a way to make RenderTexture create MipMaps (like with Renderer (DX11 TempTarget))? Tried setting them on the Texture2D inside but it borks the texture.

no, this is still an open issue: https://github.com/vvvv/VL.Stride/issues/215

however, if you create the textures on GPU you can probably not set the immutable flag, which can be a big performance hit. so when you load textures and they aren’t dynamic, it’s better to rescale on CPU and create immutable textures. but not sure whether the stride image type has a resize method…