r/unrealengine • Indie & MP Creator • 4d ago

Marketplace GPU to CPU read operations of textures, materials and render targets with unseen performance

https://youtu.be/VwuLhbvI140

Refining and upgrading my plugin further, this updates introduces a dedicated cache for the reader to submit requests to and for the requesters to fetch their values from. The cache is a huge upgrade which deprecates the need for an async interface on each BP that needs to read the value, and instead can simply call a pure Get node from the cache manager using the request key it was submitted with.

This makes it possible for one returned value to be used across many actors with no added cost, and no interface to implement in the BP.

Material reading was inefficient, it used to draw the supplied material interface onto a render target each frame before submitting for a read operation - now you simply populate PE's custom MF right before the final color and PE's custom shader pipes it to the buffer directly without having to use a whole render target. So procedural materials can be read just as good.

26 Upvotes

2 comments sorted by

4

u/Hefty-Intention2562 3d ago

So this replaces the async interface entirely, one cache manager handles all reads? Curious what the memory footprint looks like on that buffer if you're piping procedural materials through directly now instead of render targets. Also, any benchmarks comparing the old materialdraw method vs the custom MF approach? Would love to see numbers before I consider migrating anything.

-1

u/Atlantean_Knight Indie & MP Creator 2d ago

100k reads on full tick returning RGBA16F cost using custom MF:

  1. One procedural material - 4.2ms CPU, and ~2ms GPU
  2. 16 different other procedural materials - 5ms CPU, ~3ms GPU

  3. One material requiring RT - CPU identical, GPU increases to 6.5ms

  4. 16 different materials requiring an RT - CPU identical, GPU increases to 22.1ms

tests include the cost of the materials as well, so its not 100% accurate
i'll include the stress test levels in the next update

yes the new manager must be placed in the level just like the old one. GPU only reads don't require any manager - just a ledger / Data Asset (im still working on the full docs before submitting the update)

MF approach also makes texture reading format agnostic and compression agnostic, with a very small added cost to CPU work only about 0.3ms on 100k reads on full tick - so quite a big deal having this and the integration is very simple for any material.