Notgames Forum

Creation => Technology => Topic started by: Michaël Samyn on May 04, 2010, 08:31:52 am



Title: Ideas for procedural growth?
Post by: Michaël Samyn on May 04, 2010, 08:31:52 am
I want to create a world in which things grow. Imagine a garden gone wild. Plants and small animals. Though it doesn't necessarily need to be realistic. I'm more interested in the dynamics of growth and life than in a literal representation. I want to do this in 3D because I want the camera to travel through this "garden".

Does anyone have any suggestions as to how to approach this technically?
Or references? Visual or text.
My main concern is performance. I really would like the thing to get quite baroque. But any scenario I can think of would be a disaster for framerate, as the garden gets big.

Maybe I need to find a way to trick the eye into thinking that there's lots of things in the scene. But how?
In 2D, I think, effects of dynamic growth or often achieved by not clearing the screen. Maybe there's a way to do something similar in 3D?

By the way, I do not necessarily need to represent the actual growing animation on screen. It's ok to have static steps of ever increasing complexity.

(I'm prototyping in Unity3D)


Title: Re: Ideas for procedural growth?
Post by: Nate Kling on May 05, 2010, 05:41:02 am
I was actually thinking of doing some similar experiments soon.  I guess one option would be to decrease the triangle count on the models as the camera gets further away.  Another option could be to make 2d versions of the 3d meshs and as the camera gets further away switch to the 2d version in place of the 3d mesh.  The camera would probably have to be pretty far away for that to work though, and I could see other visual issues arising from that.  Maybe those solutions are pretty obvious though haha. :-\


Title: Re: Ideas for procedural growth?
Post by: WarHampster on May 05, 2010, 07:02:16 am
Procedural 3D always makes me think of voxels, look here (http://voxels.blogspot.com/) to see why.


Title: Re: Ideas for procedural growth?
Post by: Michaël Samyn on May 05, 2010, 12:14:20 pm
Voxels are great. I like that 3D shapes can be "full" when created with voxels. I dislike the empty hulls of polygonal models.
(though I do like the smoothness that can be achieved with a combination of polygons and shaders; I'm not a fan of blocky voxels)

But there's not many realtime engines that support them. And simulating voxels with polygons sounds very expensive.


Title: Re: Ideas for procedural growth?
Post by: Michaël Samyn on May 05, 2010, 12:16:31 pm
I guess one option would be to decrease the triangle count on the models as the camera gets further away.  Another option could be to make 2d versions of the 3d meshs and as the camera gets further away switch to the 2d version in place of the 3d mesh.

Level of Detail is definitely an option. I'm even considering using only 2D billboards instead of objects. A bit like static particle systems.
I want to be able to potentially draw thousands of objects.
(in this game, the player creates the environment by adding more and more elements to it; so in theory, the complexity is endless)


Title: Re: Ideas for procedural growth?
Post by: Michaël Samyn on May 05, 2010, 12:38:45 pm
Voxels are like 3D pixels, right? Meaning that they are simply points in space. The fact that they are rendered as cubes or squares is mere convention and/or defined by the output medium. I find the idea of storing shapes as collections of points in space appealing. Then you could choose what you want to render at these points: a cube or a flower or an animated head! :)

If these collections of points need to be animated as if they formed a single structure, they might need to be ordered hierarchically. That would make it a lot less simple.
Another thing that's missing from a definition as point is a direction. Direction can be important when representing living organisms.


Title: Re: Ideas for procedural growth?
Post by: WarHampster on May 05, 2010, 06:53:00 pm
Right, voxels are "volume pixels," they're essentially same as 2d pixels but with a 'z' coordinate. Are you suggesting rendering voxels as polygon models? That's certainly possible, but the point of using voxels is to be able to render everything based on its voxel constituents.

The limitations you mentioned are why voxels are typically used for terrain and little else, ordering and animating objects made of many tiny elements is complicated.


Title: Re: Ideas for procedural growth?
Post by: Michaël Samyn on May 05, 2010, 10:53:11 pm
I'm liking the idea of a more freeform dot-based 3D rendering style. With voxels rendered as spheres, not cubes. And where the arrangement of colours defines the picture, not the shape. A bit like impressionism, I guess. But I'm probably dreaming and this only leads to impossible technology.

In the mean time, I have learned that one of the things that makes the rendering of scenes with many 3D (polygon) objects slow is that a draw call needs to be made for each object. The trick around this is to group the objects together in one mesh (through a script) and then send only big chunks of geometry to the graphics hardware. The requirement for performance improvement is that all meshes share the same material (shader + texture). Otherwise they get split up anyway.


Title: Re: Ideas for procedural growth?
Post by: Jorge on May 06, 2010, 02:50:04 pm
Michaël, I HIGHLY and wholeheartedly recommend you to give a look to this anime: http://www.youtube.com/watch?v=HzV2wChxzH0 . It is called Mushishi. Also, I think it would be also very interesting to you if you check out some Studio Ghibli films like Mononoke Hime (although I think you have already watched this, seeing the similarity it has with The Endless Forest) and Nausicaä of the Valley of the Wind.

Japanese representations of nature are soooo incredible.

EDIT: I didn't see you wanted a technical approach to the theme.


Title: Re: Ideas for procedural growth?
Post by: Michaël Samyn on May 06, 2010, 04:19:38 pm
Inspiration is good too. :)

But indeed, I'm trying to figure out some of the technology to guide decisions on art style. I don't want to represent nature at all. "Garden" is just a metaphor because it's a place where things grow. It might end up looking like a landscape. It might not. Doesn't matter.


Title: Re: Ideas for procedural growth?
Post by: God at play on May 08, 2010, 06:54:00 pm
If you want a lot of objects, I'd suggest you create them as 2D shapes.  You can still use 3D models, but the idea is that the poly count would be really low, which suggests 2D shapes.

If your "plants" are set up as a set of simple geometric pieces, you could just scale up the pieces at different times to suggest growth.  Here's an example I made where the plants follow a Game of Life simulation: http://www.torncanvas.com/torncanvas_ver1-04.swf They're made up of skinny triangles and teardrop shapes.

With procedural growth, you could set up different points on the plants where something might grow, and then based on your rules you could grow that part or not grow it.


Title: Re: Ideas for procedural growth?
Post by: Michaël Samyn on May 11, 2010, 08:26:59 am
2D Shapes do indeed have few polygons. But apparently, these days, polygon count is not such a big deal anymore. It's a lot slower to send 1000 separate 1 polygon objects to the graphics card that a single object made up of 1000 or even 2000 or 3000 polygons! The only requirement is that the all these polygons use the same material.
And Unity can apparently group objects together through scripting!
So multiplication seems to be covered. :)


