Website powered by

Houdini blog #42 Orient

General / 12 March 2021


Hello everyone, it has been a while since my last post and was thinking to share a few things.

The main thing I will be talking about here is the orient attribute and using it for the rotation of your instances and models.

I often get questions about instances being rotated wrong and want to talk a bit more about how to get more control.

The Common Issue

What happens often if instances are rotated wrong or even not appearing, can come from a conflict in the merge node. When you merge different node together the changes are high they have different attribute values. The merge node itself doesn't know what value to assign when input A and B have different attributes. What the merge nodes does often is fill in 0 as value, with as result wrong rotation or scale being 0.

Here is an example of that in the spreadsheet.

The merge node itself gives a warning about this and tells you which attributes are causing the problem.

This is the reason why it is important to double check what attributes are mis-matched. Here I'm also mainly talking about pointclouds and instance. For example making sure all inputs of the merge have a decent scale value. Tip here is to stay consistent with what attributes you use on pointclouds for instancing ( N, scale, pscale, orient,...)

The merge node will take the first input as a reference for the other inputs.


Using the orient (@orient)

Now we know a bit about what could cause the issue and let's talk a bit about orient as rotation attribute.

First of all orient attribute is a Quaternion (vector 4) . Then another important thing to know is that orient has priority over the N. When your points have a N and an orient, the copy to points node will ignore the N if there is an Orient attribute.

So here comes back the fact that if you merge different nodes together you can have conflicts between N and orient. This results then in wrong rotations. So solution is again to stay consistent with the attributes once you use orient on pointclouds use them for other pointclouds as well. So there is no conflict when merging nodes.

Overall I now recommend using the orient instead of Normal for rotation. I have less issues when using the orient. The main thing being that it has priority over Normal and I don't have to worry about the normals of other nodes. For example when your tool outputs geometry and pointclouds, they both will need a normal but the normal of a model is different that the one of a pointclouds.

Convert N to orient

Let's talk about converting the Normal to an orient attribute. Since orient is a quaternion, this can make things more complex then just a vector3 for rotations. So we can convert the normal to orient as solution. You can still use a workflow where you calculate the N for the rotation and when you are done you convert it to orient to avoid issues later on, with merging for example.

Let's just use VOPs to convert it. 

 In the image above here we first import the Normal (@N) and the up vector. From that make an instance transform and here you can extract that matrix and the quaternion for the orient. With VOPs it is quickly done and you can wrap this up is a HDA to use this later.

There are a couple interesting nodes in VOPs here, like the rotate node. With that you can easily rotate models on a custom axis.

This is how the VOP network looks like now. Of course you can plugin a custom rotation axis in the axis, here I just used the input Normal.



That was it for the post. I hope this was helpful to understand more about what is going on for instances and their rotation.

See you on the next one :)

Simon


Houdini Blog #41: Edge wear

General / 01 September 2020

Recently I found a way to make procedural edge wear on (highpoly) models.

This all started some time ago when I modeled a gun based on Simon Fuchs his videos. I followed his videos but did everything in Houdini and part of that is adding edge damage.

Here is a sneak peak of how the gun model looks.

Final result of the gun here https://www.artstation.com/artwork/ZGdm0x with the edge tool

Now Let's start talking about how to make some procedural edge wear/damage. Before I often used a technique shown here in this video. ( Look at 6min https://www.youtube.com/watch?v=Vx_kYEUvYCA )

The down side of the technique is the video is that on complex models it can often fail, so using my gun model it had a hard time adding edge damage. The mountain and the boolean play a big part here in creating the effect and these 2 nodes are also the limitation.

Other ways I have tried a few ways of approaching edge damage but the more successful ones are with highpoly models and calculation curvature.

At the moment I ended up with this technique and decided to keep it as simple as possible. My other experiments where large networks and this "new" technique uses only 5 nodes to start with.

Here is a gif of what the effect looks like, a mask is created like this and then use it as displacement. (gif realtime)

My idea was to get similar result of the Slope blur in Substance Designer but then is 3D with Houdini.

Breakdown Edge wear/damage

First start out with a highpoly model. For this example I use a platonic shape with the Voxel tool from Labs (Please install SideFx Labs!!!)

Now we have a high poly model and can calculate the curvature. The curvature will the be saved in the Color (Cd).

To calculate the curvature use the Labs Curvature or the measure node. ( there are many other ways of calculating the curvature.) For the result here you have to tweak a few settings in the Labs curvature node, I changed range scale and enabled Single Color Value + Fit to 0-1.

After that apply a mountain or noise on the shape. Based on the size of the object you will have to tweak the values.

