Skip to content

Commit

Permalink
Remove deprecated node "fresnel" (#1102)
Browse files Browse the repository at this point in the history
* Remove deprecated node "fresnel"

* Remove a unit test file.
  • Loading branch information
niklasharrysson authored and bernardkwok committed Feb 10, 2021
1 parent 5240847 commit 734b134
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 80 deletions.
13 changes: 1 addition & 12 deletions libraries/bxdf/standard_surface.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -334,19 +334,8 @@
<input name="in1" type="color3" interfacename="emission_color" />
<input name="in2" type="float" interfacename="emission" />
</multiply>
<fresnel name="coat_fresnel" type="float">
<input name="ior" type="float" interfacename="coat_IOR" />
<input name="normal" type="vector3" interfacename="coat_normal" />
</fresnel>
<invert name="coat_fresnel_inv" type="float">
<input name="in" type="float" nodename="coat_fresnel" />
</invert>
<multiply name="coat_color_fresnel" type="color3">
<input name="in1" type="color3" interfacename="coat_color" />
<input name="in2" type="float" nodename="coat_fresnel_inv" />
</multiply>
<mix name="coat_emission_attenuation" type="color3" >
<input name="fg" type="color3" nodename="coat_color_fresnel" />
<input name="fg" type="color3" interfacename="coat_color" />
<input name="bg" type="color3" value="1.0, 1.0, 1.0" />
<input name="mix" type="float" interfacename="coat" />
</mix>
Expand Down
7 changes: 0 additions & 7 deletions libraries/pbrlib/genglsl/mx_fresnel_ior.glsl

This file was deleted.

3 changes: 0 additions & 3 deletions libraries/pbrlib/genglsl/pbrlib_genglsl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,4 @@
<!-- <artistic_ior> -->
<implementation name="IM_artistic_ior_genglsl" nodedef="ND_artistic_ior" file="pbrlib/genglsl/mx_artistic_ior.glsl" function="mx_artistic_ior" target="genglsl"/>

<!-- <fresnel> -->
<implementation name="IM_fresnel_ior_genglsl" nodedef="ND_fresnel_ior" file="pbrlib/genglsl/mx_fresnel_ior.glsl" function="mx_fresnel_ior" target="genglsl"/>

</materialx>
3 changes: 0 additions & 3 deletions libraries/pbrlib/genmdl/pbrlib_genmdl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,4 @@
<!-- <blackbody> -->
<implementation name="IM_blackbody_genmdl" nodedef="ND_blackbody" sourcecode="mx::pbrlib::mx_blackbody(mxp_temperature:{{temperature}})" target="genmdl"/>

<!-- <fresnel> -->
<implementation name="IM_fresnel_ior_genmdl" nodedef="ND_fresnel_ior" sourcecode="mx::pbrlib::mx_fresnel_ior(mxp_ior:{{ior}}, mxp_normal:{{normal}}, mxp_viewdirection:{{viewdirection}})" target="genmdl"/>

</materialx>
7 changes: 0 additions & 7 deletions libraries/pbrlib/genosl/mx_fresnel_ior.osl

This file was deleted.

3 changes: 0 additions & 3 deletions libraries/pbrlib/genosl/pbrlib_genosl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,4 @@
<!-- <artistic_ior> -->
<implementation name="IM_artistic_ior_genosl" nodedef="ND_artistic_ior" file="pbrlib/genosl/mx_artistic_ior.osl" function="mx_artistic_ior" target="genosl"/>

<!-- <fresnel> -->
<implementation name="IM_fresnel_ior_genosl" nodedef="ND_fresnel_ior" file="pbrlib/genosl/mx_fresnel_ior.osl" function="mx_fresnel_ior" target="genosl"/>

</materialx>
11 changes: 0 additions & 11 deletions libraries/pbrlib/pbrlib_defs.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -434,15 +434,4 @@
<output name="extinction" type="color3"/>
</nodedef>

<!--
Node: <fresnel>
Calculate the Fresnel amount from an index of refraction for a dielectric surface.
-->
<nodedef name="ND_fresnel_ior" node="fresnel" nodegroup="pbr"
doc="Node for calculating the Fresnel equation from index of refraction for a dielectric surface.">
<input name="ior" type="float" value="1.5"/>
<input name="normal" type="vector3" defaultgeomprop="Nworld"/>
<input name="viewdirection" type="vector3" defaultgeomprop="Vworld"/>
<output name="out" type="float"/>
</nodedef>
</materialx>
13 changes: 0 additions & 13 deletions resources/Materials/TestSuite/pbrlib/bsdf/fresnel.mtlx

This file was deleted.

21 changes: 0 additions & 21 deletions source/MaterialXGenMdl/mdl/materialx/pbrlib.mdl
Original file line number Diff line number Diff line change
Expand Up @@ -842,24 +842,3 @@ export mx_artistic_ior__result mx_artistic_ior(
color k = math::sqrt(k2);
return mx_artistic_ior__result(n,k);
}

// TODO: mx_fresnel, MaterialX Spec misses to document an output (type)
// NOTE: Can be implemented but lack of viewdirection in MDL makes this less useful.
export float mx_fresnel_ior(
float mxp_ior = 1.5,
float3 mxp_normal = state::normal(),
float3 mxp_viewdirection = float3(0.0, 0.0, 1.0) // no default view direction in MDL
) {
float cos_theta = math::dot(mxp_normal, - mxp_viewdirection);
if (cos_theta < 0.0 || mxp_ior == 0.0)
return 1.0;
float g = mxp_ior * mxp_ior + cos_theta * cos_theta - 1.0;
if (g < 0.0) // total internal reflection
return 1.0;
g = math::sqrt(g);
float gmc = g - cos_theta;
float gpc = g + cos_theta;
float x = gmc / gpc;
float y = (gpc * cos_theta - 1.0) / (gmc * cos_theta + 1.0);
return 0.5 * x * x * (1.0 + y * y);
}

0 comments on commit 734b134

Please sign in to comment.