variable not initialized in shader ,variable used without having been completely initialized
Hi i cant figure this out since its the firt time that i use a custom shader!
void MainLight_float(float3 WorldPos, out float3 Direction, out float3 Color, out float DistanceAtten, out float ShadowAtten) { #ifdef SHADERGRAPH_PREVIEW Direction = float3(0.5, 0.5, 0); Color = 1; DistanceAtten = 1; ShadowAtten = 1; #else
float4 shadowCoord = TransformWorldToShadowCoord(WorldPos);
Light mainLight = GetMainLight(shadowCoord);
Direction = mainLight.direction;
Color = mainLight.color;
DistanceAtten = mainLight.distanceAttenuation;
#if !defined(_MAIN_LIGHT_SHADOWS) || defined(_RECEIVE_SHADOWS_OFF)
ShadowAtten = 1.0h;
#else
ShadowSamplingData shadowSamplingData = GetMainLightSamplingData();
float shadowStrength = GetMainLightShadowStrength();
ShadowAtten = SampleShadowmap(shadowCoord, TEXTURE2D_ARGS(_MainLightShadowmapTexture, sampler_MainLightShadowmapTexture), shadowSamplingData, shadowStrength, false);
#endif
#endif
}
[1]: /storage/temp/192716-cattura.png
, hi im having this problem with the shader and i cant figure it out
void MainLight_float(float3 WorldPos, out float3 Direction, out float3 Color, out float DistanceAtten, out float ShadowAtten) { #ifdef SHADERGRAPH_PREVIEW Direction = float3(0.5, 0.5, 0); Color = 1; DistanceAtten = 1; ShadowAtten = 1; #else
float4 shadowCoord = TransformWorldToShadowCoord(WorldPos);
Light mainLight = GetMainLight(shadowCoord);
Direction = mainLight.direction;
Color = mainLight.color;
DistanceAtten = mainLight.distanceAttenuation;
#if !defined(_MAIN_LIGHT_SHADOWS) || defined(_RECEIVE_SHADOWS_OFF)
ShadowAtten = 1.0h;
#else
ShadowSamplingData shadowSamplingData = GetMainLightSamplingData();
float shadowStrength = GetMainLightShadowStrength();
ShadowAtten = SampleShadowmap(shadowCoord, TEXTURE2D_ARGS(_MainLightShadowmapTexture, sampler_MainLightShadowmapTexture), shadowSamplingData, shadowStrength, false);
#endif
endif
Your answer

Follow this Question
Related Questions
Static Class Strings not truly null? 1 Answer
Texture Problem 1 Answer
Magicavoxel .fbx, no Shadow? 0 Answers
Create Shader mask using box colliders 0 Answers
_WorldSpaceLightPos0 Giving Inconsistent Results in Different Rendering Paths 1 Answer