Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so dont bother with any of their useless mail servers here and just use oauth login instead. Thank the nice Russians for causing that. :)
Paste
Pasted as C by maxrebo ( 4 years ago )
#ifndef CUSTOM_LIGHTING_INCLUDED
#define CUSTOM_LIGHTING_INCLUDED
struct CustomLightingData
{
float3 normalWS;
float3 albedo;
};
float3 CustomLightHandling(CustomLightingData d, Light light)
{
float3 radiance = light.color;
float diffuse = saturate(dot(d.normalWS, light.direction));
float3 color = d.albedo * radiance * diffuse;
return color;
}
float3 CalculateCustomLighting(CustomLightingData d)
{
Light mainLight = GetMainLight();
float3 color = 0;
color += CustomLightHandling(d, mainLight);
return color;
}
void CalculateCustomLighting_float(float3 Normal, float3 Albedo, out float3 Color)
{
CustomLightingData data;
data.normalWS = Normal;
data.albedo = Albedo;
Color = CalculateCustomLighting(data);
}
#endif
Revise this Paste