computenormal vex function
In the POP and SOP contexts, sets how/whether to recompute normals. In the shading contexts, computes normals.
void computenormal(int state)(POP and SOP contexts) The VEX context attempts to be intelligent about normals on the geometry. If A normal attribute exists on the geometry before cooking, the position (P) is modified by the VEX code, and the normal (N) is not modified by the VEX code, then the VEX cooker will assume that the normal is out-of-date and re-compute it.
In most cases, this is the desired behavior. However, in some cases, this is not desired. The computenormal() function allows some control over this behavior.
For the state parameter, 0 = Normals will not be modified after cooking, 1 = Normals will be recomputed if they are required for cooking, 2 = Normals are always recomputed.
This function is performed at the conclusion of the cook, so it has no effect on the state of the N variable during execution of VEX code.
vector computenormal(vector P)(Shading contexts) Computes the normal for the described by P by performing the cross product of the derivatives of P. You can specify optional parameters to control the computation.
vector computenormal(vector P, vector N, vector Ng)(Shading contexts) Computes the normal for the described by P by performing the cross product of the derivatives of P. Takes the original surface normal and geometric normal. The computed normal will be “adjusted” so interpolated normals will be relatively correct. You can specify optional parameters to control the computation.
