Cubic Stylisation.

   5281   7   0
User Avatar
Member
38 posts
Joined: 7月 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).
Edited by FDX3245 - 2019年12月15日 23:58:17

Attachments:
Screenshot from 2019-12-16 15-19-21.png (1.1 MB)
Screenshot from 2019-12-16 15-35-30.png (1.1 MB)
Screenshot from 2019-12-16 15-45-31.png (953.4 KB)
Screenshot from 2019-12-16 15-48-37.png (322.0 KB)
Screenshot from 2019-12-16 15-53-41.png (516.3 KB)

User Avatar
Member
709 posts
Joined: 2月 2017
Offline
Hey FDX3245,

wow, this is great! nice effort wrapping the process into Houdini. Is there any chance that you share your hda?

Cheers
CYTE
User Avatar
Member
38 posts
Joined: 7月 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 - 2019年12月16日 09:12:11

Attachments:
main.cpp (2.1 KB)
Cubify.hdalc (7.2 KB)

User Avatar
Member
709 posts
Joined: 2月 2017
Offline
Hey, thank you for the explanation and effort! I will try to get it running!

Cheers
CYTE
User Avatar
Member
38 posts
Joined: 7月 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.
Edited by FDX3245 - 2019年12月17日 04:12:01

Attachments:
Screenshot from 2019-12-17 19-55-41.png (565.8 KB)
Screenshot from 2019-12-17 19-55-47.png (469.6 KB)
Screenshot from 2019-12-17 19-56-03.png (641.2 KB)
Cubify.hdalc (11.1 KB)
main.cpp (2.2 KB)

User Avatar
Member
38 posts
Joined: 7月 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.
Edited by FDX3245 - 2019年12月17日 12:10:49

Attachments:
Screenshot from 2019-12-17 22-43-36.png (537.2 KB)
Screenshot from 2019-12-17 22-34-29.png (272.4 KB)
Screenshot from 2019-12-17 22-52-23.png (1.2 MB)
Screenshot from 2019-12-17 22-52-33.png (430.5 KB)
Screenshot from 2019-12-17 22-52-43.png (444.6 KB)

User Avatar
Member
55 posts
Joined: 1月 2006
Offline
OH wow, that's really impressive!
“If you can eat it raw you can't under cook it”
User Avatar
Member
1 posts
Joined: 7月 2020
Offline
I can't find the gitHub link for the installation. Could you put the link, please,
Right now I have a an error when trying use your tool:
AttributeError: ‘NoneType’ object has no attribute ‘parm’
  • Quick Links