• Create Account

Banner advertising on our site currently available from just \$5!

### #Actualunbird

Posted 26 August 2013 - 02:33 PM

Hmmm, "voronoi" in barycentric coordinates with the corners as points:

float ulen = length(pin.DomainLocation.xyz - float3(1,0,0));
float vlen = length(pin.DomainLocation.xyz - float3(0,1,0));
float wlen = length(pin.DomainLocation.xyz - float3(0,0,1));
float3 color = float3(1,0,0);
if(vlen < ulen)
{
if(wlen < vlen)
color = float3(0,0,1);
else
color = float3(0,1,0);
}
else
if(wlen < ulen)
color = float3(0,0,1);

return float4(color, 1);
Edit: There should have been a question mark, but it looks fine to me

Code could probably be compacted with some tricks I guess.

### #2unbird

Posted 26 August 2013 - 02:32 PM

Hmmm, "voronoi" in barycentric coordinates with the corners as points:

float ulen = length(pin.DomainLocation.xyz - float3(1,0,0));
float vlen = length(pin.DomainLocation.xyz - float3(0,1,0));
float wlen = length(pin.DomainLocation.xyz - float3(0,0,1));
float3 color = float3(1,0,0);
if(vlen < ulen)
{
if(wlen < vlen)
color = float3(0,0,1);
else
color = float3(0,1,0);
}
else
if(wlen < ulen)
color = float3(0,0,1);

return float4(color, 1);

Edit: There should have been a question mark, but it looks fine to me

Code could probably be compacted with some tricks I guess.

### #1unbird

Posted 26 August 2013 - 02:22 PM

Hmmm, "voronoi" in barycentric coordinates with the corners as points:

float ulen = length(pin.DomainLocation.xyz - float3(1,0,0));
float vlen = length(pin.DomainLocation.xyz - float3(0,1,0));
float wlen = length(pin.DomainLocation.xyz - float3(0,0,1));
float3 color = float3(1,0,0);
if(vlen < ulen)
{
if(wlen < vlen)
color = float3(0,0,1);
else
color = float3(0,1,0);
}
else
if(wlen < ulen)
color = float3(0,0,1);

return float4(color, 1);

PARTNERS