Jump to content

How do you load an image on a grid with the colors on the primitives ?


AntoineSfx

Recommended Posts

It looked like a simple thing to do , but I can't get it exactly right.

Can you fill a 4x4 grid (5 rows, 5 columns, 16 poly, 25 points) exactly with a 4x4 pixels png image ?

Possibly using AttributeFromMap SOP, but targeting prims somehow.

 

 

 

Edited by AntoineSfx
Removed the attachment, it was unpractical
Link to comment
Share on other sites

Perfect

I wrote this point wrangle that is doing the same thing,  

This sets up a grid so that each point is actually at the center of the pixels (in UV space) and you can just use AttributeFromMap on it and it works; assuming that w and h are the width of the image in pixels

int w=chi('w');
int h=chi('h');

for (int x=0; x<w; x++)
    for (int y=0; y<h; y++) {
    
    int np = addpoint(0,set(0,x,y));
    vector  uv;
    uv.y = float(x)/w + 1/2.0/w ;
    uv.x = float(y)/h + 1/2.0/h;
    
    setpointattrib(0,"uv",np,uv,"set");
    }

 

Edited by AntoineSfx
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...