Everything I Always Wanted to Know About Derivatives (But Was Afraid to Ask)

27 views
Skip to first unread message

Etienne Sandré-Chardonnal

unread,
Apr 28, 2020, 10:08:18 AM4/28/20
to osl...@googlegroups.com
Hi,

When we write, for instance, the following shader:

float uvscale = 1;

float s = u*uvscale;

float t = 1.0-v*uvscale;

float a = 7.68;

float b = 0.165;

float height = a*exp(-((s-0.5)*(s-0.5)+(t-0.5)*(t-0.5))/b); //Gaussian

float dHdX = Dx(height);

float dHdY = Dy(height);


It works!


I'm curious, is that numerical derivation (ie the OSL compiled code does recompute height with slightly offset u and v values obtained from dudx, etc... derivatives), or are math functions such as exp analytically derivative-aware?


Thanks!





Olivier Paquet

unread,
Apr 28, 2020, 1:51:45 PM4/28/20
to OSL Developers
Reply all
Reply to author
Forward
0 new messages