Hello Guys
I am working in a new shading model, but I require to send more data over the GBuffer using the available GBuffer.CustomData variable, the first thing I did was enable a 32 bit buffer so I did modify the function: FSceneRenderTargets::AllocGBufferTargets and that make me able to send values bigger than 0-1, I am using this PF_A32B32G32R32F and now the next step is trying to encode a float3 into a float and force that into, for that I am using the next functions:
float ToonPackColor(float3 color) {
return color.r + color.g * 256.0 + color.b * 256.0 * 256.0;
}
float3 ToonUnpackColor(float f) {
float3 color;
color.b = floor(f / 256.0 / 256.0);
color.g = floor((f - color.b * 256.0 * 256.0) / 256.0);
color.r = floor(f - color.b * 256.0 * 256.0 - color.g * 256.0);
// now we have a vec3 with the 3 components in range [0..255]. Let's normalize it!
return color / 255.0;
}
but it does not matter what I do, I cannot get the values back to use them, at this point I am a bit lost, those function are working perfectly in the material editor but not inside the GBuffer.
If someone please has a suggestion or know how to do that, it will be greatly appreciated
Cheers