Showing posts with label Experiments. Show all posts
Showing posts with label Experiments. Show all posts

Wednesday, December 14, 2011

Platonic Solids and Duality

I recently came across a post on odForce about hexagonal meshes. After searching info on this subject, I came across the concept of polyhedrons. This stuff is pretty interesting. Polyhedron in Greek means "many faces", so its just a 3-dimensional shape with many faces. There are special polyhedrons called Platonic Solids.


The image above are the 5 Platonic Solids and their "duals". Only 5 of them exist. All angles in these special polyhedrons have equal faces, angles, and edge lengths.
The dual is when you change each vertex to a face. And when this happens on a platonic solid, the number of points and primitives gets swapped.

In Houdini, just use a Platonic Solids SOP to get them.


The last two types, Soccer Ball and Utah Teapot, are technically not platonic, but they have been used so much in computer graphics, that they have become adopted!

To get the dual, use a Divide SOP with "Convex Polygons" unchecked and "Compute Dual" checked.

If you go to Wikipedia, and search polyhedron or platonic solids, you can get alot deeper than this.

Anyway, to the hexagonal mesh thing, here is a way to do it. Take a grid, then use a PolyBevel SOP with "Relative Inset" set to 1, then the Divide SOP with Compute Dual and keep Convex Polygons checked.

You end up with a nice honeycomb shape! You can then go further and use PolyWire, PolyExtrude, etc. and do some neat things with it.

Wednesday, August 4, 2010

Subsurface Scattering Tests

Some results after testing out some subsurface effects.


The general setup with lights behind the objects.

A little dark...

Sometimes just adjusting the gamma will greatly improve the render.


Trying to mix the colors in one object and shader will result in bleeding across objects.

Color issue fixed by separating the objects and scatter points.

Thursday, July 15, 2010

Paper Pixels



A combination of the Runaway Post-it Notes and the 3D Game Sprites projects.

I used two different but similar game sprites, Mario and Luigi from the original Mario Bros. game. They only differ in color palette. The color attribute is blended down the Y-axis to get a nice gradient as the paper blows away.

With so many stacks of particles, I needed each of the stacks' particles to be grouped from top to bottom at a random rate. The first step was to set an attribute that specifies the "stack number" in SOPs. I set the Alpha ($CA) point attribute equal to the point number ($PT) of the template. That stack number ($CA) is kept after the Copy SOP so that the particles can use it.

Next, in the particle network, I created a random step curve in CHOPs which goes up by increments of 1 at a random rate. I created as many curves as I needed. The names of these curves will correspond to the stack number of the particle.

Finally, by using an expression, I got the particles to group from top to bottom. The modulo operator is very useful. Particles within this group will be effected by the wind and other forces.

Sunday, June 27, 2010

3D Game Sprites


I got this idea after playing a game called 3D Dot Game Heroes.

This is very easy to do in Houdini. I just found some sprite sheets from old 8-bit video games on the web. Then I just UV mapped them on a grid of points and copied boxes on them inheriting their point colors.

Basic Procedure

Sprite Sheet

Pick out a specific sprite

After I cropped out my chosen sprite, I needed to save the image as a TIFF or PNG to keep the Alpha channel. It comes useful later.

Houdini Network

VOPSOP Network

The image is UV mapped on to a grid of points. Then Color and Alpha point attributes are fetched from the image. If the value of Alpha is zero, the point is deleted, creating a cookie cut-out of points.

Boxes copied to remaining points

Dealing with Sizes

Grid SOP

The game sprites can vary in pixel size, width and height. To ensure that the grid will have the correct number of rows and columns, I brought the image into COPs and was able to fetch its size data using an expression.

16-Bit Sprite

Arcade Size

Guilty Gear vs Street Fighter

As technology advanced, game sprites became larger and could create more detail. Also a wider range of color values could be used. This might explain why earlier game character designs were more simple and used fewer colors. Like MegaMan, who still to this day retains the simple design he had way back. I think its interesting to see how the designers were able to do this stuff with such limited resources and still create something pretty entertaining.

Monday, May 17, 2010

Houdini Tetris


SOP Level

I started with a 4x2 grid, and deleting primitives to create the tetrominos in the game. Each tetromino consists of 4 primitives.



All of these geometries went to a Switch SOP. The input parameter has an expression that randomizes the input by time. The flat shapes are later extruded. This will be the source of the RBD objects in the DOP level.



DOP Level

RBD Object DOP

When bringing them into DOPs, a tetris piece needs to be "emitted" not only on the first frame, but also when the piece before it hits the ground. This is done by the expression in the Creation Frame parameter:

if($FF==1 || dophasfield("..",$OS+$SNOBJ-1,Impacts,Impacts,0,flags)==1,$F,0)

In DOPs, when an RBD object makes contact with a collision surface, there will exist Impact data called "flags". So once the current object, $SNOBJ-1, receives this flag, a new piece will be created.

Group DOP

I created two groups, one called "falling" which is the current piece, and "hit" which are the pieces at rest. The groups are detected by the Y velocity.

RBD State DOP

An RBD State DOP was used to force the velocity data to zero of the "hit" group. This will keep the pieces from bouncing and moving dynamically.

Motion DOP

In a Motion DOP, position was overridden using CHOPs. I could control the position of the falling piece using the keyboard or a game controller via CHOPs while the simulation was running.



CHOP Network

The CHOP Network records a graph while DOPs is running and can directly move the pieces in realtime. The result of the network above plugs directly into the Z position of the Motion DOP.

Resulting curve for side to side motion.

DOP Network


Afterthoughts

