Vex luminance function

   1552   5   1
User Avatar
Member
2040 posts
Joined: Sept. 2015
Online
Hello,

Out of curiosity, does anyone know how the luminance function calculates its' values?

I sometimes use this function to drive other attributes I've created, with the input usually being a vector.

I use luminance in this way when I want an average value of the all the vector components and I don't need them to be exactly average, instead of this e.g.:

f@New_Attribute =  (V.x + V.y + V.z) / 3.0;

It just saves me a bit of typing, but…

I was doing a search on luminance and saw a wiki showing a derivative formula.

https://en.wikipedia.org/wiki/Luminance [en.wikipedia.org]

In doing a test and comparing an actual average and the return of the luminance function, there are differences but not big enough to change my use of it for convenience.

Just curious if anyone happens to know what the actual implementation of the luminance function is.

Is it just a specification unique to Houdini or is there some kind of ‘Industry Standard’?


Edit: I don't know Calculus…but the wiki is talking about using surface areas. This makes sense because it's akin to say a photographer wanting to know what the overall ‘luminance’ is of the subjects surface. But when I use the luminance function I'm only giving it a vector. I guess it's taking those 3 components of the vector as geo positions and creating a planar surface from that information, then calculate the area of that as part of its' computations?
Edited by BabaJ - Sept. 18, 2018 14:43:03
User Avatar
Member
7770 posts
Joined: Sept. 2011
Online
Its the dot product with the tristimulous values.

Your looking at the wrong definition of luminance:

https://en.wikipedia.org/wiki/Relative_luminance [en.wikipedia.org]
Edited by jsmack - Sept. 18, 2018 17:42:22
User Avatar
Member
2040 posts
Joined: Sept. 2015
Online
Thank you jsmack.
User Avatar
Member
670 posts
Joined: Sept. 2013
Online
You can also look that up in voplib.h:

float
vop_luminance(color c)
{
    return comp(c, 0)*0.299 + comp(c, 1)*0.587 + comp(c, 2)*0.114;
}
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
2040 posts
Joined: Sept. 2015
Online
Thanks Konstantin,

Seems like Houdini uses slightly different values that what I see on the wiki page:

Y=0.2126R+0.7152G+0.0722B

But if I had much better skills in reading compiler pragmas I might be able to follow the cookie crumbs for things like ‘comp’ and ‘color’ and get a better picture of what it's actually doing.

I've tried that approach in the past(looking at the lib files, but usually come to a halt with my reading skills).

But that's on me to commit some study time at some point.

Thanks again for the references jsmack and Konstantin.
User Avatar
Member
7770 posts
Joined: Sept. 2011
Online
I think houdini is using NTSC primaries for legacy reasons. Houdini is based on the 1980's precursor Prisms, which was used heavily in NTSC broadcast graphics.
  • Quick Links