haggi Posted November 19, 2011 Share Posted November 19, 2011 Hi, for my maya-houdini shader translation tools I need to implement bump mapping. I had a look at the way houdini does its bump mapping and it seems it simply uses a vop_displaceAlongNormal without moving the point. My code looks like this: #include <voptype.h> #include <voplib.h> surface testSurface() { // ------------------- checker --------------------------- vector checkerCol = {0,0,0}; float contrast = 1.0; float count = 8; float sTile = floor(s * count); float tTile = floor(t * count); float res = (sTile+tTile) % 2; if( res == 0) checkerCol = set(0,0,0); else checkerCol = set(1,1,1); // ------------------- bump ------------------------------------- float sshear = 0; float tshear = 0; int for_poly = 1; int obj_space = 0; int bump_only = 1; float bumpValue = luminance(checkerCol); float bumpDepth = 1.0; vector outPoint; vector displacedN; vop_displaceAlongNormal( P, normalize(N), bumpValue, bumpDepth, sshear, tshear, for_poly, obj_space, bump_only, outPoint, displacedN); N = displacedN; Cf = displacedN; } The checker seems to be okay but the normals are not modified. Any ideas? Thanks. Quote Link to comment Share on other sites More sharing options...
haggi Posted November 19, 2011 Author Share Posted November 19, 2011 Problem solved. Seems I forgot to include: #define VOP_SHADING Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.