Download

How many bits per channel?

I have come into the unsavory situation of having to overstuff my channels. Namely I am creating dynamic water ripples and to cut a long story short, I store the dynamic normal data in the R and G channels, the height of the ripple-causer in B (to avoid showing the ripple if the surface is too far above or below the limb causing the ripple) and A is for alpha, as my ripple texture has a smooth fade. I output this as a particle system off-screen, a SceneCapture2D actor set to only capture particles and translucency grabs it and I put it in a render texture. My water shader reads that texture and applies the normal map on top of the rest.

The problem is that I need more info, specifically displacement. I am thinking that it could share the blue channel with the height, half the bits for each. Question is just - how many bits does UE4 store per channel in a render texture with HDR compression… 32?

Best regards,
Damir H.

I would guess it’s use rgba16f. “DXGI_FORMAT_R16G16B16A16_FLOAT
A four-component, 64-bit floating-point format that supports 16 bits per channel including alpha.”
But you could split blue channel to integer and fractional part. Then you can handle other HDR formats too without code change.


DisplacementValue = floor(tex.b)
height = frac(tex.b)

I guess that could work. To avoid having only integers in the integer part I could take a float displacement and multiply it by 1000, then divide it by 1000 back in the shader. This sounds like a good solution…