I have a simple question. what are the meaning of :

``````half4 myHalf;
myHalf.yyyy;
myHalf.xxzz;
// or
myHalf.yw
``````

Thanks a lot !

It’s a simple answer! half4 is a four component vector, using half precision floating point coordinates. The extensions you’ve shown are quick ways to create new vectors using the values from myHalf.

myHalf.yyyy is a four component vector with the values: (myhalf.y, myhalf.y, myhalf.y, myhalf.y)

myHalf.xxzz is a four component vector with the values: (myhalf.y, myhalf.y, myhalf.z, myhalf.z)

myHalf.yw is a two component vector with the values: (myhalf.y, myhalf.w).

As told here.

These are very handy short-hands!

The X,Y,Z,W (also seen as R,G,B,A) are the 4 parts to your 4-dimensional half.

Say you have a half4 of `1,.2,.5,0`:

myHalf.yyyy will give you a half4(.2,.2,.2,.2) a 4D half which all 4 parts are equal to the second part of the original.
myHalf.xxzz would be half4(1,1,.5,.5) the first 2 are the first and the second 2 are the third.

Hope this helps!

==