Jump to content

Choosing the right parameter type for HDA parameters


magneto

Recommended Posts

Hi,

Is it important to choose a type that feels more "correct" for the HDA level parameters? Basically does it matter if you choose Vector3 for your Size parameter or just Float3 (Float type where parameter size is set to 3)?

To me size doesn't seem like a Vector3, but a Center parameter does since it's an actual point in space.

I haven't noticed any difference when using either other than the reference difference (size1, size2, size3 vs sizex, sizey, sizez), but is it important to make this distinction for your asset parameters?

Thanks :)

Link to comment
Share on other sites

Uhmm, I have a vague recollection that it can matter in a shading context...

Vectors can behave differently from 3-floats when you do maths on them. They are members of a vector space :) but I'm not sure in how far that applies to what goes on in Houdini. Basically I'd say it does't matter but if you get weird and seemingly inexplicable behaviour then check your types and if/how they transform. It's one of those gotchas when you write shaders.

Edited by Macha
  • Like 1
Link to comment
Share on other sites

The different vector types do indeed behave differently, at least in transforms that have non-uniform scaling.

I guess they might have some differences in UI behaviour/GUI widgets or something as well.

Here's a small demonstration on how vectors behave when they are declared as different types.

post-2678-134691998719_thumb.png

PS. Menoz should have an official word on this ;)

vector_types.hip

Edited by eetu
  • Like 2
Link to comment
Share on other sites

Thanks alot guys, very useful info. I assumed it's more for attributes but didn't realize about their importance in shading.

I didn't think of axis relatedness because I feel pretty much all Vectors3 values seem axis related like Frequence, etc.

Then I guess whether it's for shading or geometry, thinking about transformations is the way to go?

For example you can't really transform Size or Frequence, but Center, Position could be.

I also remember reading using "Float -> Vector" for attributes, and not "Vector". The latter seemed to be the old way of doing it? I assumed they still mean the same thing, but just "Float -> Vector" was recommended instead.

Link to comment
Share on other sites

  • 2 months later...

hello, sorry for the late reply. I asked to sesi the same question they answered me.

It has to do with how the various vectors are transformed.

Point vectors are transformed differently in VOPs/VEX than vectors and surface normal type vectors are transformed differently as well.

When you define the vector, you should know if it is a point type (P, uv, rest), vector type (up, direction vector) or a surface normal type (N) then simply set the appropriate signature in the VOP.

The signature shows up in the vex code as a pragma statement that the compiler will pick up.

You can read all about transforming various vector types in the Advanced RenderMan book on shader writing math.

  • Like 1
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...