Forum

Color by vector


#1

hey there,

i am trying to colorize with the help of a vectorfield but there is more to it than i thought. basicly i want to have the same colors that the vectors are displaying in the VectorArrow node

Noise Color from Vector.v4p (24.5 KB)

looking into the VectorArrow node shows that there is more to do than only using the length of a vector ;)
especially the lines that are marked in fat are not very clear to me.

psInput VS_ColorByVector(vsInput input)
{
psInput output;
uint iid = input.iid;
float4 p = input.Pos;
float3 v = bVector[iid];

p.z*= length(v);
p = mul(p, tW);
p.xyz = mul(p.xyz, lookat(v));
p.xyz += bPos[iid];

output.PosWVP = mul(p, tVP);
output.Vcol = float4(normalize(v)*.5+.5, 1);
return output;
}

is there a node that does especially that?

greetings knoeterich


#2

ah i see that was not marked.

i meant this:

p.z*= length(v);
p = mul(p, tW);
p.xyz = mul(p.xyz, lookat(v));
p.xyz += bPos[iid];