Here comes the magic! Use the transfer attribute node and transfer the color of the mesh with curvature and mountain noise back to the original mesh. On the original mesh add a color node with value 0,0,0.

To finish use the color as displacement, you can do this in a VOP with the displace along normal node. The color is here the amount of displacement.

Image from the setup

You can take this network further and polish it more. You can for example add a small blur or the Labs mesh sharpen works nice here.


Let me know if what you think of this technique.

Thanks for reading, see you on the next one!

Houdini Blog #40: City builder

General / 14 April 2020


Recently I made a city builder in Houdini with Python viewer states.

Here is a demo of what the tool looks.

 A lot of people where interested in how this was build and 80 Level contacted me for a breakdown. So a few days later I wrote a draft for the blog post and 80 Level like the breakdown and published it on their website.

https://80.lv/articles/006sdf-breakdown-city-builder-in-houdini/ 

The link here will show a base setup to get more interaction in Houdini.

Have fun playing around with the setup and I hope you enjoyed the breakdown!


Houdini Blog #39: Viewer states 2

General / 13 March 2020

This post will be more about Viewer States with Houdini. Here I will show another example on how to use viewer states to control your HDA parameters.

In my spare time I have been working on a boolean tool or boxcutter tool. Where you can draw shapes to boolean with an input. This is very useful to make hardsurface objects like for my sci-fi building tool.

Here is a demo of the WIP


Since a few weeks the Labs tools has also a box cutter tool. Which is can do also cool things, so check that out as well.

You can also get the file used in the blog here: https://gum.co/MhEvM  . Note: This is a basic setup and you could further add better control and add features.

Simple setup

There are multiple ways you can build this tool, so here is just one simple way you could achieve something similar. You could also look at the Labs tool for another example.

To start make a HDA with a boolean node and an add node.

In the HDA expose the parameters from the add node, like in the image below here. (with the viewer state it will control the multi parameter of the add node)


The Viewer State

Last post I talk a bit on how to make a viewer state (check out the previous post here). So for this example let's start from a template. Here the Add point template will be used.

Using this template or sample will place down Python code for you and will work by default with this add node and parameters from it.

Add the top of the code are some instructions on how to use the templates/samples. Which is basically saying to make an add node and expose the values (like I mentioned above here).

# Usage: This sample adds points to the construction plane.
# 
# If you embedded the state in a SOP HDA:
# 1) Dive in the HDA and add a SOP Add node
# 2) Open the Add node property page and promote the Number of Points parm (Alt+MMB)
# 3) LMB in the viewer to add points.
# 
# If you created a file python state:
# 1) Create an empty geometry and dive in.
# 2) Create an Embedded HDA: Subnetwork, RMB, Create Digital Asset..., Operator Name: test, Save To Library: Embedded, Accept.
# 3) Dive in the Embedded HDA and add a SOP Add node
# 4) Open the Add node property page and promote the Number of Points parm (Alt+MMB)
# 5) Set Node Default State: test in Type Operator Properties, Accept.
# 6) LMB in the viewer to add points.

So following these instructions correctly will create new points for every mouse click (you need to go outside of the HDA).

Some important parts of the code is keeping track of the total amount point number. This value is then used to control a multiparm.

Every time using now a 'self.index' it will return the current number of points/clicks.

Setting a value in the multiparm will look like this then:

 self.node.parm("usept%d" % self.index).set(1) #set multiparm value


Next up is looking closely now at the way points are placed, they are all placed on the grid (or construction plane in this case) and not on the geometry.

To place points on the input geometry you will need to know 2 things. What is the input geometry and how to get the intersection of the mouse with the geometry.

Getting the input is first.

At the beginning in the init create this lines. 

self._geometry = None

Further go to 'def onEnter' in here place down the following.

#Find what the input geometry is
inputs = self.node.inputs()
if inputs and inputs[0]:
    self._geometry = inputs[0].geometry()

Now the information is stored under self._geometry and can use it to get the intersection with the mouse.


For intersection there are a couple of options you can do , check them here : https://www.sidefx.com/docs/houdini/hom/state_events.html#flex 

Here I will be using the sopGeometryIntersection function for it. Under 'def onMouseEvent' this function will be used.

Use the following to make it work. (The other line, cplaneIntersection, is not used anymore)

self.node = kwargs["node"]

if self._geometry:
     MY_position = su.sopGeometryIntersection( self._geometry, origin, direction )

In MY_position is now a couple of values stored. SopGeometryIntersection will return intersected, position, normal and uvw. (this is important to know)

So when setting the point position, you have to keeping in mind that multiple values are now stored in the position variable.

Change the code from this

self.node.parmTuple("pt%d" % self.index).set(MY_position )

to this

#this will sure to get the position info
self.node.parmTuple("pt%d" % self.index).set(MY_position[1]) 


