Fix T43755: Wireframe attribute doesn't work with displace
This attribute missed derivatives calculation. Not totally sure what's the proper approach for algebraic derivative calculation, so calculating them by definition. This isn't fastest way to do it in this case and could be replaced with some smarter magic in the wireframe calculation loop. At least currently implemented approach is better than nothing.
This commit is contained in:
@@ -18,10 +18,21 @@
|
||||
#include "oslutil.h"
|
||||
|
||||
shader node_wireframe(
|
||||
string bump_offset = "center",
|
||||
int use_pixel_size = 0,
|
||||
float Size = 0.01,
|
||||
output float Fac = 0.0)
|
||||
{
|
||||
Fac = wireframe("triangles", Size, use_pixel_size);
|
||||
if (bump_offset == "dx") {
|
||||
point dx = Dx(P);
|
||||
P -= dx;
|
||||
Fac += (Fac - wireframe("triangles", Size, use_pixel_size)) / length(dx);
|
||||
}
|
||||
else if (bump_offset == "dy") {
|
||||
point dy = Dy(P);
|
||||
P -= dy;
|
||||
Fac += (Fac - wireframe("triangles", Size, use_pixel_size)) / length(dy);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user