Jump to content

Bump mapping


haggi

Recommended Posts

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...