Forum

Renderer (Offscreen) -> DrawImage -> SkiaTexture not showing a texture but stays black

I am using a Renderer (Offscreen) → DrawImage → SkiaTexture to convert a SkiaTexture to a Stride Quad Renderer where the renderer stays black. Connecting the Rectangle or other layers before the Offscreen-Renderer does work without a problem.

Screen recording: recording.7z (914.1 KB)

VL Patch HowTo Map a projection using Homography_SKIA.vl (40.7 KB)

Works in 2021.3.3.

I guess you need the new “low level node” ToRasterImage before your DrawImage, then it worked for me in the Preview.

1 Like

What @bildwerk suggests is the correct way now. In 2021.3 the Renderer (Offscreen) node was marked as experimental and did a software rendering - the returned Skia image was stored in CPU memory. In 2021.4 we changed that node to use hardware accelerated rendering - the returned Skia image is backed by GPU memory. However that GPU memory is context specific. Skia and Stride use different contexts, therefor a read access to such GPU backed images (DrawImage) will fail if accessed from a context different to the one it was created in. The solution is to first download that image to CPU memory (using the ToRasterImage node) which can then be accessed by the other contexts as well. Watch out that you’ll find two ToRasterImage nodes in the node browser, please use the process node as it will control the image’s lifetime in a deterministic way and not leave it to the garbage collector to clean it up.

The download from GPU to CPU will probably incur a rather heavy performance hit. So depending on the image size it might not be a viable solution for you. If that is the case we’ll need to think of other solutions.

@bildwerk @Elias Thanks a lot! Works so far even if you’re right with the performance and with my current setup full-hd would already go down to a framerate of lowet than 30fps.
HowTo Map a projection using Homography_SKIA_002.vl (42.3 KB)

But in this case no bug. :)

For further ideas to find a better way/better performance to realize a simple 2d-mapping with homography in Skia, there is probably a better place here: Suggestions for new content and improvements for the Help Browser (topics, keywords, terms, HowTo patch ideas, ...) - #7 by benju

the original patch can be simplified like that:

image

just render directly into the skia texture and skip the offscreen renderer…

HowTo Map a projection using Homography_SKIA.vl (33.6 KB)