In a vex shader If color is a vector and a function is a float that requires an input of a float how in vex do you change change your input value from a vector to a float ? A simple example would be really useful as theres nothing in the help that I can find
R
float to vector and back
4539 3 0-
- circusmonkey
- Member
- 2624 posts
- Joined: Aug. 2006
- Offline
-
- mark
- Staff
- 2675 posts
- Joined: July 2005
- Offline
circusmonkey
In a vex shader If color is a vector and a function is a float that requires an input of a float how in vex do you change change your input value from a vector to a float ? A simple example would be really useful as theres nothing in the help that I can find
R
It might be helpful to understand the context… But you can convert a vector to a color in several different ways
1) Use a single component
2) Use the maximum/minimum or average values
3) Use some other combination of the values (i.e. luminance)
vector clr;
float f;
f= clr.r; // Use red
f = max(clr); // Use maximum component
f = min(clr); // Minimum component
f = avg(clr); // Average of 3 components
f = luminance(clr); // Luminance of color
f = clr.r*.5 + clr.g*.2 + clr.b*.3; // Some odd weighting
f = dot(clr, {.5, .2, .3}); // Different way of writing above code
-
- circusmonkey
- Member
- 2624 posts
- Joined: Aug. 2006
- Offline
-
- jacob clark
- Member
- 665 posts
- Joined: July 2005
- Offline
-
- Quick Links


