haggi Posted August 30, 2011 Share Posted August 30, 2011 Hi, I'm creating polygon geometry and I'd like to add a uv vertex attribute. The creation of the attribute is done with: GB_AttributeRef uvRef = gdp.addVertexAttrib("uv", 3, GB_ATTRIB_FLOAT, NULL); It seems that uvs have to be floats to let houdini read them correctly. But now I have no idea how to assign my values. For normales it works fine with: prim_poly_ptr->getVertex(vtxId).setValue<UT_Vector3>(normalRef, n); Unfortunatly there seems to be no float3 type for the uvs. And assigning a vector like; prim_poly_ptr->getVertex(vtxId).setValue<UT_Vector3>(uvRef, UT_Vector3(1, 2, 0)); crashes my program. Any tips? Quote Link to comment Share on other sites More sharing options...
Macha Posted August 31, 2011 Share Posted August 31, 2011 (edited) I don't know much about the HDK, but would it even make sense to have uv's stored as vectors (do they form a vector space? Maybe they do, dunno) From the docs: http://www.sidefx.com/docs/hdk11.0/hdk_geometry_attributes.html#getsetAttributes and in particular: ppt->setValue<float>(uv_id, u, 0); ppt->setValue<float>(uv_id, v, 1); and float life[2]; ppt->set<float>(life_id, life, 2); Edited August 31, 2011 by Macha Quote Link to comment Share on other sites More sharing options...
haggi Posted August 31, 2011 Author Share Posted August 31, 2011 Oh, yes. Thanks a lot. Sometimes I'm lost in the documentation. Quote Link to comment Share on other sites More sharing options...
haggi Posted August 31, 2011 Author Share Posted August 31, 2011 (edited) Still having a problem. It seems that my vertex attribute definition is wrong. I set it with: GB_AttributeRef uvRef = gdp.addVertexAttrib("uv", 3, GB_ATTRIB_FLOAT, NULL); This results in this attribute line in my .geo file: uv 0 float But it should look like this: uv 3 float 0 0 0 And of course because its wrong, noting is set or the tool crashes as soon as I try to set a value. Any ideas what can be wrong with my method to add an vertex attribute? edit: Okay I found the problem. The size of the attribute as to be given in bytes not in number of elements, so this will work. GB_AttributeRef uvRef = gdp.addVertexAttrib("uv", sizeof(float) * 3, GB_ATTRIB_FLOAT, NULL); Edited August 31, 2011 by haggi 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.