tS Shader VectorFromToComponents

The built in shader components, VectorFromComponents and VectorToComponents have XYZ and W connectors. The W seems to have an effect on the XYZ values, like its a kind of pre-multiplied alpha. The following HLSL scripts use pure XYZ vector math without the W.

Vector3ToComponents

void NewFunction(in RtFloat3 Vector3, out RtFloat X, out RtFloat Y, out RtFloat Z)
{
	X = Vector3.x;
	Y = Vector3.y;
	Z = Vector3.z;
}

Vector3FromComponents

void NewFunction(in RtFloat X, in RtFloat Y, in RtFloat Z, out RtFloat3 Vector3)
{
	Vector3.x = X;
	Vector3.y = Y;
	Vector3.z = Z;
}

Leave a Reply

Your email address will not be published. Required fields are marked *