Scalar - Vector Operations
Task
Your goal is to multiply the color by 2 to make it brighter, and then use the result as the final pixel color.
Theory
In both GLSL and HLSL, you can multiply or divide a vector by a scalar (a single number). This operation is component-wise, meaning the scalar is applied to each element of the vector individually.
$ \vec{V} \cdot scalar = \begin{bmatrix}V_x \cdot scalar \ V_y \cdot scalar \ V_z \cdot scalar \end{bmatrix} $
GLSL Example
vec3 color = vec3(0.5, 0.2, 0.8);
// multiply each component by 2.0
vec3 brighter = color * 2.0; // (1.0, 0.4, 1.6)
// divide each component by 2.0
vec3 dimmer = color / 2.0; // (0.25, 0.1, 0.4)
HLSL Example
float3 color = float3(0.5, 0.2, 0.8);
// multiply each component by 2.0
float3 brighter = color * 2.0; // (1.0, 0.4, 1.6)
// divide each component by 2.0
float3 dimmer = color / 2.0; // (0.25, 0.1, 0.4)