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;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
<materialx version="1.38">
|
||||
|
||||
<!-- <point_light> -->
|
||||
<implementation name="IM_point_light_genmsl" nodedef="ND_point_light" file="mx_point_light.metal" function="mx_point_light" target="genmsl" />
|
||||
|
||||
<!-- <directional_light> -->
|
||||
<implementation name="IM_directional_light_genmsl" nodedef="ND_directional_light" file="mx_directional_light.metal" function="mx_directional_light" target="genmsl" />
|
||||
|
||||
<!-- <spot_light> -->
|
||||
<implementation name="IM_spot_light_genmsl" nodedef="ND_spot_light" file="mx_spot_light.metal" function="mx_spot_light" target="genmsl" />
|
||||
|
||||
</materialx>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
void mx_directional_light(LightData light, float3 position, thread lightshader& result)
|
||||
{
|
||||
result.direction = -light.direction;
|
||||
result.intensity = light.color * light.intensity;
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
void mx_point_light(LightData light, float3 position, thread 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, float3 position, thread 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;
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0"?>
|
||||
<materialx version="1.38">
|
||||
<!--
|
||||
Copyright Contributors to the MaterialX Project
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Declarations of common light nodes, used in code generation for hardware
|
||||
shading languages that require explicit light loops.
|
||||
|
||||
These nodes are a required implementation detail for hardware shader
|
||||
generation, and are not themselves part of the MaterialX standard.
|
||||
-->
|
||||
|
||||
<!-- ======================================================================== -->
|
||||
<!-- Light shader nodes -->
|
||||
<!-- ======================================================================== -->
|
||||
|
||||
<!--
|
||||
Node: <point_light>
|
||||
-->
|
||||
<nodedef name="ND_point_light" node="point_light" nodegroup="light" doc="A light shader node of 'point' type.">
|
||||
<input name="position" type="vector3" doc="Light source position." />
|
||||
<input name="color" type="color3" doc="Light color." />
|
||||
<input name="intensity" type="float" doc="Light intensity." />
|
||||
<input name="decay_rate" type="float" value="2.0" doc="Light decay exponent. Defaults to 2 for quadratic decay." />
|
||||
<output name="out" type="lightshader" />
|
||||
</nodedef>
|
||||
|
||||
<!--
|
||||
Node: <directional_light>
|
||||
-->
|
||||
<nodedef name="ND_directional_light" node="directional_light" nodegroup="light" doc="A light shader node of 'directional' type.">
|
||||
<input name="direction" type="vector3" doc="Light source direction." />
|
||||
<input name="color" type="color3" doc="Light color." />
|
||||
<input name="intensity" type="float" doc="Light intensity." />
|
||||
<output name="out" type="lightshader" />
|
||||
</nodedef>
|
||||
|
||||
<!--
|
||||
Node: <spot_light>
|
||||
-->
|
||||
<nodedef name="ND_spot_light" node="spot_light" nodegroup="light" doc="A light shader node of 'spot' type.">
|
||||
<input name="position" type="vector3" doc="Light source position." />
|
||||
<input name="direction" type="vector3" doc="Light source direction." />
|
||||
<input name="color" type="color3" doc="Light color." />
|
||||
<input name="intensity" type="float" doc="Light intensity." />
|
||||
<input name="decay_rate" type="float" value="2.0" doc="Light decay exponent. Defaults to 2 for quadratic decay." />
|
||||
<input name="inner_angle" type="float" doc="Inner cone angle." />
|
||||
<input name="outer_angle" type="float" doc="Outer cone angle." />
|
||||
<output name="out" type="lightshader" />
|
||||
</nodedef>
|
||||
|
||||
</materialx>
|
||||
Reference in New Issue
Block a user