Jump to content


Best way to normalize a vector parameter at the asset level?


  • Please log in to reply
4 replies to this topic

#1 magneto

magneto

    Grand Master

  • Members
  • PipPipPipPipPip
  • 1,302 posts
  • Joined: 04-October 11
  • Location:Canada
  • Name:Ryan K

Posted 03 August 2012 - 03:20 PM

Hi,

I have some vector parameters in my asset at the asset level. I don't think it's possible to normalize their values at the asset level, i.e. everything that uses these parameters get pre-normalized vector values.

So my question is what's the best way to normalize these parameters so everything that uses these parameters inside the asset would get normalized vector values.

I could limit the parameters to -1 to 1, but I still want to give the user the ability to specify any kind of vector values, otherwise the values would get clamped. But even then 1,1,1 isn't unit vector either.

Right now what I am doing is using an Add SOP with 1 point and then have a vector parameter in a VOP where it references the vector parameter. Inside the VOP network, I normalize this value and set the point's position to this value. Then a null after this that reads this point's position and stores it as a parameter, which I reference anywhere I need the original parameter at the asset level.

Is there a simpler, better way than this?


Thanks :)

Edited by magneto, 03 August 2012 - 03:21 PM.


#2 hopbin9

hopbin9

    Houdini Master

  • Members
  • PipPipPipPip
  • 803 posts
  • Joined: 14-March 10
  • Location:Canada
  • Name:Hop Bin

Posted 03 August 2012 - 04:25 PM

Create a hidden parameter that normalizes that parameter and then only reference the hidden.

Edited by hopbin9, 03 August 2012 - 04:26 PM.

Posted Image
Come download the free open source asset library for Houdini.
Help us reach 1,000 fans on facebook!

#3 magneto

magneto

    Grand Master

  • Members
  • PipPipPipPipPip
  • 1,302 posts
  • Joined: 04-October 11
  • Location:Canada
  • Name:Ryan K

Posted 03 August 2012 - 04:50 PM

Thanks hopbin, that's a good idea. I only found the normalize expression which takes a vector value. So you create a vector from all components of the parameter, normalize and get the appropriate component for each field?

#4 hopbin9

hopbin9

    Houdini Master

  • Members
  • PipPipPipPip
  • 803 posts
  • Joined: 14-March 10
  • Location:Canada
  • Name:Hop Bin

Posted 03 August 2012 - 05:14 PM

View Postmagneto, on 03 August 2012 - 04:50 PM, said:

Thanks hopbin, that's a good idea. I only found the normalize expression which takes a vector value. So you create a vector from all components of the parameter, normalize and get the appropriate component for each field?

Sadly yes. I wish would improve the UI to allow expressions to work on float3/vector values as a single expression, since those types are defined in both hscript and python.

Edited by hopbin9, 03 August 2012 - 05:14 PM.

Posted Image
Come download the free open source asset library for Houdini.
Help us reach 1,000 fans on facebook!

#5 magneto

magneto

    Grand Master

  • Members
  • PipPipPipPipPip
  • 1,302 posts
  • Joined: 04-October 11
  • Location:Canada
  • Name:Ryan K

Posted 03 August 2012 - 08:18 PM

Thanks hopbin, I agree. Just wanted to be sure :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users