Jump to content

Individual face textures


RTHMan

Recommended Posts

void grid ( int resx,resy){
    for(int i;i <resx*resy;i++){
        vector pos = set(i%resx,i/resy)/set(resx-1,resy-1);
        addpoint(0,pos);
        if (pos.x < 1 && pos.y<1){
            addprim(0,"poly",i,i+resx,i+resx+1,i+1);
            }
            
        }
        
}
        
grid(4,4); 
void sample_axb(int prim,a,b){
    for(int i;i< a*b;i++){
        vector uvw = set( i%a,i/a)/set(a-1,b-1);
        vector uvw_p = primuv(0,"P",prim,uvw);
        int pt = addpoint(0,uvw_p);
        vector color = colormap("Mandril.pic",uvw);
        setpointattrib(0,"Cd",pt,color);
        }
        
        }
        
sample_axb(@primnum,150,150);
vector center_uvw = {0.5,0.5,0};
vector vt0_uvw = {0,0,0};
vector vt1_uvw = {0,1,0};
vector vt2_uvw = {1,1,0};
vector vt3_uvw = {1,0,0};

vector vt0_p = primuv(0,"P",@primnum,vt0_uvw);
vector vt1_p = primuv(0,"P",@primnum,vt1_uvw);
vector vt2_p = primuv(0,"P",@primnum,vt2_uvw);
vector vt3_p = primuv(0,"P",@primnum,vt3_uvw);

vector center = primuv(0,"P",@primnum,center_uvw);

int cpt = addpoint(0,center);
vector uvw_dir = vt3_uvw -center_uvw;
vector p_dir = vt3_p -center;
setpointattrib(0,"N",cpt,p_dir);

 

sfaaa5.jpg

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...