What is the meaning on line 29
float lum=Luminance(col.rgb);
col.rgb is SWIZZLING? so it has (r,g,b)? Why it becomes 'float' not 'float3'?
Hey ssaitot ,
Good question.
RGB has 3 values RED, GREEN and BLUE, hence float3.
Luminance only has 1 value, hence float.
Luminance is the intensity of light emitted from a surface per unit area in a given direction.
Its similar to brightness, where luminance is measured (cd/m^2) giving a single value, brightness is perceived and cannot be measured objectively, but scaled as a percentage.
For the night vision shader, every object is seen in the same shade of green, only with different luminance values (brightness)
I hope this makes sense.
@adrian2301 I do not know how Unity does this, but actually, Luminance is perceived brightness and therer are several definitions/formulae to calculate Luminance from RGB (and there are also several RGB models, so t's a big mess...)
Blender, for instance uses two different Luminances: Shader Editor: RGB to BW Node, which is the same as the Y in the YUVA in the Compositor, but then there is also the Y in the YCbCrA, which is different as you can see here:
I think you are confusing Luminance with Luminosity, Adrian (which is totally understandable, this is sooo confusing and most people get it wrong as soon as they start talking about diiigtal color, including me!)