Finishing with SOPs

To make it complete you need to create a shape from the points create with the viewer state.

You can group the points by 3, each point can then control how the shape will look (sort of a point for each axis). In the add node you can do this by going in the polygon menu and use the By group options.

Like in the image here going from the points to lines by grouping them by 3. 

Last step will be looping over each line and use a bounds node to create the shape to subtract.

Now you have a base for a box cutter tool. This is not perfect and could still use some tweaks but the post is already pretty long so I will end here. The main thing that needs to be tweaked is that when placing a point it is limited to the input geometry.

Here is what the result looks like.


Hope you enjoyed this post and see you on the next one.

Feel free to share any feedback or thoughts.


Special thanks to my Patreons.


Houdini Blog #38: Viewer States

General / 03 March 2020
This post I will be talking about Viewer states in Houdini, this is done with Python. So if you have used python before it will come in handy.

An example here that I build with viewer states is this decal tool. This decal tool was very useful when building my models for the current building tool. For this workflow I use a similar approach like Star Citizen, where you use tiling materials and detail a model by placing decals.

How it will look in game. (notice also that I use a fancy decal with Parallax to get depth in the decal)


What is a Viewer state

A viewer state controls how to interpret mouse movements, clicks, keys, and so on in the viewport. To make a Viewer State you will need an understanding of python with Houdini.

With Houdini 18 there is more integration of the viewer states then before. I have had my eye on viewer states for a while and once I noticed the better integration I jumped on it.

So where are these viewer states made? You can find/make viewer states in the HDA property menu. Under Interactive there is a viewer state tab and here is a menu to write the code.

If you are looking for examples, there are a couple of them in Houdini. Here is how you can see them.

Example Viewer state

Let's make a simple example to test out the viewer states. This example will show how to use the scroll of your mouse to control a parameter of a HDA.

To start make a HDA with a tube and expose the Columns. Like in the image below here.

Then go to the Interactive tab where you have the viewer state and click on New.

A menu will pop up with presets. For this example just use the blank one. I highly recommend looking at all of them if you want to learn more about Viewer States.

Once you clicked on Accept, some code will appear in the menu. This code will help us integrate the next part easier.

Now you need to get access to the scroll of the mouse wheel. You can find this on the website and documentations about viewer states.

https://www.sidefx.com/docs/houdini/hom/state_events.html#wheel 

On the website copy paste the part with the border around in the image.

So in Houdini it looks like this.

Test this out to see if the print works. Go click on your HDA and make sure you are using this handle.

Scrolling with your mouse should now print 1 or -1 based on the direction.

Final step is to link the Columns parameter in the code. Here is how you can do this.

In general to set a parameter it will look like this 

kwargs['node'].parm('MY_Parameter').set(1)

When setting the parameter value also ask what is the current value and then add 1 or -1 from the scroll.

This results then in controlling the columns with the mouse scroll.


If you are looking for more info take a look at the documentations https://www.sidefx.com/docs/houdini/hom/python_states.html 


That was it for this post, I hope you enjoyed it :)

Special thanks my Houdini Wizard patreons.


Houdini Blog #37: Unreal Instancing

General / 24 February 2020

This post will be talking about instancing with Unreal engine. Some parts of instancing in Unreal engine is not clear to every one, so I decided to make a breakdown of instancing.

Further on my builder tool it has a little bit improvements. Mainly made models and updated shaders in Unreal.

Here is also a breakdown of the modular set.


Instancing

Instancing is the ability to draw the same object multiple times. It uses all the same vertices and graphics pipeline each time. It avoids the overhead of the program asking to have the object drawn over and over again.

With Houdini and other software like Unreal and Unity, it is possible to use instancing. This will result is a performance boost.

Method 1: copy to points

The first way of using instancing is by enabling it in Houdini. This is often found in nodes and the common node I use for this is the copy to points.

Opening an HDA with a copy to points and instance on will result in this.

You now have exclusive inputs for instance models. In here you can place custom models from your Unreal project.

This method is the easiest one to setup in Houdini and get results. Downside is that in Unreal you will have to assign the correct model to instance.


Method 2: attribute instancing

Then the second method is using attributes. With the copy to points you use a placeholder as instance but what if you want to get the right model to be instanced by default.

So that is where attributes are come in handy. On attributes will be information stored on what model to use from Unreal, in other words the attribute will contain a path to an asset.

To use this you won't be using a copy to points and instead on these points place an attribute create. Then fill in the right name for the attribute called 'unreal_instance'.

The type will be a string and in this string is the path to the model you want to copy on it.

The path for Unreal assets is something special. For Unity it is just 'Asset/Models/my_model.fbx'

