Hi,
for the creation of a curvature shader, I need the derivs from the surface. But I have no luck at all. This simple code here:
Gives me always 0.000. I'm using maya2012 for rendering and used a simple nurbs sphere (with some deformations) for testing. Any ideas whats wrong with my code?Code:#include <shader.h> typedef struct { } printderiv_params; extern "C" DLLEXPORT int printderiv_version() { return (1);} extern "C" DLLEXPORT miBoolean printderiv ( miColor *result, miState *state, printderiv_params *params ) { mi_info("Deriv vector 0: %f %f %f", state->derivs[0].x, state->derivs[0].y, state->derivs[0].z); mi_info("Deriv vector 1: %f %f %f", state->derivs[1].x, state->derivs[1].y, state->derivs[1].z); mi_info("Deriv vector 2: %f %f %f", state->derivs[2].x, state->derivs[2].y, state->derivs[2].z); result->r = mi_vector_norm(&(state->derivs[0])); result->g = mi_vector_norm(&(state->derivs[1])); result->b = mi_vector_norm(&(state->derivs[2])); return miTRUE; }


Reply With Quote