I am new to heightfield in houdini 16.5.
I am currently working on river/road generation using houdini.
After watching video from Horizon Zero Dawn, I managed to create something like that.
But there is still a problem: How to get the normal vector of such heightfield?
In Horizon Zero Dawn, they use a negated volume gradient vector add (0,1,0) for normal. This can work, but may not be the right answer.
I convert the height field to polygon, then use a intersect node and primnormal node to get such normal. But this cost too much performance.
Is there a good way to get this normal please?
How to get the normal vector of a heightfield?
2996 1 1- Noah_Zuo
- Member
- 2 posts
- Joined: April 2018
- Offline
- ben5ch
- Member
- 76 posts
- Joined: March 2007
- Offline
Back then in that video I was actually playing around with heightfields for the first time
Although the Volume Gradient gives you a nice "normal" when sampling a 3D volume it doesn't with a 2D heightfield.
It seems to not have a vertical Y component.
Actually the values in X and Z are the rate of change in height (Y) over those dimensions.
This is different than the X and Z components of the normal you are looking for.
But we can use the X and Z values to calculate a proper normal.
What you can do is the following in VOPs.
benS
Although the Volume Gradient gives you a nice "normal" when sampling a 3D volume it doesn't with a 2D heightfield.
It seems to not have a vertical Y component.
Actually the values in X and Z are the rate of change in height (Y) over those dimensions.
This is different than the X and Z components of the normal you are looking for.
But we can use the X and Z values to calculate a proper normal.
What you can do is the following in VOPs.
- Use a Volume Gradient VOP to sample the gradient of the heightfield.
- Use a Vector To Float VOP to split the components.
- Connect the X and Z components to the two Y inputs of Float To Vector VOPs.
- On the Float To Vector 1 that has the X as input to Y, set the X to 1.
- On the Float To Vector 2 that has the Z as input to Y, set the Z to 1.
- You have now created two tangent vectors.
- Now connect the two tangent vectors to a Cross VOP...
- ...but in reverse order: Float To Vector 2 to 1st input and Float To Vector 1 to 2nd input
- The output of the Cross VOP is you normal
benS
-
- Quick Links