Ajout du projet Depths sur Git
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
<materialx version="1.38">
|
||||
|
||||
<!-- <point_light> -->
|
||||
<implementation name="IM_point_light_genglsl" nodedef="ND_point_light" file="mx_point_light.glsl" function="mx_point_light" target="genglsl" />
|
||||
|
||||
<!-- <directional_light> -->
|
||||
<implementation name="IM_directional_light_genglsl" nodedef="ND_directional_light" file="mx_directional_light.glsl" function="mx_directional_light" target="genglsl" />
|
||||
|
||||
<!-- <spot_light> -->
|
||||
<implementation name="IM_spot_light_genglsl" nodedef="ND_spot_light" file="mx_spot_light.glsl" function="mx_spot_light" target="genglsl" />
|
||||
|
||||
</materialx>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
void mx_directional_light(LightData light, vec3 position, out lightshader result)
|
||||
{
|
||||
result.direction = -light.direction;
|
||||
result.intensity = light.color * light.intensity;
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
void mx_point_light(LightData light, vec3 position, out lightshader result)
|
||||
{
|
||||
result.direction = light.position - position;
|
||||
float distance = length(result.direction) + M_FLOAT_EPS;
|
||||
float attenuation = pow(distance + 1.0, light.decay_rate + M_FLOAT_EPS);
|
||||
result.intensity = light.color * light.intensity / attenuation;
|
||||
result.direction /= distance;
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
void mx_spot_light(LightData light, vec3 position, out lightshader result)
|
||||
{
|
||||
result.direction = light.position - position;
|
||||
float distance = length(result.direction) + M_FLOAT_EPS;
|
||||
float attenuation = pow(distance + 1.0, light.decay_rate + M_FLOAT_EPS);
|
||||
result.intensity = light.color * light.intensity / attenuation;
|
||||
result.direction /= distance;
|
||||
float low = min(light.inner_angle, light.outer_angle);
|
||||
float high = light.inner_angle;
|
||||
float cosDir = dot(result.direction, -light.direction);
|
||||
float spotAttenuation = smoothstep(low, high, cosDir);
|
||||
result.intensity *= spotAttenuation;
|
||||
}
|
||||
Reference in New Issue
Block a user