Tuesday, December 9, 2014

Minimal City - Final project breakdown

Minimal City : This is a procedural game completely generated by using Geo Spatial data, L Systems and Rules based modelling. The final product is a game playable on Mac or Windows, made using Unity.

This is a detailed description of what went into my final project for the class. Here are some links to all the good stuff.

Link to download game for Windows http://tinyurl.com/p8rw92v
http://tinyurl.com/lmd44br
Breakdown video Coming Soon
Screen Grabs Coming Soon


There were mainly 4 types of models that I generated for the game

  1. Buildings
    I relied on  Map data from Openstreetmaps.org to get the shapes of buildings. I extruded the building shapes to random heights. (This was not ideal, but there is absolutely no information about the height of the buildings in Openstreetmaps data.) After this I poke holes in the building based on how many windows are specified. Having a lot of Windows caused many Z fighting issues in the building corners and also increased the poly count. So I kept the number of windows to minimum.
  2. Roads
    There is no information about the width of the road in the data. So I had to guess the width of the road by the type of road. (Highway, walkway etc) The hardest challenge when dealing with roads was the intersections. I even wrote an email to openstreetmaps asking them how to interpret lane information in their data. Some roads have multiple lines for lanes, some roads have them all merged into one line.This becomes an issue since I am doing 3D and have plans to extrude roads as well. I couldn't resolve this issue, So I decided to lay all the roads as a Flat plane. This leaves me only Z fighting between primitives to deal with. To prevent Z fight between different roads, I used a for loop to loop through all the patches of roads and translate them in Y axis. It took me 4 weeks to figure this out!

    Here's an example of pretty data and Ugly data from maps. How would I go about converting those choppy lines into one continuous line? :O
  3. Car
    I didn't plan to model everything procedurally until I figured Cars could be modeled using rules based systems. This tool takes a parameterized cube as input and reduces the number of polygons and creates wheels for the car. Here's a test render of the Car that I ended up using.
  4. Trees, Lamppost, Cloud etc.  I have talked about L System rules for the Trees in my previous post. Here's a Gif showing different Trees that I had generated. This is only 1/3 of what's in the game.





Lessons learnt

  1. I didn't have the idea of creating everything in City procedurally. So I ended up with 4 different tools that generates Geometry. Ideally, I should have one tool that does all this.
  2. Never figured out how to best use Location data, even though I had it!
  3. This was way too much work for 2 weeks. But it was time well spent.
Future plans 
  1.  These are the games that are ruling the App store and making some noise.
    https://everyplay.com/videos/11914792
    https://everyplay.com/crossy-road/home
    It means that this art style definitely has some opportunities in Mobile/Tablet market .
  2. Overlay Openstreet map in the mini map?
  3. Unless you are into Racing games, this game doesn't particularly offer anything unique to hook the players! I need to talk to people and figure out the best Gameplay to best use location based maps. This either needs Multiplayer or something else. 
  4. Have a library of assets that replace generic buildings with something more specific. For example , I could search for "McDonald's" and generate a suitable building that looks like McDonalds, instead of just Boxes.

Thursday, December 4, 2014

Houdini tesselation

I am already behind schedule to finish my City Game. I was searching for more reference online for low poly images. I saw some more fascinating images online and the most intriguing part was that they were pretty simple to do! Even though I should be working in Unity right now, I spent the night playing with renders in Houdini. Pretty happy with the results. I started learning Houdini during Christmas break last year. I have been enslaved by this software. The more I know it, the more I love it!

I began messing with the polygon arrangement on a Grid and applied a color palette on it. I tried Quads, Triangles, Sub divided quads.





 

Then I started trying paintings as textures on top of these polygons.
But I thought I striked Gold when I tried a photograph. I changed the Polygon count to get this neat animation effect! Depending on whether you watch these images from 1st to last or last to 1st, it could mean different things. I feel if you watch from low poly face to high poly face, it could be interpreted as "The more I know you the more I love you!". If you watch it from high poly to low poly face, it could mean that "everything fades over time!". Here are the images.












Sunday, November 30, 2014

Minimal City - Update

