- Home /
Question by
IHaveAHeart · Sep 14, 2018 at 05:35 PM ·
shaderlabcg
what does it mean assigning a half4 to a float
half4 texcol = tex2D(_MainTex, i.uvMain);
texcol.a = texcol.a * tex2D(_AlphaTex, alphaCoords).rgb; //why the compiler doesnt complain an error, what does it mean assigning a half4 to a float
Comment
Best Answer
Answer by BastianUrbach · Sep 14, 2018 at 07:52 PM
I haven't tried it but I think it's just the first component of the vector. I guess it can be useful when sampling grayscale textures where all channels have the same value (as it's probably the case in the example). In any other scenario it would be really confusing. Personally I wouldn't use it at all.
Your answer
Follow this Question
Related Questions
Problem with lighting in CG Shader 1 Answer
ShaderLab builtin lighting properties are not correct? 0 Answers
How to save a variable from the shader? 0 Answers
SurfaceOutput.viewDir not the same in deferred 1 Answer
Simple Cg shader not compiling 1 Answer