Difference between revisions of "HoudiniCops"

From cgwiki
Line 4: Line 4:
  
 
Download scene: [[:File:latlong_to_cubemap_v04.hipnc]]
 
Download scene: [[:File:latlong_to_cubemap_v04.hipnc]]
 +
 +
[[File:cop_vop_latlong_cubemap.jpg]]
  
 
Many thanks to Eetu for solving the last bit I was struggling with!
 
Many thanks to Eetu for solving the last bit I was struggling with!

Revision as of 15:11, 19 March 2017

Latlong to cubemap

Latlong cubemap preview.gif

Download scene: File:latlong_to_cubemap_v04.hipnc

Cop vop latlong cubemap.jpg

Many thanks to Eetu for solving the last bit I was struggling with!

Been doing more and more pano experiments in Houdini lately, but I always have to keep Nuke open to do relatively simple things. A key thing is to be able to transform from a equirectangular/latlong panorama to a cubemap. Having recently worked out how to put a vex snippet in a cop vop, this seemed a good thing to try.

First, I did some intense research on polar maths and space conversion , which led me to this post:

http://stackoverflow.com/questions/29678510/convert-21-equirectangular-panorama-to-cube-map

The trickiest part here was taking the python answer, and translating it into vex. Not the language per se, but the inherent serial operation of most other languages, vs the clean parallelism of vex. The python one set up lots of iterators to march through the pixels, took a few goes to understand what could be stripped away. They were also doing lots of stuff to fix aliasing and sampling, which wasn't a concern here as the cinput vop takes care of all that.

Anyway, got it all ported and... it was almost right. Could see the N/S/E/W planes were almost correct, but the top and bottom were skewed, and all a little off. At that point it was past midnight, so I posted my work in progress to the discord houdini chatroom.

In the morning, Eetu found the fix, amusingly using a technique similar to mine; try and understand the logic behind it, work out where the fix should be, find it didn't work, then randomly insert multipliers here and there until one started to move things in the right way, then playing with that number until its fixed. The answer was the final vertical value needed a higher multplier. Of course. At some point I'll go back and try and understand why, but not right now.

To show-off, you can slide the pano horizontally (making sure wrap is enabled), and you get that cool cube tumble effect. I also show off that handy feature of houdini to use http paths to images. I'd planned to use the panos that ship with Houdini in $HFS/houdini/pic/, but annoyingly they're in a houdini cubemap format already, and to unpack those into a latlong, then back to cubemap, seemed more effort than it was worth.