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: Add manual GenerateMipMaps pass · Issue #377 · vvvv/VL.StandardLibs · GitHub

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…

Updated to work with 2021.3.0.21
RenderTextureArray.7z (3.2 MB)

3 Likes

hi!

what exactly is happening here? Is this a shaderFX compute template that inherits from the external shader file? I was wondering how you output to “GPU float4”. Tried copying the code into a “_ComputeFX” file, but my shader outputs “iRenderer”. do I have do render the compute data like in beta? Or it this the only way to get the “GPU float4” datatype?

cheers

have a look at the HowTo Create a Custom ShaderFX Node help patch.

Added GetSlice and SetSlice for 2D TextureArrays.

VL.Stride.TextureArray.7z (1.4 MB)

4 Likes

This is now part of VL.Addons.

1 Like