I spent about 3 straight days to get the model and generate items that I needed for my game. Here's a breakdown of what I did. Since I needed low poly versions of clouds, cars, buildings.
  1. Clouds : I used 2-3 metaball spheres in Houdini to combine and reduce polygon count. 
  2. Trees : here's the L System that I used to generate the trees. I needed the L System generation count just at 1! Because most of the reference that I found had very minimalistic trees with 1-2 branches. Here's the LSystem Rules list that I used.
    Premise : F=FFX
    Rules
    X=~(10)T(10)/(137.5)!(d);"[--F+F(c*r)J]F(r*0.1)[++F-F(c*0.5)J]FXJ:0.25
    X=~(10)T(10)/(137.5)!(d);"[--F+F(c*r)J][++F-F(c*0.5)J]X:0.25
    X=~(10)T(10)/(137.5)!(d);"[--F+F(c*r)J]F(r*0.1)FXJ:0.25
    X=~(10)T(10)/(137.5)!(d);"F(r*0.1)[++F-F(c*0.5)J]FXJ:0.25

    I also spent about an hour making simple Pine trees. I am not completely sure if that would fit well for the low poly aesthetic. But I did that anyway. 
  3. I spent most time wrangling with the data. I found the ugly truth about using an open source data. There are many rules that could be broken when a user is collecting data. Intersections was a huge problem. Openstreetmaps doesn't set very clear guidelines on data collection for intersections. So my Python code cannot identify intersections at all. In the end I just decided to avoid the intersection problem completely.
  4. Car : I didn't know that modeling Car in Houdini could be so much fun! I have a setup that can let you create procedural Low Poly Cars. Since these Cars are really difficult to get perfect looking, it's really useful to have options for your car. (I want to demo this in class)  


Questions/ Concerns :
  1. This is NOT College Station. Yet! There are multiple things that I could do to  fix it. I could manually model some monuments and place them. Or I can display TEXT in the game with the building/Road data. 
  2. Unity integration : This is just a lot of work.





Here are some quick renders.

Sunday, November 23, 2014

Minimal City

I thought a lot about getting my abandoned city idea to real time which was one of the critiques in class. If I proceed with the idea of making images of abandoned city using the map data, most people won't even notice that I used map data! So I decided to do an animation or a game to demonstrate that. (May be Gen art 2015?)! 

Inspired by these images

I made this in Houdini in one sitting. This is a really big image, n then I composited into a spritesheet. It has some issues. But I was amazed how quickly low polygonal Art could be made in Houdini! I hope to make an animation of a paper car driving through College Station. The goal is to match the style of the images above.

Thursday, November 13, 2014

Abandoned city




Final Project - Update

This is what I was working on yesterday. making a lot of window placeholders from a building.
Goals:
Modelling the Windows
Modelling Trees
Texture the roads,
Texture Buildings
Animating city

Presentation goals :
Have a 30 second animation of showing different parts of the city.
Have a 30 second demonstration of how the tool works. (Maybe?)

Friday, November 7, 2014

Choregraphing chaos - Project 3

I was a really late started for this project. Initially I began with the idea of creating multiple pendulums in Harmony to create a wave like motion. But that didn't fully meet the requirements of the project. Then I began looking at mandelbulbs. These beautiful fractals can easily be created using recursion. My initial plan was to create this using Javascript. But after testing my code in HVS I realized how difficult running recursive functions on big screen is. Also it doesn't really help that Javascript is single threaded! I began trying out double pendulums, which I showed in class, but after realizing that two more students are planning to use double pendulums, I started looking for some other topics.

I read about Lorenz attractors and how combination of Sigma, Rho and Beta can control the overall look of the attractors. I initially had the idea of Lorenz attractors reacting to the music. I downloaded minim library for using music with Processing. I had the worst experience with that library! In no other programming language had I found same code running properly in one machine and not running in another! After wasting about 5 hours, I decided to manually choreograph the attractors. I was happy that I could produce such a beautiful patterns in an hour before class. Overall I felt that the project was successful. For a first ever processing program, the result that I had was really good.





Tuesday, October 21, 2014

Monday, October 20, 2014

2 Generative artists

Ansel Hsiao - http://fractalsponge.net/
Procedurally generates spaceships. But it's pretty hard to get information on what methods he uses though.

Kenneth Huff - http://www.kennethahuff.com/
Creates life like qualities to 3D models that has simple composition but the textures make them really stand out.

Sunday, October 19, 2014

Final Project Ideas

1.  Procedural city (detailed)
Since I already made a procedural city in my first project. I want to take that to the next level by adding procedural trees, detailed buildings to that. From the 2d map data I can use the area of each building plot to guess how many storied building it is. I need to start with a building generator and then instancing those buildings based on the map data.

