How do I add Tony McMapface tonemapper to UE 4.27?

Hello,

I got Tony McMapface tonemapper from Github.

It’s a .dds LUT file and a .HLSL file. I converted .dds to .tga since UE4 doesn’t recognize the format.

The custom node has this code

//Texture3D tony;
SamplerState sampler_linear_clamp;

// Apply a non-linear transform that the LUT is encoded with.
float3 encoded = stimulus / (stimulus + 1.0);

// Align the encoded range to texel centers.
float LUT_DIMS = 48.0;
float3 uv = encoded * ((LUT_DIMS - 1.0) / LUT_DIMS) + 0.5 / LUT_DIMS;

// Note: for OpenGL, do uv.y = 1.0 - uv.y

return tony.SampleLevel(sampler_linear_clamp, uv, 0);

And I’m getting a [SM5] D3DCompile exception error.