• Create Account

### #Actuallipsryme

Posted 29 December 2012 - 12:41 PM

I think what you want to do is something like this

// Incoming radiance (this would be the color and intensity of the light energy
float3 Li = LightColor * LightIntensity;

// This would correspond to your LightIntensity (the cosine factor)
float NdotL = saturate(dot(Normal, LightDirection));

// Your final diffuse light output (or composition)
float3 Diffuse = NdotL * Li;

float3 AmbientLight = AmbientLight;

Diffuse += AmbientColor * AmbientIntensity;

// And at last multiply the result of your light computation by your material's
// diffuse color (albedo) -> basically the regular texture color
float3 output = Diffuse * Albedo;

### #3lipsryme

Posted 29 December 2012 - 12:39 PM

I think what you want to do is something like this:
// Incoming radiance (this would be the color and intensity of the light energy// that is coming towards your surface/shaded pixel)float3 Li = LightColor * LightIntensity;  // This would correspond to your LightIntensity (the cosine factor)float NdotL = saturate(dot(Normal, LightDirection)); // Your final diffuse light output (or composition) float3 Diffuse = NdotL * Li;// Your ambient light termfloat3 AmbientLight = AmbientLight;// Now "add" the ambient light to your diffuse compositionDiffuse += AmbientColor * AmbientIntensity;// And at last multiply the result of your light computation by your material's// diffuse color (albedo) -> basically the regular texture colorfloat3 output = Diffuse * Albedo;

### #2lipsryme

Posted 29 December 2012 - 12:39 PM

I think what you want to do is something like this:
// Incoming radiance (this would be the color and intensity of the light energy// that is coming towards your surface/shaded pixel)float3 Li = LightColor * LightIntensity;  // This would correspond to your LightIntensity (the cosine factor)float NdotL = saturate(dot(Normal, LightDirection)); // Your final diffuse light output (or composition) float3 Diffuse = NdotL * Li;// Your ambient light termfloat3 AmbientLight = AmbientLight;// Now "add" the ambient light to your diffuse compositionDiffuse += AmbientColor * AmbientIntensity;// And at last multiply the result of your light computation by your material's// diffuse color (albedo) -> basically the regular texture colorfloat3 output = Diffuse * Albedo;

### #1lipsryme

Posted 29 December 2012 - 10:45 AM

I think what you want to do is something like this:

// Incoming radiance (this would be the color and intensity of the light energy
float3 Li = LightColor * LightIntensity;

// This would correspond to your LightIntensity (the cosine factor)
float NdotL = saturate(dot(Normal, LightDirection));

// Your final diffuse light output (or composition)
float3 Diffuse = NdotL * Li;