Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add refract node #1698

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
rename 'eta' to 'ior' to align better with the rest of the node defin…
…itions, per Jonathans suggestion
  • Loading branch information
ld-kerley committed Feb 7, 2024
commit 93d68059c8ad38b07ba2f6e241b5873ddfa84557
2 changes: 1 addition & 1 deletion libraries/stdlib/stdlib_defs.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -2768,7 +2768,7 @@
<nodedef name="ND_refract_vector3" node="refract" nodegroup="math" doc="Compute the refraction vector">
<input name="in" type="vector3" value="1.0, 0.0, 0.0" doc="Incident vector" />
<input name="normal" type="vector3" defaultgeomprop="Nworld" doc="Surface normal" />
<input name="eta" type="float" value="1.0" doc="Index of refraction" />
<input name="ior" type="float" value="1.0" doc="Index of refraction" />
<output name="out" type="vector3" />
</nodedef>

Expand Down
24 changes: 12 additions & 12 deletions libraries/stdlib/stdlib_ng.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -2741,40 +2741,40 @@
<input name="in1" type="float" nodename="IdotN"/>
<input name="in2" type="float" nodename="IdotN"/>
</multiply>
<multiply name="etasq" type="float">
<input name="in1" type="float" interfacename="eta"/>
<input name="in2" type="float" interfacename="eta"/>
<multiply name="iorsq" type="float">
<input name="in1" type="float" interfacename="ior"/>
<input name="in2" type="float" interfacename="ior"/>
</multiply>
<subtract name="one_IdotNsq" type="float">
<input name="in1" type="float" value="1.0"/>
<input name="in2" type="float" nodename="IdotNsq"/>
</subtract>
<multiply name="etasq_one_IdotNsq" type="float">
<input name="in1" type="float" nodename="etasq"/>
<multiply name="iorsq_one_IdotNsq" type="float">
<input name="in1" type="float" nodename="iorsq"/>
<input name="in2" type="float" nodename="one_IdotNsq"/>
</multiply>
<subtract name="k" type="float">
<input name="in1" type="float" value="1.0"/>
<input name="in2" type="float" nodename="etasq_one_IdotNsq"/>
<input name="in2" type="float" nodename="iorsq_one_IdotNsq"/>
</subtract>
<multiply name="I_scaled" type="vector3">
<input name="in1" type="vector3" interfacename="in"/>
<input name="in2" type="float" interfacename="eta"/>
<input name="in2" type="float" interfacename="ior"/>
</multiply>
<sqrt name="sqrt_k" type="float">
<input name="in" type="float" nodename="k"/>
</sqrt>
<multiply name="eta_NdotI" type="float">
<input name="in1" type="float" interfacename="eta"/>
<multiply name="ior_NdotI" type="float">
<input name="in1" type="float" interfacename="ior"/>
<input name="in2" type="float" nodename="IdotN"/>
</multiply>
<add name="eta_NdotI_sqrt_k" type="float">
<input name="in1" type="float" nodename="eta_NdotI"/>
<add name="ior_NdotI_sqrt_k" type="float">
<input name="in1" type="float" nodename="ior_NdotI"/>
<input name="in2" type="float" nodename="sqrt_k"/>
</add>
<multiply name="N_scaled" type="vector3">
<input name="in1" type="vector3" interfacename="normal"/>
<input name="in2" type="float" nodename="eta_NdotI_sqrt_k"/>
<input name="in2" type="float" nodename="ior_NdotI_sqrt_k"/>
</multiply>
<subtract name="refract_dir" type="vector3">
<input name="in1" type="vector3" nodename="I_scaled"/>
Expand Down
Loading