Jump to content

64bit integer attribute


Recommended Posts

Hi all,
I find myself in a situation where I need to use a 64bit integer in order to create an unique id (and there is no other way around it). However, wrangle nodes and VOPs seem to be limited to 32 bit, so the question is - how do you perform calculations on 64 bit integer attributes?
I've attached a simple scene that demonstrates the problem, in which you can see that the attribute 'a' becomes screwed up because it exceeds a 32 bit int, even though teh variable is 64 bit.

Bit_id.hipnc

Link to comment
Share on other sites

Hi,

Python seems to support 64 bits but vex will automaticaly discard extra bits and convert your attribute to 32 bits.

If you have a small point cloud it can be helpfull to do it with python,  but if you need to manipulate a big number of points you will be in trouble (performances).

One way to reduce 64 bits manipulation can be to try to define an array of ids in 64bits at the detail level and use a basic index at point level referencing the detail array attribute.

At the end of your process and depending of your number of points you may want to create the final 64 bit attribute using python with the correct id using the index and the array of ids.

If you are using houdini engine, you may be able to do that operation on your engine instead of houdini.

Or you can pray that there is another solution or sidefx will one day fix that :)

Hope it helps...

From the documentation :

https://www.sidefx.com/docs/houdini/vex/lang

Data types

  • Warning

    VEX uses 32 bit integers. If you use the AttribCast SOP to cast a geometry attribute to 64 bits, VEX will silently discard the extra bits if you manipulate the attribute in VEX code.

You can use underscores to break up long numbers.

 

 

Link to comment
Share on other sites

can't you do whatever you need with attribcreate SOP which supports 64-bit numbers? I mean, for just creating point id that should do, right? (didn't have a time to check the sample file though)

Edited by davpe
Link to comment
Share on other sites

64 bits support seems to work in HAPI since : Houdini 15.5.439

Houdini 15.5.439 HAPI: Added 64-bit int and float attribute data getters and setters:
  • HAPI_GetAttributeInt64Data()
  • HAPI_GetAttributeFloat64Data()
  • HAPI_SetAttributeInt64Data()
  • HAPI_SetAttributeFloat64Data()
  • HAPI_Int64 typedef
  • HAPI_STORAGETYPE_INT64 enum
  • HAPI_STORAGETYPE_FLOAT64 enum

https://www.sidefx.com/changelog/Main/?journal=&categories=&body=64&version=&build_0=&build_1=656&show_versions=on&show_compatibility=on&items_per_page=

 

  • Like 1
Link to comment
Share on other sites

I circumvented my need for it this time, but I was trying to create an ID for points scattered onto many sphere. Each sphere had an ID, and points had a uv coordinate supplied by the Scatter SOP. So my idea was to construct a unique ID for each point by essentially making a number of the form:

[SphereID] [int(1000*uvcoord[0])] [int(1000*uvcoord[1])]

 

I've yet to delve into the wonders of Houdini's API :D

Link to comment
Share on other sites

40 minutes ago, davpe said:

can't you do whatever you need with attribcreate SOP which supports 64-bit numbers? I mean, for just creating point id that should do, right? (didn't have a time to check the sample file though)

Maybe, however that would require expressions, which I try my best to avoid due to their slow speed. 

Also, I've had issues determining what the actual value is, as the parameter spreadsheet and viewport display slightly different numbers.

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