@Myth wrote:
Hello, I am new in HLSL, totally new. I am tring to implement the lights, but every code line is a epic battle.
Now I recive a error, if I delete the line:
if (dist <= lightRadius[i])
all work.. but I need the line. Any one know what is happening now?//////////////////////////////////////
sampler s0;
float4 lightColor[75];
float lightRadius[75];
float2 lightCenter[75];
int lightNumber;
float2 cameraPosition;float4 PixelShaderFunction(float4 pos : SV_POSITION, float4 color1 : COLOR0, float2 coords : TEXCOORD0) : COLOR0
{
float4 color = tex2D(s0, coords);
float4 end_color = color;
float2 screenPosition = float2(coords.x * 1920, coords.y * 1080) + cameraPosition;
float dist;for (int i = 0; i < 75; i++) { if (i == lightNumber) { break; } else { dist = distance(screenPosition, lightCenter[i]); if (dist <= lightRadius[i]) { //end_color = end_color*lightColor[i]; } } } return color;
}
technique Technique1
{
pass Pass1
{
PixelShader = compile ps_4_0_level_9_1 PixelShaderFunction();
}
}
Posts: 7
Participants: 4