AntoineSfx Posted February 16 Share Posted February 16 (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 February 17 by AntoineSfx Removed the attachment, it was unpractical Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted February 16 Share Posted February 16 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 February 17 Author Share Posted February 17 (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 February 17 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.