Compositor: Set W to 1 in Float to Vector conversion
Set the w component to 1 in Float to Vector implicit conversion for the Realtime Compositor. That's because the Vector Output node expects a vector for the velocity input, but the CPU compositor fakes it as a color input, while assumes a fourth component of 1.
This commit is contained in:
@@ -49,8 +49,8 @@ class ConversionOperation : public SimpleOperation {
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Convert Float to Vector Operation
|
||||
*
|
||||
* Takes a float result and outputs a vector result. All three components of the output are filled
|
||||
* with the input float.
|
||||
* Takes a float result and outputs a vector result. The first three components of the output are
|
||||
* filled with the input float, while the fourth component is set to 1.
|
||||
* \{ */
|
||||
|
||||
class ConvertFloatToVectorOperation : public ConversionOperation {
|
||||
|
||||
@@ -98,7 +98,7 @@ ConvertFloatToVectorOperation::ConvertFloatToVectorOperation(Context &context)
|
||||
|
||||
void ConvertFloatToVectorOperation::execute_single(const Result &input, Result &output)
|
||||
{
|
||||
output.set_vector_value(float4(float3(input.get_float_value()), 0.0f));
|
||||
output.set_vector_value(float4(float3(input.get_float_value()), 1.0f));
|
||||
}
|
||||
|
||||
GPUShader *ConvertFloatToVectorOperation::get_conversion_shader() const
|
||||
|
||||
@@ -19,7 +19,7 @@ GPU_SHADER_CREATE_INFO(compositor_convert_float_to_float)
|
||||
GPU_SHADER_CREATE_INFO(compositor_convert_float_to_vector)
|
||||
.additional_info("compositor_convert_shared")
|
||||
.image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img")
|
||||
.define("CONVERT_EXPRESSION(value)", "vec4(vec3_from_float(value.x), 0.0)")
|
||||
.define("CONVERT_EXPRESSION(value)", "vec4(vec3_from_float(value.x), 1.0)")
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(compositor_convert_float_to_color)
|
||||
|
||||
Reference in New Issue
Block a user