To get the correct path from Unreal Engine right click on an asset and use Copy reference.

Paste this reference in the attribute string.

Unreal Paths will look like this:   StaticMesh'/Game/Models/Sci-fi_Panel.Sci-fi_Panel'   (You can see the structure  'type' + 'Path')

A cool trick with attribute instancing is that you can use this with an attribute random. 

In general the attribute instancing can take a bit more setup in Houdini but there is a lot of benefits from this. Such as not having to assign in Unreal what models to instance and since you are using attributes it can be randomize or controlled in different ways.

More on the Houdini with Unreal plugin can be found here: https://www.sidefx.com/docs/unreal/ 

Instancing in action

Once instancing is setup it can work pretty fast. The demo below here is in real time with my tool.


That was it for this post. Hope you enjoyed it and see you on the next one.

Special thanks to my patreons.


  

Houdini Blog #36: Box builder

General / 18 February 2020

It has been a while since the last blog post and in this post I wanted to share a tool I have been working on.

The main idea of this tool is to go from a blockout in Unreal Engine 4 to final building. So it is placing modular models for you. Here is a similar tool I saw some time ago: https://80.lv/articles/006sdf-environment-art-procedural-workflow-in-houdini/ 

My inspiration for the buildings it self are from Star Citizen concepts https://www.artstation.com/artwork/xz4L0X 

At the moment this is what I have.

I have also been working on modular models. This is modeled in Houdini and using the star Citizen Decal technique, so all the details you see are from a decal. Added also parallax to the decals to make it more fancy.


One of the first important steps in creating this tool was a decent wall system.

What I mean by that is that you can input boxes and it will create the points where the walls should come. Below here is a small breakdown of this system.

First clean up the input boxes and get the amount of floors. For the amount of floors you can use a divide with a Bricker polygon option. Then looping over each primitive and getting the bottom line. This line represent where the models will be placed and how many. So get the length of the line. There are many options to get the length of a line like using the convert line, resample distance attribute or VEX.

When you have the length of the line now compare it with the wall size and see how many you can fit. So this will be a wrangle with calculating the amount of walls and the rescale value for the walls. Because the walls might be to large or small so play around with the scale of each wall to fit them.

By save an @scale in a wrangle Houdini by default knows what to do with it. Plug in this in a copy to points it will return control in each copy of the scale.

That was it for the post , I hope you enjoyed. Feel free to share feedback or Questions.

Next week I might talk a bit about instancing with Unreal Engine.

And special thanks to my patreons.


Houdini Blog: ?

General / 19 December 2019

As some of you may have noticed it has been a few weeks since the last blog post. 

I'm currently planning on making more tutorials so in a few weeks there will be new tutorials. In the meantime I also made tutorials for SideFX, you can find them on my artststion or on the link here. These are longer and more detailed tutorials about projects in Houdini and Unity.

https://www.sidefx.com/tutorials/sci-fi-door-generator/ 

Further I started giving workshops of Houdini is my "old" school (DAE). It might be possible to share some of the lessons here in my blog or in a video. I really want to share the information in the workshop as everyone can benefit/learn from it.

 

You could also follow me on twitter, I will be posting experiments and ideas I have.

https://twitter.com/Simon_Houdini 

Here is the latest exploration I have been doing.



There is also a patreon now. If you want to support the blog and the tutorials I have been making, you can now become a patreon.

At the moment all tiers are the same, choose the tier you feel comfortable with. ( Later on Tiers and rewards might get changed) 

https://www.patreon.com/Simon_Houdini 


Thanks a lot for the support and Happy Holidays :)


Houdini Blog #35: Sci-fi Buildings

General / 13 November 2019


In this weeks post I made tutorials on the sci-fi buildings that I created a few weeks ago.

This was the blog post where I generated that building https://www.artstation.com/siver/blog/vQ3W/houdini-blog-27-city-builder-part-02  , the goal of that project was to create a sci-fi city. But it seems it got a bit carried away by other things at the moment :)


I have created 2 versions of this tutorial a long and a short one. I'm curious to see what you think about it and which one you prefer.

I think people that already have a basic understanding of Houdini might be more interested in the short one, since a lot of more basics steps are skipped there.


I hope you enjoy the videos :)



Longer version


Houdini Blog #34: Photogrammetry

General / 05 November 2019


This week no Quick tutorial but some experimentation with Photogrammerty. Timewise it was difficult to make another tutorial so I decided to research something that I wanted to do for a while now, Photogrammerty.

I have not a lot of experience with this but with the integration of AliceVision and RealityCapture in Houdini made me curious to try it.

Having this integration is great and I can recommend it to everyone who wants to try out Photogrammetry.