Title: Re: Ideas for procedural growth?
Post by: Michaël Samyn on May 11, 2010, 08:30:32 am
The next problem is that I need to store all this growth so that the player can save and close the game and reload it to continue playing. Since we're talking about pseudo-living things, I don't think everything needs to be stored. But still, the "garden" needs to be the same when they come back to play. So I'll have to store and load the coordinates and properties of all those thousands and thousands objects? Sounds like that could get very slow (and complicated)...


Title: Re: Ideas for procedural growth?
Post by: Kjell on May 11, 2010, 02:52:10 pm
Quote
It's a lot slower to send 1000 separate 1 polygon objects to the graphics card that a single object made up of 1000 or even 2000 or 3000 polygons!

It depends ( I won't go into detail here ). Under normal circumstances the main performance difference is caused by VBOs, which enables you to store data on the GPU for non-Immediate rendering. However, most engines re-upload the entire mesh as soon as any changes have been made ( which might be applicable for a "growing" environment ), thus losing the performance gain again.

Anyway, the trick is to come up with a algorithm that generates all required variables from only a few parameters ( type, generation etc. + a random seed ). To speed things up you could build lookup-tables for the algorithm ( ex random ) at a reasonable resolution & range, and interpolate between those values.


Title: Re: Ideas for procedural growth?
Post by: Kjell on May 11, 2010, 03:10:11 pm
And the volumetric benefit of Voxels only exists in your head ;) In fact, polygons with 3D textures ( or SSS ) are much more versatile.


Title: Re: Ideas for procedural growth?
Post by: edclef on June 15, 2010, 11:01:32 pm
Maybe take a look at L-systems (http://www.google.co.uk/images?q=l-systems&oe=utf-8&rls=org.mozilla:en-GB:official&client=firefox-a&um=1&ie=UTF-8&source=univ&ei=2ugXTIfsLNiO4gbJu4CpDA&sa=X&oi=image_result_group&ct=title&resnum=4&ved=0CDoQsAQwAw) for a nice simple way of making plants, or at least inspiration of what can be acheived with something quite simple.

If you add some kind of (simple) deforming effects of wind, collision and gravity you might end up with some nice organic, overgrown lushness.

I would go for a mass of simple graphical objects (e.g. particle sprite leaves?) to really get that dense texture of vegetation.


Title: Re: Ideas for procedural growth?
Post by: Andrew Tremblay on July 16, 2010, 09:19:22 am
Fractals provide not only the illusion of detail, but the ability to explore that detail into infinity at very little storage and process cost. It would be additionally appropriate with simulating gardens, since fractals occur everywhere in nature.

As for storing thousands and thousands of randomly generated objects, look into seeding. Sometimes the right algorithm can boil down an entire universe into a single integer.
http://www.gamasutra.com/view/feature/3377/algorithms_for_an_infinite_universe.php

Regenerating the universe each play time might get costly eventually, but load times are always a problem.

As for storing a players changes to a large world, well that depends on what s/he's changing. There's likely no other way of doing it than to just log the actions of the player and pushing it through when the game reloads.

And you might have to resort to 2D for large worlds, at least initially. Check out what this guy is up to if you want to look at performance of a large generated world:
http://www.infinity-universe.com/Infinity/index.php?option=com_frontpage&Itemid=26
This especially:
http://www.infinity-universe.com/Infinity/index.php?option=com_content&task=view&id=106&Itemid=27


Title: Re: Ideas for procedural growth?
Post by: Michaël Samyn on July 16, 2010, 09:47:45 am
Thank you, Andrew. That all look very interesting!