Cubic Stylisation.
5260 7 0- FDX3245
- Member
- 38 posts
- Joined: July 2019
- Offline
Hello all,
I got a simple bridge of the cubic stylisation technique working in Houdini.
Paper and code: https://www.dgp.toronto.edu/projects/cubic-stylization/ [www.dgp.toronto.edu]
I modified the command line version they provided to take an iteration input, and altered the mesh path to an absolute path.
In Houdini I wrote a simple python script that:
1. Writes the incoming geometry to an obj (using a file rop).
2. Starts the application with subprocess.call, with the parameters specified in the asset (application location, temp obj file location, lambda, and max iterations).
3. Reloads the obj after the program has finished iterating and written to it. (using a file node)
I simply call the python script when ‘cook’ is pressed.
I plan to update the the command line version to match the functionality of the ImGui version they provided. It will probably simply feed the application a path to the mesh, and a temp file with all the properties stored inside.
I might also make use of hou.InterruptableOperation to make it a bit friendlier, as right now it just freezes while it cooks, although there is feedback in the Linux terminal.
Obviously all the credit goes to the paper's authors. It's very cool how easy it was to get it working inside of Houdini.
Attached are some examples using Houdini test geometry (naturally).
I got a simple bridge of the cubic stylisation technique working in Houdini.
Paper and code: https://www.dgp.toronto.edu/projects/cubic-stylization/ [www.dgp.toronto.edu]
I modified the command line version they provided to take an iteration input, and altered the mesh path to an absolute path.
In Houdini I wrote a simple python script that:
1. Writes the incoming geometry to an obj (using a file rop).
2. Starts the application with subprocess.call, with the parameters specified in the asset (application location, temp obj file location, lambda, and max iterations).
3. Reloads the obj after the program has finished iterating and written to it. (using a file node)
I simply call the python script when ‘cook’ is pressed.
I plan to update the the command line version to match the functionality of the ImGui version they provided. It will probably simply feed the application a path to the mesh, and a temp file with all the properties stored inside.
I might also make use of hou.InterruptableOperation to make it a bit friendlier, as right now it just freezes while it cooks, although there is feedback in the Linux terminal.
Obviously all the credit goes to the paper's authors. It's very cool how easy it was to get it working inside of Houdini.
Attached are some examples using Houdini test geometry (naturally).
Edited by FDX3245 - Dec. 15, 2019 23:58:17
- CYTE
- Member
- 709 posts
- Joined: Feb. 2017
- Offline
- FDX3245
- Member
- 38 posts
- Joined: July 2019
- Offline
CYTE
Hey FDX3245,
wow, this is great! nice effort wrapping the process into Houdini. Is there any chance that you share your hda?
Cheers
CYTE
It's a MPL2 so I'm obligated to as I have altered the source ever so slightly.
A few notes. I have done this in Linux so to get it to work in windows you will need to do some work. Mac should be rather trivial to follow along, I believe this is the platform they wrote it for.
1. Follow the instructions from the github link to build the application with 1 exception:
Change the main.cpp to the version I have attached. This is because in the version they have provided, the path to the mesh is relative to the directory of the application. I changed this so it takes an absolute path. I also changed it so that the output file is written over the input file. Finally, I also included an iteration option in the HDA so I have added this as an argument.
2. You might need to install extra packages to build it but this shouldn't be hard. If cmake gives errors saying certain files weren't found you can just google the error and it should be easy enough to find the package name to install.
3. Once you have built the executable, set the App File parameter in the HDA to point to it. I renamed mine to ‘run’ as the original filename is long. Probably cs would be better (for cubic stylisation). I also renamed the cubicStylization_cmd folder to main.
4. When you press cook the HDA will freeze Houdini until cooking is finished, this should be improved but it doesn't worry me. I run Houdini from the Linux Terminal with ./houdini -foreground (from inside /opt/hfsX.X.XXX/bin) and when it is cooking you will get this output:
iteration: 0
iteration: 1
&c.
5. It won't necessarily iterate up to the number you specify as the application includes a “stopping criteria for relative displacement”, which is 1e-3. I intend to expose this to the HDA.
6. As the obj file is saved relative to $HIP you should save your file somewhere so that it knows where to save it.
P.S. I wrote this down quickly, so if you have any trouble or if I've made a mistake in my explanation please ask me.
All the best.
Edited by FDX3245 - Dec. 16, 2019 09:12:11
- CYTE
- Member
- 709 posts
- Joined: Feb. 2017
- Offline
- FDX3245
- Member
- 38 posts
- Joined: July 2019
- Offline
Today I did a little work on it and I now have constraints working.
The constraints come in as a point group, then they are saved as point numbers to a temp file, and loaded by the program. I still have it setup as a command line program with arguments. It now also has a input for ‘stopping criteria’, a bool to tell the program to load constraints or not, and the file location for the temp constraint file.
The first image is the ‘cubification’ without constraints.
The second is the geometry before ‘cubification’, with the constraint locations coloured (they are points but I coloured them as prims to make it easier to see).
The final image is the ‘cubification’ with the constraints.
Left to do is add more features as demonstrated in the paper. And I would also like to transfer all the attributes not stored in the OBJ file back to the geometry after the cubification is done.
I have uploaded the files as before, but can't promise it is well written, or if it will even work on another system. I will keep working on it.
The constraints come in as a point group, then they are saved as point numbers to a temp file, and loaded by the program. I still have it setup as a command line program with arguments. It now also has a input for ‘stopping criteria’, a bool to tell the program to load constraints or not, and the file location for the temp constraint file.
The first image is the ‘cubification’ without constraints.
The second is the geometry before ‘cubification’, with the constraint locations coloured (they are points but I coloured them as prims to make it easier to see).
The final image is the ‘cubification’ with the constraints.
Left to do is add more features as demonstrated in the paper. And I would also like to transfer all the attributes not stored in the OBJ file back to the geometry after the cubification is done.
I have uploaded the files as before, but can't promise it is well written, or if it will even work on another system. I will keep working on it.
Edited by FDX3245 - Dec. 17, 2019 04:12:01
- FDX3245
- Member
- 38 posts
- Joined: July 2019
- Offline
Another update.
I have now added the ability to change the rotation the effect is done under.
It's done by simply transforming the object before export and then just taking the inverse of this transformation afterwards.
Combined with constraints I was able to make an ‘aeroplane flip’, and an even sillier pig.
I will upload the HDA once it's a bit more improved.
I've made some first attempts at using this tool beyond the test geometry. I applied it to a torus, which I constrained with 4 rings, this allowed a smooth transition between the round sections and the square sections. Having it in Houdini gives a lot of interesting possibilities. An absolutely fantastic paper!
Once I've polished it I might upload a blog post explaining the process to build the application itself, and make an attempt at setting it up on Windows (maybe).
All the best.
I have now added the ability to change the rotation the effect is done under.
It's done by simply transforming the object before export and then just taking the inverse of this transformation afterwards.
Combined with constraints I was able to make an ‘aeroplane flip’, and an even sillier pig.
I will upload the HDA once it's a bit more improved.
I've made some first attempts at using this tool beyond the test geometry. I applied it to a torus, which I constrained with 4 rings, this allowed a smooth transition between the round sections and the square sections. Having it in Houdini gives a lot of interesting possibilities. An absolutely fantastic paper!
Once I've polished it I might upload a blog post explaining the process to build the application itself, and make an attempt at setting it up on Windows (maybe).
All the best.
Edited by FDX3245 - Dec. 17, 2019 12:10:49
- kleer001
- Member
- 55 posts
- Joined: Jan. 2006
- Offline
- segstan
- Member
- 1 posts
- Joined: July 2020
- Offline
-
- Quick Links