What does this do? Shader Language
I am learning shader language and I was curious, what does this do "float4(float3(0.0),1.f)"? This is not exact Unity syntax but I want to understand what float4(float3()) does.
Answer by Jessespike · Nov 23, 2015 at 10:57 PM
float3(0.0) will set all three xyz elements to 0.0. This is just a shorter way of typing float3(0.0, 0.0, 0.0). So the float4's xyz is being set to 0.0, and the last w is being set to 1.0
So the float3 is setting the the xyz values of the float4? I am understanding you correct?
You can think of float4
as an overloaded function that accepts various types of parameters:
float4(float x, float y, float z, float w);
float4(float3 f3, float w);
They all return a float4, initialized based on the parameters that are passed in.
You're understanding is correct.
If your question has been answered. Please, can you mark it as solved.
Your answer
![](https://koobas.hobune.stream/wayback/20220612050137im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
HDRP Render ObjectIDs to Texture 0 Answers
Changing Color/Material using HDRP,Modify The Color of a HDRP material 0 Answers
Implement a texture to a object like a decal and try to Rotate/Move/Scale 0 Answers
,Trying to change custom boolean properties of a shadergraph with EnableKeyword 1 Answer
1. How many game objects(like Shpere) we can create per frame in unity? 0 Answers