magneto Posted November 23, 2015 Share Posted November 23, 2015 Hi, I have a model with UVs and I want to arbitrarily sample some UV coordinates within 0-1 space and then get the corresponding world position. I know UVs are not guaranteed to be unique but the UVs I have are. Any ideas on how to do this? Thanks Quote Link to comment Share on other sites More sharing options...
acey195 Posted November 23, 2015 Share Posted November 23, 2015 if your object is a square grid, you can just multiply the UV coordinates with (1/bboxSize) in a certain direction. if your object spans the whole world. if it doesn't span the whole world you would need to use the difference between max and min bboxes compared to the worldsize I guess Quote Link to comment Share on other sites More sharing options...
crunch Posted November 23, 2015 Share Posted November 23, 2015 Hi, I have a model with UVs and I want to arbitrarily sample some UV coordinates within 0-1 space and then get the corresponding world position. I know UVs are not guaranteed to be unique but the UVs I have are. Any ideas on how to do this? Thanks In the UV unwrapper, you can call uvunwrap(). See the uvlens shader for an example. If this doesn't work, then it's a little trickier. You might be able to do something with a point cloud (using "uv" instead of "P" for your search attribute). Quote Link to comment Share on other sites More sharing options...
magneto Posted November 23, 2015 Author Share Posted November 23, 2015 In the UV unwrapper, you can call uvunwrap(). See the uvlens shader for an example. If this doesn't work, then it's a little trickier. You might be able to do something with a point cloud (using "uv" instead of "P" for your search attribute). No it's not a grid unfortunately In the UV unwrapper, you can call uvunwrap(). See the uvlens shader for an example. If this doesn't work, then it's a little trickier. You might be able to do something with a point cloud (using "uv" instead of "P" for your search attribute). That function is for SHOPs, no? I need to do this in SOPs. Quote Link to comment Share on other sites More sharing options...
mawi Posted November 23, 2015 Share Posted November 23, 2015 (edited) In my head this should work... Move the geometry to "uv position" @P = @uv Use the xyzdist function to get the primnum and paramtric uv at the uv coord. Now use the primuv function on the original geometry to get world P. I might be able to roll you a .hip later on... vector uvcoord = chv("uvCoord"); int hitid; vector hituv; xyzdist(1,uvcoord,hitid,hituv); @P = primuv(2,"P",hitid,hituv); Edit. Something like this might work in a point wrangle if you put... 1. a point in input 0 2. The geometry in "uv position" into input 1 3 The original geometry in input 2 Cant create a .hip file now, but if you want one I can do that later on tonight... Edited November 23, 2015 by mawi 1 Quote Link to comment Share on other sites More sharing options...
mestela Posted November 23, 2015 Share Posted November 23, 2015 Heh, that's exactly what I ended up doing, just came back to find your post explaining my steps while cooking up a hip. Seems like there should be a cleaner way, but this works well enough. uv_lookup.hipnc 1 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.