I can assume the map area which are not named to instance trees. These two videos sort of inspired me to take the project 1 further. If I do this right, this could be a useful Games asset as well.
https://vimeo.com/85581391
I like the way they divide the scene into communities and randomly generate communities. I think that's a good way to make things more manageable.
https://www.youtube.com/watch?v=V04dswEIcQU This channel belongs to a commercial software that creates buildings and environments. This could be useful reference as well.
https://www.youtube.com/watch?v=-d2-PtK4F6Y This serves as a good starting point as well.

2. 3D maze generator 
 I was reading about Maze generation and generating a Maze with only one solution. I think I can make a 2D Maze generator and convert that to 3D model. That sounds like something that can be done in Houdini.
http://en.wikipedia.org/wiki/Maze_solving_algorithm


Saturday, October 18, 2014

Evolutionary Chopsticks Final Video

Here's the link to the Final Animation. 
https://vimeo.com/109168758
Here's the code that I used inside a Python SOP in my Houdini network.I had to take a screenshot since I couldn't upload txt files in this blog.
Here's a screenshot of some of the files that were generated.
The reason for delay was that our Grad lab which has the render farm has Houdini 12.5 which is 3 years old. Old versions of Houdini does not have the Python Sop that I used extensively. I had to render everything in the Game lab and each file had to be rendered on different machines locally. I am pretty happy with the final output. But I wish I had a screen capture software license, the video would ve made more sense if I showed the process of creating the hip files.



Tuesday, October 14, 2014

Evolutionary Chopsticks - Honest trailer

Inspiration
https://vimeo.com/85053197
https://vimeo.com/46176321

These two videos convey the idea of what I was aiming for. I wanted to leverage the power of proceduralism in Houdini to create animation. In my last project I couldn't render out things in time, so I spent more time in this project to get the lighting and texturing on this good. The reason these two videos work is because they did a good job of taking a sample representation from the generation and render it in High quality as opposed to rendering all or showing all the generations! I probably need a year to render all the animation that I create!

Lessons learnt in decision making: 

  1. Adding a plate to the animation. I couldn't imagine Noodles falling on the ground. So I decided to keep the plate and only render representational genes that doesn't have chopsticks going through the plate. A lot of animations that I am generating has the Chopsticks going right through the plate or going underneath the ground plane. (Like the one I have right now, which is generation 1) 
  2. Doing an evolutionary animation as opposed to still work. Having to parse 120 Frames of animation just made the process more time consuming.Each gene takes 2 minutes to sim (10 generation takes you 200 minutes of just watching the same simulation and waiting.) and 3-4 hours to render. If I were to do evolutionary algorithms again, I would definitely do something related to procedural modeling. 


The Setup: 

I have a Wire solvers to simulate Noodles and they fall the same way throughout the generations. Plate is a rigid body object that reacts to wire solvers.

Chopsticks : The starting and ending points of the chopsticks are the same. they are keyframed. The algorithm randomly assigns the Slope and Acceleration of the Animation curve. these two parameters determine the way Chopsticks are oriented and how low it will reach.

I only have two parameters that I am trying to optimize. (Slope and acceleration of the animation curve of Chopsticks) Each generation, I create 10 genes.(10 Houdini files) These two parameters get random values assigned initially. In subsequent generations the values assigned depends on the fitness function of each simulation.

Fitness function (Semi Automated) is determined by how much the bounding volume of the Noodles is moved. Depending on the Centroid(in Y axis) of the bounding volume over 120 frames, Fitness function could be high(Noodles has moved up) or low. (Noodles has stayed where it was) This fitness value determines the range of values that gets assigned in each generation. However 2 out of 10 genes still get random values assigned in each generation. (Mutation rate 0.2)

Manual part of all this is opening each houdini file to run the simulation! Houdini cannot simulate files which are not open! (Maybe there is a solution to this) So each time I have to open the file and hit run and wait for it to complete the sim and write out that value to a text file.

Also in many of these files, the chopsticks goes right through the Plate/Ground plane. Sometimes the Physics engine of the wires mess up and wires will actually be hanging in the air! Also there was an option to just reduce number of wires to 2 or 3 and get a really fast simulation and go to maybe 50 generations. I chose not to do it because I wanted this piece to be presentable and even with say 5 generations, we can chose the genes smart enough to convey the idea that it is improving over generations. Although this is not the perfect system that I hoped for, this system gives the Artist to hand pick and render the good simulation that it actually generates. I have only one gene rendered in this submission and I will render few more in a day. This was generation 1. Gene 8.

I will have 4 such videos rendered in High Quality in my final submission.




