Statistics | We have 1675 registered users The newest registered user is dejo123
Our users have posted a total of 30851 messages in 1411 subjects
|
Who is online? | In total there are 45 users online :: 0 Registered, 0 Hidden and 45 Guests None Most users ever online was 443 on Sun Mar 17, 2013 5:41 pm |
Latest topics | » THIS FORUM IS NOW OBSOLETE by NickTheNick Sat Sep 26, 2015 10:26 pm
» To all the people who come here looking for thrive. by NickTheNick Sat Sep 26, 2015 10:22 pm
» Build Error Code::Blocks / CMake by crovea Tue Jul 28, 2015 5:28 pm
» Hello! I can translate in japanese by tjwhale Thu Jul 02, 2015 7:23 pm
» On Leave (Offline thread) by NickTheNick Wed Jul 01, 2015 12:20 am
» Devblog #14: A Brave New Forum by NickTheNick Mon Jun 29, 2015 4:49 am
» Application for Programmer by crovea Fri Jun 26, 2015 11:14 am
» Re-Reapplication by The Creator Thu Jun 25, 2015 10:57 pm
» Application (programming) by crovea Tue Jun 23, 2015 8:00 am
» Achieving Sapience by MitochondriaBox Sun Jun 21, 2015 7:03 pm
» Microbe Stage GDD by tjwhale Sat Jun 20, 2015 3:44 pm
» Application for Programmer/ Theorist by tjwhale Wed Jun 17, 2015 9:56 am
» Application for a 3D Modeler. by Kaiju4u Wed Jun 10, 2015 11:16 am
» Presentation by Othithu Tue Jun 02, 2015 10:38 am
» Application of Sorts by crovea Sun May 31, 2015 5:06 pm
» want to contribute by Renzope Sun May 31, 2015 12:58 pm
» Music List Thread (Post New Themes Here) by Oliveriver Thu May 28, 2015 1:06 pm
» Application: English-Spanish translator by Renzope Tue May 26, 2015 1:53 pm
» Want to be promoter or project manager by TheBudderBros Sun May 24, 2015 9:00 pm
» A new round of Forum Revamps! by Oliveriver Wed May 20, 2015 11:32 am
|
|
| My internet Asploded + The Creature Engine's visualisation | |
|
+7Waap Noitulove US_of_Alaska ~sciocont Commander Keen eumesmo Bashinerox 11 posters | Author | Message |
---|
Bashinerox Programming Team lead
Posts : 238 Reputation : 8 Join date : 2010-07-07 Age : 35 Location : Australia
| Subject: My internet Asploded + The Creature Engine's visualisation Mon Nov 08, 2010 12:24 am | |
| Hey everyone,
It turns out that sometimes having surge protection on a cheap adsl modem is better than more expensive things like plasma screen tv's and the like :/
It blew up. And i've been too busy to come online during lectures.
Being a full-time student again, I've been having to save up for a new modem. Took a while, but i'm finally back, with a brand new crappy Netgear DG834
In the meantime, I've been working both of the two most important part of the game. The first being how to visualise creatures in the creature engine. I've tried out many different theories, and have finally rested on what I hope will be as close as possible to realistic-looking organic constructs.
First, lets look at spore. People may go "omg its such a crappy system blah blah blah" but in reality, what they did is actually quite complex, and impressive. They allowed anyone with absolutely no talent whatsoever to create their very own creature with minimal effort.
And to do that took alot of work.
They used the very common combination of metaballs and marching cubes in a smart way. This part is important, as it forms the basis for our visualisation engine:
(The following section of this post is for two purposes.)
(A) -> To Show just how complicated it is to program stuff like this. This is getting into reasonably advanced maths, jsut to draw stuff to the screen. We're talking trig, matrix math, calculus, rotation using quaternions, its all pretty insane. Programming is easy. Programming something useful is difficult. Just because i know a programming language, doesn't mean i always know what to say to the computer. I talk code, not calculus :/
(B) -> To show what i'm currently actually doing, for the curious.
A metaball is a function whereby
i = 0, nsum{ metaballi(x,y,z)} <= threshold
One of the most common functions for which is:
f(x,y,z) = 1 / ((x - x0)2 + (y - y0)2 + (z - z0)2)
where (x0,y0,z0) is the centre of the metaball
Which, for those that aren't mathematically inclined, is a "fancy" way of saying that at the centre of the metaball the density is 1, and reduces by the inverse-square of the distance. Or,
f(r) = (1 − r2)2
where r is the distance to metaball(x0,y0,z0)
Anyways, the "<= threshold" is the boundrary condition. in order to actually render the metaball, we need to take this boundrary condition and turn it into polygons.
IN order to do that, we use Marching cubes.
Marching cubes samples the metaball at various points on a cubic grid in 3d space.
This is where things get a little more complicated
The grid is divided into cubes (which share edges) and each corner of the cube (8 of them) is sampled, compared against the threshold value (in the case of metaballs, this is usually 0.5f) which means that each point is clamped to a boolean of either 1 (the value was higher than the threshold) or 0(The value was lower than the threshold)
this creates a total of 28 = 256 combinations of values.
In order to make it faster all of these combinations are stored as a giant table in memory.
Each combination responds to a polygon configuration, which is rendered into that cubic space, and the next cube in the grid is computed. This generated the mesh of the metaball.
If we want to create two metaballs on the screen, we add the two metaball functions for that point in space. This is where it gets interesting, as a metaball by itself is essentially a sphere, however, when you have two metaballs in close proximity, the fact that the metaballs are reppresented using a density field that decreases with distance, means that at a point between the two metaballs whereby the density was below threshold for each metaball alone, the two combined may be above the threshold.
This gives a melded organic appearance which many people will recognise as "looking like mercury"
where is this all going with Spore?
Spore had a metaball for each point on the creature's spine.
the mouse wheel scrolling on a point of the spine changed the metaball's intiial density.
(instead of starting at 1, each metaball has a variable intial density. so for:
f(r) = (1 − r2)2
We have
f(r) = (d − r2)2
where d is initial density)
Which, of course, changed the size of the body of the creature
So, what about Thrive?
Thrive's Solution: PARMFIELDOBJ: The new metaball. (Or rather, the extended Metaball.)
It stands for PARaMetized density FIELD OBJect
Or Parametized Density Field Object
I spent alot of time wracking my brain on how to further improve the hulling of the popular metaball method. spline conversion to polygonised surfaces was great until you get to hulling said surfaces with a "skin"
the answer came to me when converting the rendering engine from openGL to DirectX:
Lighting. Lighting is essentially a density field system.
You basically take the density (or rather, intensity) of a point on a polygon at every pixel for that polygon, and multiply that intensity by the normal (the direction that polygon is facing) as well as the camera's angle in order to determine final pixel intensity.
Now, light systems usually have more than just an omnidirectional point light. (basically the same as a metaball function, it even uses the inverse square law to calculate falloff.)
The most important type that sprang the Parametized Density Field Object idea is the cylindrical light.
You have a line segment, and calculate the light intensity by getting the distance to the nearest point on the line (which just happens to be at a right angle to the line for cases where the sample point lies inbetween the line on parallel axes(that is the plural of Axis, btw.)) Of course if outside the line you get the distance to the nearst endpoint of the line segment.
This creates a sort of capsule shaped density field. A bone, as it were. Which can also be extended to an arc instead of a line as detailed below:
And then you have a horn:
a line segment, or arc, (a circular arc, that is, an arc that if extended would create a perfect circle. Complex spiral shapes would be made up of many arc primitives) that has two different density values at each end. the density is interpolated (linearly or otherwise) along the line or arc, to create a "bone" with altering shape.
To calculate the closest point of an arc is quite simple, you find the centrepoint of the circle representing the arc (which you initially have if you are creating the arc programmatically anyway) and get the intersection point by drawing a line from the circle's centrepoint to the sample point. Mathematically, this involves some creativeness, involving dot and cross products in order to get a vector representing that line. of course, if the angle is greater than or less than the arc endpoints, you find the distance to that endpoint instead.
Anyways, a third type would be muscle, whereby the density at the centrepoint of an arc is set, and decreases to zero towards the endpoints.
Then you take the density values and run marching cubes (Actually i'm using marching tetrahedrons, its almost the same but uses on it.
Now. We have a bunch of parametised constructs, and order them in a heirachy so that we can move them around at the joins (Inverse Kinematics om nom nom) This is called rigging
but how do we move the polygonised hull aronud the rig?
Yet again, good ol' spore figured out a way.
I accidentally reverse engineered this in my head, by the way. Yes, i accidentally reverse engineer game technology in my head.
for every vertex created, you assign metadata to the vertex containing the percentage (clamped to a value between zero and one, one being 100%) of density that each density generating object contributed to bringing that vertex to the threshold. then when moving the parts of the rig (The representation of the parametised objects) around, you multiply the distance each object moved (that represents a given vertex) by it's contribution (a technique similar to the standard rigging processes known as weighting) add up the weighted movement vectors for each object and you get the new position of the vertex.
This means that if two rig items move in opposite directions, a vertex containing 50% contribution (weighting) from each object will no move at all. vertexes offset slightly to that will move slightly, increasing in distance for vertexes originating further away from shared density space.
Currently, I am working on constructing the Parametised objects. The mathematics gets quite complicated, so it'll take a while. | |
| | | Bashinerox Programming Team lead
Posts : 238 Reputation : 8 Join date : 2010-07-07 Age : 35 Location : Australia
| Subject: Re: My internet Asploded + The Creature Engine's visualisation Mon Nov 08, 2010 8:00 am | |
| TEXTURING:
a single repeating texture will be applied to the entire skin.
However, Given additional textures, up to one more for each Parmobj, blending can be done on the textures (yay for multitexturing) using the computed weights in order to blend the textures from one object type to another, on top of specifying a global texture weight for that object too.
This allows us to say for instance have horns sticking out of the creature with definable blending between the two (anywhere from linearly interpolated values to a sheared boolean via a 50/50 threshold) with a global texturing weight of 1.0, giving the creature for instance white boney horns sticking out of the head
Given a low texturing weight, something like skin covering a muscle that is a slightly different colour from the rest of the skin is possible. or even some form of "carapace" texture on areas mostly rendered by bone areas
| |
| | | eumesmo Regular
Posts : 297 Reputation : 4 Join date : 2010-07-09
| Subject: Re: My internet Asploded + The Creature Engine's visualisation Mon Nov 08, 2010 10:32 am | |
| welcome back bashinerox, i was starting to fear you were not coming back.... WOW.... all of this sounds really great ingame, i'm really looking forward for it...
a crappy modem is better then none at all....
| |
| | | Bashinerox Programming Team lead
Posts : 238 Reputation : 8 Join date : 2010-07-07 Age : 35 Location : Australia
| Subject: Re: My internet Asploded + The Creature Engine's visualisation Mon Nov 08, 2010 10:38 am | |
| - eumesmo wrote:
- welcome back bashinerox, i was starting to fear you were not coming back....
WOW.... all of this sounds really great ingame, i'm really looking forward for it...
a crappy modem is better then none at all....
Yeah that's true. it does the job. I'd draw an example of the system if i could find my wacom drawing tablet... | |
| | | eumesmo Regular
Posts : 297 Reputation : 4 Join date : 2010-07-09
| Subject: Re: My internet Asploded + The Creature Engine's visualisation Mon Nov 08, 2010 10:42 am | |
| oh well...... one question. the metaball work you are doing now it is directly observable in the gui end of the game, right?
.....by while you mean something like a month or so?
| |
| | | Commander Keen Industrial Team Lead
Posts : 1123 Reputation : 36 Join date : 2010-07-23 Location : Czech Republic (not that anyone would know where it is...)
| Subject: Re: My internet Asploded + The Creature Engine's visualisation Mon Nov 08, 2010 10:48 am | |
| Welcome back!
Great description you wrote here. I'm no maths guy, but I managed to understand most, if not all, of it.
Also RIP your modem.
| |
| | | ~sciocont Overall Team Lead
Posts : 3406 Reputation : 138 Join date : 2010-07-06
| Subject: Re: My internet Asploded + The Creature Engine's visualisation Mon Nov 08, 2010 6:23 pm | |
| Alaska and I were getting worried. welcome back. I'm quite impressed with the work you've been doing. I'm no expert on this type of coding, but as far as I can tell, it all conceptually checks out, and the maths seem to make sense. If we implement this as is, we're going to have an excellent end product. Also, thank you for solving the endless puzzle of what the plural of "axis" is. And RIP your modem.
By the way, would you mind me putting up some of this description on ModDB? UI'm sure it will attract a lot of attention from serious programmers who may be waiting to see something attainable come out of our project. | |
| | | US_of_Alaska Overall Team Co-Lead
Posts : 1335 Reputation : 29 Join date : 2010-07-07 Age : 31 Location : Australia
| Subject: Re: My internet Asploded + The Creature Engine's visualisation Mon Nov 08, 2010 6:39 pm | |
| Wow. I understand maybe 60-70% of that, but i think i got the gist. I must say, you're quite the genius to come up with these ideas (and to reverse engineer games by accident!). And RIP your Modem. | |
| | | Noitulove Regular
Posts : 237 Reputation : 0 Join date : 2010-07-09
| Subject: Re: My internet Asploded + The Creature Engine's visualisation Mon Nov 08, 2010 8:14 pm | |
| Hold on, let me make sure I'm not hallucinating or anything after not seing any progress in terms of programm-
Why, yes! It is! It's true!
Good to have you back, and sorry to hear about your modem.
It's amazing that I could understand at least half of it, because I'm not really into math or programming, just doodling creatures and tossing around ideas. But thank goodness I can, because if I didn't this comment probably wouldn't exist as is, maybe just asking you to simplify it.
Anyway it's great to hear progress is being made so we can have something to show!
Also, looking forward to that visual representation thingy. If you can't find your tablet your mouse will probably be alright | |
| | | Bashinerox Programming Team lead
Posts : 238 Reputation : 8 Join date : 2010-07-07 Age : 35 Location : Australia
| Subject: Re: My internet Asploded + The Creature Engine's visualisation Mon Nov 08, 2010 11:17 pm | |
| - US_of_Alaska wrote:
- Wow. I understand maybe 60-70% of that, but i think i got the gist. I must say, you're quite the genius to come up with these ideas (and to reverse engineer games by accident!). And RIP your Modem.
I'm no genius reverse engineering game technology isn't that hard if you have underlying knowledge of computer software and the graphics pipeline. It really helps me cheat in games, that's for sure "Oh look the plasma sword lunge in halo2 is high velocity. high velocity + the fact that polygons are infinitly thin? muahaha. what if i lunge at someone on the other side of a wall? oh snap im outside the level :D" | |
| | | Waap Newcomer
Posts : 77 Reputation : 1 Join date : 2010-07-20 Age : 26 Location : Waap. HQ
| Subject: Re: My internet Asploded + The Creature Engine's visualisation Tue Nov 09, 2010 4:12 am | |
| Now THAT is truly awesome! I don't see how people can make so much sense out of the first post.I'm just like o.0 I can't get halfway through the introduction of a coding manual without frazzling my head. It's sad. RIP your modem. -Waap.
| |
| | | The Uteen Sandbox Team Lead
Posts : 1476 Reputation : 70 Join date : 2010-07-06 Age : 28 Location : England, Virgo Supercluster
| Subject: Re: My internet Asploded + The Creature Engine's visualisation Tue Nov 09, 2010 12:00 pm | |
| - Noitulove wrote:
- Hold on, let me make sure I'm not hallucinating or anything after not seing any progress in terms of programm-
Why, yes! It is! It's true! Did you just pinch yourself? Hit yourself? Kill yourself? Well, evidently not the last one. Can't say the same for that poor old modem... RIP poor lost modem... I shall now quote myself (with one or two tiny edits) to say goodbye to your modem...
- The Uteen wrote:
What if you're a plant modem? (On second thoughts, that whole sentence needs striking)
- Not Thrive anymore... Umm... God? wrote:
- There is sudden silence, as the
herbivore power surge? slowly creeps up on you... You try to run, but you have no legs! Alas, the vicious herbivore surge eats your modem alive! The sad, slow, reminiscent music starts to play and you mourn your poor plant modem...
- Bashinerox, not the strange creepy player guy person wrote:
- I'll never forget you! I wish I could see your beautiful leaves and mushroomy taste just one last time (I assume your modem possessed those qualities). Why do such cruel things have to happen to innocent
plants modems (assuming your modem is innocent. Is it??) like you!?!? I'm so sorry, there was nothing I he could do... The herbivore power surge was too fast with those incredible, evil legs! I he loves you, alien plant modem thing without a brain! I mean, [deleted ] :cry:!
(MEGA roflmao sorrow! Strange, creepy Kind, caring, programming, player Bashinerox guy person, welcome back to Thrive!) That should do it. One, great, goodbye and welcome back speech. You almost can't tell I made any edits at all!
Now then, I'll be honest. I understood about 10% of that. But what I did understand, I liked. Except that was the dead modem bit... I didn't like that bit, but I liked what I didn't get a word of!
If I don't understand it, it's good news for Thrive! (or it's gobbledygook, which isn't. Except alien gobbledygook. I really hadn't thought that through. My brain hurts)
Anyway... Nice ideas. I can tell they are not gobbledygook, maybe, and I appreciate the ideas greatly! Even if it is gobbledygook, which it probably isn't!
What a 300th post... Full of sorrow, gobbledygook (which is in the dictionary ), minor edits, misunderstandings and more... All I can say is... My brain is really starting to hurt!
Last edited by The Uteen on Wed Nov 10, 2010 11:40 am; edited 7 times in total | |
| | | Commander Keen Industrial Team Lead
Posts : 1123 Reputation : 36 Join date : 2010-07-23 Location : Czech Republic (not that anyone would know where it is...)
| Subject: Re: My internet Asploded + The Creature Engine's visualisation Tue Nov 09, 2010 3:10 pm | |
| - The Uteen wrote:
- Longpost
This made me laugh on the floor twice, but regardless it's spam from three quarters. At least make it in smaller font if you have to post it.. | |
| | | The Uteen Sandbox Team Lead
Posts : 1476 Reputation : 70 Join date : 2010-07-06 Age : 28 Location : England, Virgo Supercluster
| Subject: Re: My internet Asploded + The Creature Engine's visualisation Tue Nov 09, 2010 3:41 pm | |
| - Commander Keen wrote:
- The Uteen wrote:
- Longpost
This made me laugh on the floor twice, but regardless it's spam from three quarters. At least make it in smaller font if you have to post it.. Well, the whole post is now 'small', but it hasn't done a thing... I think it's broken or something. But point taken: less spam and less gobbledygook from now on. Not including that previous sentence, or this one. | |
| | | ~sciocont Overall Team Lead
Posts : 3406 Reputation : 138 Join date : 2010-07-06
| Subject: Re: My internet Asploded + The Creature Engine's visualisation Tue Nov 09, 2010 6:20 pm | |
| [quote="The Uteen"] What if you're a plant modem? (On second thoughts, that whole sentence needs striking) - Not Thrive anymore... Umm... God? wrote:
- There is sudden silence, as the
herbivore power surge? slowly creeps up on you... You try to run, but you have no legs! Alas, the vicious herbivore surge eats your modem alive! The sad, slow, reminiscent music starts to play and you mourn your poor plant modem... - Bashinerox, not the strange creepy player guy person wrote:
- I'll never forget you! I wish I could see your beautiful leaves and mushroomy taste just one last time (I assume your modem possessed those qualities). Why do such cruel things have to happen to innocent
plants modems (assuming your modem is innocent. Is it??) like you!?!? I'm so sorry, there was nothing I he could do... The herbivore power surge was too fast with those incredible, evil legs! I he loves you, alien plant modem thing without a brain! Remind me to put this in the next devblog. | |
| | | Poisson Regular
Posts : 322 Reputation : 11 Join date : 2010-07-07 Age : 29 Location : AK (GMT -9)
| Subject: Re: My internet Asploded + The Creature Engine's visualisation Tue Nov 09, 2010 9:31 pm | |
| Good to see you back here, Bashi. I'll try reading that when I don't have a massive headache from dehydration. It doesn't help that I don't understand much of the math in it. | |
| | | Invader Experienced
Posts : 528 Reputation : 11 Join date : 2010-07-10 Age : 28
| Subject: Re: My internet Asploded + The Creature Engine's visualisation Tue Nov 09, 2010 10:51 pm | |
| Okay, I understood none of that (actually, I understood enough for it to matter). On the other hand, that's almost always a good sign! Welcome back, Bashi!
And RIP your modem. | |
| | | Tenebrarum Society Team Lead
Posts : 1179 Reputation : 32 Join date : 2010-10-01 Age : 31 Location : ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn
| Subject: Re: My internet Asploded + The Creature Engine's visualisation Thu Nov 11, 2010 6:08 pm | |
| And as Bashi descended to Earth once more, a choir of angels singing gloriously to herald his return, we wept for the glory of the tablets he had constructed. The Metaball Commandments.
Wow man. Just... Wow. This is truely beautiful stuff. Just complex enough to keep the ball rolling in the right direction, just simple enough to keep the computers and code from asploding.... This is beautiful. | |
| | | Sponsored content
| Subject: Re: My internet Asploded + The Creature Engine's visualisation | |
| |
| | | | My internet Asploded + The Creature Engine's visualisation | |
|
Similar topics | |
|
| Permissions in this forum: | You cannot reply to topics in this forum
| |
| |
| |