Jump to content
RTHMan

Individual face textures

Recommended Posts

I'm wondering if I can add a texture like this to individual faces of a grid?

Gradient.jpg

Grid.JPG

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×