Unreal Engine Buffers/Passing values.

Hi,

I am currently implementing a drone simulator and I am working on some sensors. Right now I am working on infrared camera, and I have a problem with passing data about objects.

The scene is quite big and uses great amount of assets from marketplace so I cannot guarentee that there will be some pin in material which won’t be used and I need somehow to pass the data about emissivity and temperature. Also I am not able to change materials of the objects manually, so CPD is not really an option

The only solution I found is to use stencil and then in postprocess material retrieve this information by id from the texture, but it limits the amount of the objects to 255 which is quite good (introducing regex helps), but still is not perfect since I want the number of different objects been unlimited.

Maybe there is completely different solution how to pass float values to post process material?

UE 5.7 is used.

Stencil is a class id, not an object id, and that is the split that actually works for an IR camera.

Custom Depth Stencil is 8 bits (0-255). Custom Primitive Data, or a spare pin in the material, would give you real floats, but the material has to sample them. Marketplace materials will not, and you said you cannot edit them, so CPD is correctly off the table. Custom Depth itself cannot hold an arbitrary float either. It stores geometric depth.

What works without touching those materials:

  1. Bin by physical class, not by actor. Concrete, skin, metal, vegetation, glass, a hot engine. An IR sim needs emissivity and temperature per class much more often than per instance. On each primitive set Render Custom Depth and a Custom Depth Stencil Value (from C++ or a small actor component, no material edit). In the post process, use that stencil as the U coordinate into a 256-wide lookup texture (R = temperature, G = emissivity). The lookup is what turns the id into the floats. 255 classes is a lot of IR materials. You only spend a unique stencil value on the few things that are actually unique (a person, a running engine). Everything else shares a class, so you will not run out.

  2. If you truly need a different float on every instance, do not pack it into the main view. Add a second Scene Capture that matches the IR camera (same FOV, same transform) and set Show Only Components to a list of proxy meshes. Each proxy uses one unlit material you own, with a material instance: emissive R = temperature, G = emissivity. Capture Source Base Color or Final Color is fine, because unlit makes them the same. The main camera keeps the marketplace materials. There is no 255 cap, because the values live in the material instance, not in the stencil. Proxies can be the real mesh, or a bounds box if the sensor is low resolution. This is the same pattern as a segmentation camera.

UE 5.7 has no post-process input for per-primitive user data unless the base material wrote it into a custom GBuffer output, which again needs a pin those marketplace materials do not have.

(post deleted by author)

Thank you for your answer, I just wanted to clarify one thing: Even if I was allowed to change materials of some objects, it wouldn’t help me with materials from the store, because they don’t allow to change them? Or it depends on the asset creator?