Rendering a PRef pass from Unreal 5

Hey there, I was wondering if any folks have successfully rendered a “Pref” pass.

You can render a WorldPosition pass as a 32-bit PostProcessMaterial to get the position data of the world, however I’ve been crashing into a few walls trying to do the same for a Pref. The difference with a Pref pass is that it should be the position of your characters in a T-pose and that position data sticks to the skin of your character so that you can generate new passes + textures that always stick to your characters.

Here’s what I’ve tried so far:

  • Pre-Skinned Local Position (plugged into Vertex Interpolation) - this is exactly what needs to be rendered out, it’s a position pass that sticks to your character. Here’s the problem - this is NOT available in a PostProcessMaterial, (Like the WorldPosition pass is) so you can only use this node when it’s on a Material applied onto your characters.

Why this is a problem: to render this out, you would have to plug the Pre-skinned Local Position into a material slot like the Emissive or BaseColor for example. When you do this, all Negative values are immediately clamped, so you lose half of the data from this pass right away, meaning it’s not a viable way to render out this pass.

I’ve tried a few tricks by divide this half by 400 and adding a value of 100 to offset the position values, but when you render this out this hacky “pref” pass gets blocky + compressed, making it unusable for high-quality textures.

It seems like the only way to get the full 32-bit floating point data out is to somehow render this data through a PostProcessMaterial but I haven’t been able to find a working solution.

If anyone has any ideas please let me know! For now, I’ve just been using the Pre-skinned Local Position pass locally in Unreal to render out passes one at a time, but if anyone has cracked the code on this I’d love to learn how!

You can render custom passes with a shader plugin, which can output to a render target.

I’m using this in a plugin I’m working on to take custom material outputs for floating point values I need for shader stuff. That result gets injected into a pre-postprocess for the final render.

It’s not exactly easy though but it probably would be a le to do what you want no problem. Could be worth it if it’s something you’re going to do a lot of.

There might be a shader trick you could use though, like subtracting the world position from the pre skinned position to get the difference between the two, which would be much smaller and be able to remap to the 0-1 range much better. Since the world position is available in the post process You could unpack that without nearly as much precision loss.

You could probably do something with a render target without building a plugin but idk exactly what.

Shaders in Plugins for Unreal Engine | Unreal Engine 5.7 Documentation | Epic Developer Community Shaders in Plugins for Unreal Engine | Unreal Engine 5.7 Documentation | Epic Developer Community