P.S : hey my first project is coming together pretty well! 












Wednesday, September 24, 2014

Project 1 - So Close




These are the images that I have rendered so far. Since my laptop doesn't have Houdini license, this is the biggest resolution image that I can render today. I will upload a Full HD version very soon. 

Sunday, September 21, 2014

Installing and using Python packages in Windows

Install Python in your machine
Install Setuptools - This makes installing packages easy (https://pypi.python.org/pypi/setuptools#windows-simplified)
easy_install pip (Do this in cmd and you will get pip)

Installing a package found in Pypi.
Download the package and extract the contents in some directory
python setup.py install (Do this in cmd in the right folder - your package is now installed)
python
import deap.
AND struggle to install Open dynamics engine package
That needs Visual studio C++ compiler. Need to install it tomorrow.


Genetic Algorithm

Cool stuffs for genetic algorithm assignment:
Some of the mind blowing genetic algorithm implementations that simulate locomotion without limbs!
http://masayosshm/4617632i.com/anlife/ 
https://vimeo.com/46176321 - The puyo puyo guy! 
https://www.sidefx.com/index.php?option=com_content&task=view&id=2662&Itemid=279 - TunzelBots

Some more genetic algorithms which are related to image processing.

https://vimeo.com/18181622 - Image processing 
https://vimeo.com/74748042 - Maya and Python 

https://www.youtube.com/watch?v=uxourrlPlf8 - Box2D and Vehicles 
https://www.youtube.com/watch?v=UE9W5BifhtQ - Box on Box approach 
https://www.youtube.com/watch?v=Fp9kzoAxsA4 - Flock simulation stuff 
https://www.youtube.com/watch?v=ZpW_ojpmTWk - Trees related 
  Need to get a working version of Genetic algorithm using Text only. No 2D , No 3d. Text first. Then some existing problem like Traveling Salesman Problem. After that come to Houdini and Python.

Friday, September 19, 2014

Chance based City lights

I managed to figure out a way to instance lights in Houdini. In this way I can create 500 point lights in Houdini. Whose intensity and color are randomized. It takes about 30 minutes to render. But the result looks decent considering the 3d models doesn't have any shaders.These are results of test images that I got while working today. Next step is to Take a bigger and complex looking city. Have the camera high enough so that the details like, Car, Trees are not visible. Have one layer of Random point lights, One layer of Spot lights that has light color similar to lights from Cars. That should finally make this project complete.
 

Monday, September 15, 2014

Chance Based Art - Project 1

When I started the project I think I gave too much emphasis on the chance based than the art. So I came up with a particle network in Houdini that moves a point based on a random seed. I added a trail for the point to make it look like a growing path. The vision that I had for this project was to make this convey anticipation that something like arrows in old Indian movies creates.(Couldn't find any link for it :( ) I didn't contemplate enough on the presentation or the medium that I was gonna use for the project. I was at this stage when I presented the idea last week.

I wasn't too happy with my idea and wanted to do something lot cooler. Also some of the classmates had far more interesting problems which was more procedural modeling and less interactive. I wanted to do that as well, so I began looking for topics again.

I saw some of the works by this guy who makes greebles and nurnies, which are really interesting and would be painful to do manually. I thought making something like this could be beneficial to an aspiring game developer. So I started to make procedural buildings or city scapes.

I began with a foreach loop, putting box on top of another box. I was happy with the progress that I made and results started to look like a cityscape from a really wide shot.

Another thing that Phil pointed out is that the city scape isn't complete without roads. Fairly obvious thing which I didn't consider before!

So I examined ways to create roads in Houdini and one obvious way would be to take a curve as an input and extruding them to make a road. One drawback of this approach is that it's a lot of work. I wouldn't call it generative if you are drawing curves to begin with! So I looked at maps and getting map data into Houdini using python.

I didn't find any useful XML data from google maps. I think they want people to buy google earth pro to access that data. Open street maps.org gives away data of entire database for free! Even though it doesn't have all the buildings information about a small town like college station, it gave me detailed information about the roads. So right now I can download map data of college station which is 1mb file size and process and generate it in about 5 seconds. This is a snapshot of the geometry of College Station that I created.

It would be interesting to generate bigger cities or even states and how fast I can do it!

Right now I have all the roads and building blocks which are just cuboids.
I am confused whether to add more details to create higher fidelity buildings or make it more chance based art by randomly populating buildings in the map.   Or both? :) I have 30 hours to figure out.