Jump to content

Find Uv Information In Hdk


Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 months later...
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 by nestumkiller
Link to comment
Share on other sites

  • 2 months later...
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 &lt; m_pGuDetail-&gt;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-&gt;points()(i)-&gt;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[
		}
         }

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...