sometimes i want to simplify vector initialize.
for example
o.Albedo = float3(1.0,1.0,1.0);
i want to write as
o.Albedo = float3(1.0);
because some shader tutorial like shadertoy,and hlsl.
they can just write like this.
and i grab some unity tutorial project from github,some of them write like this.
but i can’t compile them correctly.
I dont know if there is a platform issuse,I use windows 7 64 bit with unity4.6 and 5.1
none can init with single parameter for float3.
so i just want to ask,does unity support default single parameter for float3?
Writing it incorrectly might work (I’m pretty sure just o.Albedo = 1; would work for example), but, depending on the platform, you will get casting errors eventually.
o.Albedo = float3(1.0) is not a valid syntax, but o.Albedo = 1.0 is, because a float can be implicitly cast into any vector type.
Or if you want to be explicit about it, o.Albedo = (1.0).xxx