CodeMasterMike Posted March 12, 2008 Share Posted March 12, 2008 Where can I find the UV (texture coordinates) in HDK? I can find the Faces in GU_Detail.Primitives. I can find the vertices in in GU_Detail.points. But where do I get the UVs from? I've checked the doxygen and other, but I cant find anything that reminds me of the texture information. I hope there is a easy answer to this. Thanks. Quote Link to comment Share on other sites More sharing options...
CodeMasterMike Posted March 14, 2008 Author Share Posted March 14, 2008 I asked in the sidefx forum aswell about this, since it seemed that noone here knew it. So I got a reply from a person Here is the reply But I will also cut and paste in the reply below: UVs in Houdini are stored as point or vertex attributes named "uv". This is very similar to normals, which are stored as attributes named "N". But for normals there are all sorts of convenience functions (like computeNormal). For UVs, you'll need to access the attribute yourself. You can use code like: uvOffset = gdp->findTextureAttribute(GEO_POINT_DICT); if (uvOffset < 0) cerr << "No texture attribute found" << endl; to get the uv attribute offset. Then use: UT_Vector3 uv = *(UT_Vector3 *)pt->getAttrib()[uvOffset]; as you loop through each point. It's fairly easy to get out the UVs for points. But getting out the Vertex UVs are little more tricky. If someone want, I can post my sollutions here. Quote Link to comment Share on other sites More sharing options...
nestumkiller Posted June 4, 2008 Share Posted June 4, 2008 (edited) I asked in the sidefx forum aswell about this, since it seemed that noone here knew it. So I got a reply from a person Here is the reply But I will also cut and paste in the reply below: It's fairly easy to get out the UVs for points. But getting out the Vertex UVs are little more tricky. If someone want, I can post my sollutions here. That would be nice . By thr way, do you know how can we specify several uv sets? Should we create generic (3 floats) point groups and when necessary 'promote' them - copy the values to the default one? Edited June 4, 2008 by nestumkiller Quote Link to comment Share on other sites More sharing options...
CodeMasterMike Posted August 28, 2008 Author Share Posted August 28, 2008 That would be nice . By thr way, do you know how can we specify several uv sets? Should we create generic (3 floats) point groups and when necessary 'promote' them - copy the values to the default one? Sorry for the very late reply, I guess you have already solved it, but I will post my code for point UVs. And I do not have any idea or sollution for your problem there... float *pUvData = NULL; // Loop through all the point entries for(uint i = 0; i < m_pGuDetail->points().entries(); i++) { // NULL it to make sure no old data is still in it pUvData = NULL; // Get the attribute data pUvData = (float *)m_pGuDetail->points()(i)->getAttrib().getData(); // If the pUvData is empty, then that means there arent any point UV data if(pUvData || pUvData != NULL) { // The resulting float has 3 entries, but we only use the first two (Dont know what the third one is..) float U = pUvData[0]; float V = pUvData[ } } 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.