I am setting up a shader that renders to an MRT, but the second and third outputs are having the alpha channel applied over the other channels (e.g. setting value.a = 0.5 is being multiplied with the value.rgb when read by following shaders.) I don't want these outputs interpreted as colour.
The pixel shader is setting up the outputs like this:
Code: Select all
layout(location = FRAG_COLOR, index = 0) out vec4 outColour;
layout(location = 1) out vec4 oNormal ;
layout(location = 2) out vec4 oViewPos ;
Code: Select all
oNormal = vec4 ( 1, 0, 0, 0.5 );
The MRT is setup like this in the first compositor:
Code: Select all
texture rtt target_width target_height PF_R8G8B8 PF_FLOAT32_RGBA PF_FLOAT32_RGBA depth_format PF_D32_FLOAT_X24_S8_UINT depth_texture depth_pool 1
Code: Select all
compositor_node TestWrite
{
in 0 rtt
in 1 rtt_depthbuffer
in 2 rt_renderwindow
target rt_renderwindow
{
pass clear
{
colour_value 0 0 0 1
}
pass render_quad
{
material Ogre/Copy/4xFP32
input 0 rtt 1
}
}
}
workspace TestWorkspace
{
connect TestRender 0 1 TestWrite 0 1
connect_output TestWrite 2
}
Code: Select all
fragColour = vec4(vec3(texture( tex, inPs.uv0 ).rgb), 1);
I do not want the oNormal output to be interpreted as a colour, I just want to read its data as individual channels. If I set the oNormal.a = 1.0 then everything is rendered as expected, but setting oNormal.a = 0.0 will set all of the RGB data to 0.0. I have tried a couple of other texture formats for the MRT with no success.
Is there something I am missing to get the RGBa values all read by the TestWrite shader the same as they are written?