AntoineSfx Posted Sunday at 09:43 PM Share Posted Sunday at 09:43 PM (edited) 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 Monday at 01:19 PM by AntoineSfx Removed the attachment, it was unpractical Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted Sunday at 11:45 PM Share Posted Sunday at 11:45 PM Put this in a primitive wrangle: string img = chs('image'); vector bb = relbbox(0, v@P); vector uvw = set(bb.x, bb.y, 0.0); v@Cd = colormap(img, uvw); 1 Quote Link to comment Share on other sites More sharing options...
AntoineSfx Posted Monday at 10:32 AM Author Share Posted Monday at 10:32 AM (edited) 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 Monday at 10:34 AM by AntoineSfx 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.