Jump to content

Macha

Members
  • Posts

    1,709
  • Joined

  • Last visited

  • Days Won

    26

Macha last won the day on November 6 2020

Macha had the most liked content!

7 Followers

About Macha

  • Birthday 07/04/1975

Contact Methods

  • Website URL
    http://japanoramia.blogspot.com/

Personal Information

  • Name
    Marc
  • Location
    Pixar Canada
  • Interests
    Mostly everything + walking about

Recent Profile Visitors

17,395 profile views

Macha's Achievements

Newbie

Newbie (1/14)

120

Reputation

  1. Thanks, that looks like it works! (with i++)
  2. I make a detail attribute called orids const char * attName= "orids"; GA_RWAttributeRef oridsAtt = gdp->findIntTuple(GA_ATTRIB_GLOBAL, attName, setSize); if (!oridsAtt.isValid()) { oridsAtt = gdp->addIntTuple(GA_ATTRIB_GLOBAL, attName, setSize); } GA_RWHandleI oridsHandle(oridsAtt.getAttribute()); and I want to populate it from values that I have stored in a set. I probably have to convert the set to an array, but whatever I try, I cannot set the values except for the first array item. For example, as a test, this will just set the first array item to 5 and leave all others on 0: GA_Size gasize(setSize); GA_Offset gaoffset; int test[] = {1,2,3,4,5}; oridsHandle.setBlock(gaoffset, gasize, test); I also tried looping over the set and setting the attribute that way: int i=0; for (set<int>::iterator it=oridsSet.begin();it!=oridsSet.end(); ++it) { oridsHandle.set(GA_Offset(i++),*it); } But again, it only sets the value in the very first array position. How do I set array detail attributes?
  3. I have the same problem. I came up with this. It is not very good, cumbersome and stupid but maybe it helps a little: //load image IMG_File *file = IMG_File::open("/data/app/sci6_x86_64/Houdini/13.0.399/hfs/houdini/pic/DOSCH_SKIESV2_01SN_lowres.rat"); UT_PtrArray<PXL_Raster *> images; file->readImages(images); // get res int xRes = file->getStat().getXres(); int yRes = file->getStat().getYres(); // test uvs float u = 0.4297; float v = 0.4824; float xu = u*(xRes-1); float yv = v*(yRes-1); // get pixel values float vals[3]; images[0]->getPixelValue(xu,yv,vals); for (int k=0;k<3;++k) cout << "Pixelval at " << xu << ", " << yv << " = " << vals[k] << endl; file->close();
  4. Thanks Claus, that works quite well. I've only come back to this now. I'm thinking of using the uvs I get from the hitpoints to read pixels from an image.I don't see anything obvious in the HDK about images and uvs. Is anybody aware of a sample code somewhere?
  5. I shoot rays from gdp to gdp2 and check if they intersect. If they do intersect then I would like to evaluate a texture map on gdp2. I can get the hit positions, but how would I get the values of the texturemap at those points? This is what I have to get the hit positions: GA_FOR_ALL_PTOFF(gdp, ptoff) { // searchdir attribs UT_Vector3 searchdir; tupleN->get(hN.getAttribute(), ptoff, searchdir.data(), 3); GU_RayIntersect *myCollision = new GU_RayIntersect; myCollision->init(gdp2); GU_RayInfo hitInfo(searchdir.normalize()); hitInfo.reset(); UT_Vector4 pos(gdp->getPos3(ptoff)); int hitNum = myCollision->sendRay(pos, searchdir, hitInfo); if(hitNum) { const GEO_Primitive *hitPrim = hitInfo.myPrim; fpreal32 hitU = hitInfo.myU; fpreal32 hitV = hitInfo.myV; //get pos of hit UT_Vector4 hitPos; hitPrim->evaluateInteriorPoint(hitPos, hitU, hitV); } delete myCollision; }//GA_FOR_ALL_PTOFF
  6. Well, that's a start! I never noticed the slides!
  7. Maybe this is a little silly but can somebody explain on a higher conceptual level how points and attributes are represented internally in Houdini? I've sort of memorized how to iterate over points and attributes, reading and writing them with the HDK, etc, but I'm not really clear as to the why's. For example, what is the difference between point offsets and indices and why do we use offsets when iterating? How are points represented in memory, how is the data structured? A lot of answers to these questions are scattered throughout the hdk documentation but a bit of an Idiot's Guide to it would be welcome by many I'm sure.
  8. Does anybody know if we can use arrays as fields in structs? Something like this: struct mydata { float theta; float phi; vector vec; float values[]; } Eventually I want to have an array xs of mydata with each xs.values being initialized to a particular size. mydata xs[];
  9. Looks to me as if all handles related to voxel arrays in inlinecpp are spewing out errors related to boost?
  10. No, none of these includes are sufficient. From the examples it looks like they should, but it doesn't work, at least with the inlinecpp stuff.
  11. Thanks Rick, I've been looking at those before but can't get it to work. I can't even find the right includes for the UT_VoxelArrayIterator, and I have tried a lot of them. It makes me think it is an inlinecpp specific problem. That's why I am asking for a short example.
  12. Does anybody have a short example of inlinecpp that iterates over an existing volume? Thanks.
  13. I've actually got a really annoying problem with inlinecpp. Very often I get a compile error: GeometryPermissionError: Geometry is read-only. You cannot pass a read-only hou.Geometry object to a function expecting a non-const GU_Detail * But the code all looks fine. I then have to exit Houdini, close the shell, reopen, restart and the whole thing works again. Has anybody experienced this?
×
×
  • Create New...