This was an experimental project and I learned alot about DOPs and CHOPs. I may later come back to this one to try and figure out how I can rotate the pieces without any bugs and of course enable the blocks to disappear after creating a line.

Friday, January 2, 2004

Wii Controller in Houdini

For this group project, we are planning on using Nintendo's "Wiimote" as an input device to use inside Houdini. Utilizing CHOPs, we plan on controlling geometries inside the viewport in dynamic or game simulations. Later, we want to capture and record these movements and render them out in a sequence.

List of our Materials

* A PC with Windows XP
* A Wiimote
* Kensington Bluetooth USB Adapter 2.0
* Infared Sensor Bar


Get the Bluetooth Driver

Before even thinking about Houdini, we need to get the Wiimote working on the PC. Depending on the bluetooth dongle you must use specific drivers for this thing to work. Since we are using the Kensington USB 2.0 Adapter, we must use the driver below. So before installing the drivers that are packed in with the dongle, make sure to check which driver you need to use for the Wiimote HERE.

Download the Driver Here: KensingtonBTW_4.0.1.2400.zip

Connect the Wiimote to the PC

After installing the compatible device drivers, do the following:

* Double-click the Bluetooth tray icon.
* Tell it to search for bluetooth devices
* Press and Hold the 1 and 2 buttons on the Wiimote
* It finds the Nintendo Wii Remote (Nintendo RVL-CNT-01)
* Click on the icon labeled "Nintendo RVL-CNT-01" to select it and then clicked "Next"
* Click the button labeled "Skip Pairing"
* "Use a Bluetooth enabled mouse, keyboard, or other interface device" with a "checked" checkbox
* Click Finish


Testing it Out!

After all that, I found a neat little program called WiinRemote on http://onakasuita.org/wii/. It is a Wiimote Driver that basically lets you use the Wiimote as an input device. You can map any keyboard and mouse buttons onto the Wiimote buttons and motions. You can even set up the Nunchuck attachment and use the analog as the cursor and utilize its Z and C buttons! So this is the key. Now that we have got it working on the PC, we can bring it in Houdini!

Download WiinRemote Here: WiinRemote_v2007.1.13.zip


Choosing a WiiMote Software

There are many other software packages that are capable of driving the WiiMote, so search
around or follow the links below, don't limit yourself to this one.

The two main software packages that we used were WiinRemote and GlovePIE:

Advantages of WiinRemote:
-User friendly.
-Good GUI.
-Graphed results.
-Easy to use button configuration.
-Tilt/Roll support for mouse control.
-ZERO coding involved.

Disadvantages of WiinRemote:
-Less control over output options.
-No widescreen/dual-monitor support.

Advantages of GlovePIE:
-Fully programmable.
-Ability to use scripts.
-Visible output variables.
-Configurable output value ranges.
-Widescreen support.
-Everybody likes Pie, and most people like gloves.

Disadvantages of GlovePIE:
-Terrible GUI
-Lackluster documentation
-No Graph representation (tough to
troubleshoot)
-Difficulty connecting to mouse

We ended up using WiinRemote for its easy interface and user friendliness. Now, with WiinRemote running in the background, we launch Houdini 8!


Porting to Houdini

Our basic structure is as follows. We chose to port through the Mouse CHOP, due to our limited knowledge of MIDI's and their outputs. First set the driver to control your cursor. Either pointer if you have an IR sensor, or set it to tilt and roll for axis control. Use a Mouse CHOP in the motion and audio tab. In its parameters Set Activate to While Playing.

In order to deal with the screen edges, make a Math CHOP, and multiply your input variables by your own preferences.

Connect to a Record CHOP, to capture your movements in real time. Finally, connect the Record CHOP to an Export CHOP. In the Export node you can take the X and Y coordinates to any Node variables you wish from SOPs, POPs, DOPs, etc. (Such as transformation, rotation, etc.)


Post-Mortem

In hindsight, the WiiMote was nothing more than a gimmick. We originally thought that due to its ingenuity and unique control scheme it could help revoloutionize how we interact with a three dimensional environments. Due to the current functionalty of the drivers offered for the WiiMote, it has little more functionality than a custom Mouse/Keyboard. Also due to limitations of the drivers it will only accept one keypress at a time, and does not register multiple buttons correctly on the actual remote (nunchuck/power button).

Originally we wanted to use the WiiMote in the DOPS network to control environment/object variables. Houdini however was not designed with real time dynamics simulation in mind with live inputs, and we ran into technical snags at every turn. For example. We used the WiiMote to control a plane's tilt and roll values with a ball dropped on said surface and a gravity force applied. The simulation looked as if it were working correctly until we discovered that if you changed the angle of the plane too violently the sphere would be instantly forced through said surface and we were unable to find a solution. Instead we cheated and used a particle network to recreate a simple ball maze.

Our next attempt was to use the WiiMote as a custom Interface device. We were able to map scripts and keypresses to the existing WiiMote buttons. It worked swimmingly until we tried to pan zoom or Rotate, where we discovered that multiple keypresses were not supported by the drivers we were using. Making complex interactions in Houdini nearly impossible for our purposes.


Conclusion

In conclusion, our WiiMote project was informitave but due to our limited time frame and knowledge of computer peripherals we were unable to create adequate work arounds that would make the WiiMote more usefull or innovative than the standard mouse and keyboard. Perhaps under future builds of drivers the WiiMotes usefulness in 3d environments may be much more substantial. With more knowledge, and understanding of the drivers, we could make "The Tool" for 3d scene navigation and interaction.


+ Links
WiiLi.org
List of Compatible Bluetooth Devices
WiinRemote
YouTube Video - WiiHoudinii (our inspiration)