Jump to content

Attribute Mapping - Varmap?


Recommended Posts

Hi,

I would like to know a bit more about attribute mapping and what the detail attribute varmap exactly does.

I was wondering when it is used, if there are certain operators involved in the process. What the implecations are on memory useage.

I have attached a file showing some of the mapping problems or workarounds that I found and I was wondering which of those methods are good, which are slow and why. The curve example is from a workflow suggested by old school.

thanks for your help, I really would like to understand this mapping better.

- Peter

attribute_mapping_01.hip

Link to comment
Share on other sites

Hi,

I would like to know a bit more about attribute mapping and what the detail attribute varmap exactly does.

I was wondering when it is used, if there are certain operators involved in the process. What the implecations are on memory useage.

I have attached a file showing some of the mapping problems or workarounds that I found and I was wondering which of those methods are good, which are slow and why. The curve example is from a workflow suggested by old school.

thanks for your help, I really would like to understand this mapping better.

- Peter

Hi Peter,

varmap detail attribute creates mapping to attribute, say if you have a temperature attribute you could create string type varmap attribute with a class detail. Something like this

temperature -> TEMPERATURE

Now you have access to this attribute via local variable with the name $TEMPERATURE. Don't worry about memory issues - varmap is detail so it's not hungry attribute.

Link to comment
Share on other sites

An attribute mapping is just an way to set up a local variable so that you can use the `$` method of referring to attributes that exist on the geometry. It's just a way to setup a "shortcut" so that you don't need to use the long winded point expression. Basically anywhere you can use the point expression you can replace it with a mapped variable, but you have to define the "shortcut" mapping first. The way you do that is to create a detail attribute which is just a string that says what the geometry attribute is and what "shortcut" word is that you want to use to access it. By convention the shortcut is an UPPERCASE version of the name of the geometry attribute.

A simple way to make this shortcut is to use an attributecreate sop which will always set up the shortcut by default. The point sop pre-dates this method of replacing the point expression and so you need to make this association by hand, this can be done by creating the mapping first with attributecreate and then overriding the attribute values, or afterwards by making the detail attribute varmap and specifying the assiocation manually.

Have a look at the attached where I have suggested 2 other ways to do this before and after the point sop, it might make the process more obvious.

attribute_mapping_si.hipnc

Link to comment
Share on other sites

ok, thanks guys, I understand it better now, but I still have some questions.

I created a grid and I added the detail attribute called "varmap" with "temperature -> TEMPERATURE" as its string value. I can see the mapping in the geometry spreadsheet in the details.

Now I create another attribute called "varmap" with "test -> TEST" as its string value.

I would assume that the original varmap attribute is "temperature -> TEMPERATURE" is changed to "test -> TEST". And if I check the spreadsheet this seems to be indeed the case, however if I middle mouse button on the last node both mappings are there.

Is varmap a special keyword that builds up a list as you create more varmap attributes? Can I compare this varmap method to the declaration of variables in programming?

Simon: Is it a (good) habbit when dealing with a lot of custom variables to declare them through varmap at the beginning? So they can be filled up and accessed later on? Or do you just tend to "declare" them as the need arises?

Thank you for clarifying the relation between varmap and the point() expression.

Link to comment
Share on other sites

ok, thanks guys, I understand it better now, but I still have some questions.

I created a grid and I added the detail attribute called "varmap" with "temperature -> TEMPERATURE" as its string value. I can see the mapping in the geometry spreadsheet in the details.

Now I create another attribute called "varmap" with "test -> TEST" as its string value.

I would assume that the original varmap attribute is "temperature -> TEMPERATURE" is changed to "test -> TEST". And if I check the spreadsheet this seems to be indeed the case, however if I middle mouse button on the last node both mappings are there.

Is varmap a special keyword that builds up a list as you create more varmap attributes? Can I compare this varmap method to the declaration of variables in programming?

Simon: Is it a (good) habbit when dealing with a lot of custom variables to declare them through varmap at the beginning? So they can be filled up and accessed later on? Or do you just tend to "declare" them as the need arises?

Thank you for clarifying the relation between varmap and the point() expression.

This is just one of lots weird things in Houdini. Probably edward could explain this behaviour in details.

Question about mappings is much more simple: use only necessary things. If this attribute is not in use just kill it. Same for mappings and everything else. Keep your scene clean and simple.

Edited by hoknamahn
Link to comment
Share on other sites

  • 4 years later...

hey folks,

I'm having a problem related to that topic. I want to map two variables, and did the following:

attribute create

varmap

test -> TEST

attribute create

varmap

test2 -> TEST2

now as expected, the second node has overwritten the first mapping. How do I have to do it in order to make both mappings work?

I hope I explained it somehow clear. Any help here would be very cool! Thx in advance folks! :)

Edited by Scratch
Link to comment
Share on other sites

  • 4 weeks later...

hey folks,

I'm having a problem related to that topic. I want to map two variables, and did the following:

attribute create

varmap

test -> TEST

attribute create

varmap

test2 -> TEST2

now as expected, the second node has overwritten the first mapping. How do I have to do it in order to make both mappings work?

I hope I explained it somehow clear. Any help here would be very cool! Thx in advance folks! smile.gif

I think it should work properly without having to do anything else. You can use both variables, $TEST and $TEST2, in other nodes, like a GROUP SOP, when you use expressions.

But still, I don't know why the varmap detail attribute shows only one of them. Anybody knows?

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