Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Work in Progress / Spherical Terrain With Trees

Author
Message
paul5147
16
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 23rd Apr 2013 23:48
Dont really now if this should be in here as a wip or not,but its part of my race track editor that just grew out of control,i started out with this crazy idea of instead of having a flat terrain,what if i could make it spherical,so the tracks could just go on and on round and round wherever you liked,ive got as far as building the sphere and normal mapping it properly,using spherical mapped textures for water(thanks WLGfx for the snoise plugin),i can edit it an every thing just like my earlier attempts at my track editor,I have even gone as far as putting in an obj exporter so i can load all the objects up into AppGameKit,now the problem i have is making it usable,in order for it to work well,the sphere has to be massive,which bring up all sorts of problems with speed and LOD routines,so for now heres a sneak peek of what i've been up to,If this takes me half as long as my original track designer i could be while.keep in mind all this is proceduraly generated at run time.

When i get time i will upload a vid of the sphere with a track on,its not much at present,and like i said its not really a new wip as such,but let me know what you think and if i should continue on this path or go back to my original flat track editor,thanks.
Nabz_32x
14
Years of Service
User Offline
Joined: 25th Oct 2008
Location:
Posted: 24th Apr 2013 00:33
Your Spherical Terrain looks very nice!!

When I think about LOD on a spherical Terrain, this video comes to my mind :
http://www.youtube.com/watch?v=rL8zDgTlXso

I would love to see a track editor / racing game on a spherical terrain, would be pretty interesting.

CanĀ“t wait to see this with roads added.

Keep us updated!

Fluffy Rabbit
User Banned
Posted: 24th Apr 2013 00:49
It would be cool if it were as big as a planet, and instead of cars there were space ships, and you could fly from one spherical track to another and meet hot blue alien women and have laser battles with them. Why stop there? You could procedurally generate an entire universe and make a massively multiplayer online space action game.
Chris Tate
DBPro Master
14
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 24th Apr 2013 03:35
That looks promising; is this written in DBP or DGDK? Will it be a plugin or a library?

Mobiius
Valued Member
19
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 24th Apr 2013 21:44
Looking good.

Wonder if I can make a 3d bang bang 3, on spherical terrains??? hmmmmmm.

I live for video games! (And beers, and football, and cars!)
See what I live for here: [url]http:\\www.TeamDefiant.co.uk[/url]
WLGfx
15
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 26th Apr 2013 01:15
Very cool... As of yet I haven't got round to playing with that kind of code yet, but it is definitely looks like something what I'd start with too.

Thumbs up...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
paul5147
16
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 30th Apr 2013 19:43
I need help or at least ideas,i have decided to spend a little longer playing with this but i'm running into problems.
The original setup for these spheres was quite simple,first create a cube with sub-divided sides,place an object at the center position,point it at each vertex and move it the radius required plus a value for noise,then record the position of the object,this turns the cube data into sphere data,simple.
The hard part was taking all this data and making objects with it,and working out all the normals to keep the lighting smooth,but seeing as all the sides are using a shared array of data it was simply a matter of knowing if you go off the left side of the sphere(cube) which sides data to use to match up with it,corners were a bit trickier but not impossible,and as you can see from the previous video,i think it worked quite well,even my editing code was working well and fairly well optimized so as to only update the tiles that had changed,keeping the speed up,and because all the tiles where using a shared array all the objects lined up nicely with no seams or tares and could be rotated freely without any problems.
Now comes the problem,in order to make this usable the terrains needed to be bigger,so when you were closer to the surface you could barely see the curvature,at present each side was made up of 8 by 8 tiles each with a 17 by 17(0-16) vertex pattern and a step of 2 DBPro units between each vertex.But when you come to expand this you soon run into problems with culling,because each tiles position is still 0,0,0 making rotation easy,once 0,0,0 goes out of camera view tiles start to disapear.
So a new approach was needed,this turned out to be quite simple,create the data as before,but store the center position of each tile,when you create the tiles deduct this value and position the finished tile there,and once again everything is back to how it should be,and you can make truly massive spheres without the culling issues,with one problem, you cant simply rotate each tile any more as they all now have there own axis,they have to orbit the center point.This isn't a major problem either as using either EZRotate or offset limbs you can easily do this.
The problem is this,after spending all this time to make sure all the data is shared correctly to avoid any issues like this,after a few rotations the tiles start to come apart as can be seen in the image below,now i know its not the data,as when its first run the seams are not there,they only start to appear after its been rotated a few revolutions not imediatley,with either of the 2 methods,and the longer it rotates for the bigger the problem gets,i can only put this down to rounding errors,but cant see a way round this.

The only option i have come up with so far is to scale each tile slightly,but this has obvious consequences later and shows up the edges of each tile,and is not guaranteed to work,because the more the sphere is rotated the worse the problem gets.
I'm toying with idea of buying dark occlusion and going back to the original method of doing this,does anyone have any experience with it,thanks.
French gui
18
Years of Service
User Offline
Joined: 11th May 2004
Location: France
Posted: 30th Apr 2013 20:05 Edited at: 30th Apr 2013 20:14
Hi! I had almost the same project than some time ago. I ran into a lot of troubles but not the one you get there.


Quote: "The original setup for these spheres was quite simple,first create a cube with sub-divided sides,place an object at the center position,point it at each vertex and move it the radius required plus a value for noise,then record the position of the object,this turns the cube data into sphere data,simple."


Using an object to calculate vertex positions is your lack of accuracy I think. I used Lowerlogic's subdivide and spherize snippets with a cube and everything was perfect. You can find it here: http://forum.thegamecreators.com/?m=forum_view&t=90097&b=6


Here attached my old project with lod and planet with limbs. Badly coded but maybe it can help...

Attachments

Login to view attachments
paul5147
16
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 30th Apr 2013 20:49 Edited at: 30th Apr 2013 21:17
Hi French gui,i dont see how the setup could be out as the vertex data is shared through out all the tiles,and the seams only appear after rotation as happened for a few full revolutions of the sphere.from what i remember that code from the link was only turning one cube into a sphere,mine takes cubes which have faces that have all ready been sub-devided into any number of smaller objects.

Cube setup



Sphere setup



Sphere + Noise



Shows more of how this is setup,each tile is a random color,each of those tiles can be any size or number of vertexes square up to the 65000+ limit
Unfortunately a video of this in wire frame mode does not show up the tearing issue.

I could not check out your code due to all the commands prefixed "KD" must be a plugin i dont have

This image shows the problem a bit more clearly between each of the tiles

French gui
18
Years of Service
User Offline
Joined: 11th May 2004
Location: France
Posted: 30th Apr 2013 22:03
KD command are kaedroho's lod plugin here: http://forum.thegamecreators.com/?m=forum_view&t=159658&b=5

Are your tiles limbs of a main object (like in my attached code) or individual objects? If thoses gaps happen after rotating the whole sphere, I think you should use object limbs.If you're already using limbs then I don't understand!

paul5147
16
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 30th Apr 2013 22:24 Edited at: 30th Apr 2013 22:31
I can set it up to use limbs ore individual objects,if i break each side down into limbs for example 1 sides is 16 by 16 tiles,if i split this up into 4 objects each 8 limbs by 8 limbs,i still get the seams,not as bad but still visible as the backdrop shows through,but it appears worse where the edges of the objects meet.Using the same data but using 16 objects 4 limbs by 4 limbs i get the same problem,the seams appear everywhere but worse between the objects edges.I had a similar problem to this when i made a Rubik cube solver using EZRotate to orbit the sides around the core,after a while the rotations would get slightly out of sink,and if you just left it in the the shuffle loop long enough,just randomly spining sides,it would get really messed up.I have just run a test on the sphere that listed out the change in angle of one of the tiles after each rotation,this should be contstant after each rotation but it varies slightly each time??????? only by a small fraction (0.0001 or so) but over time this adds up,which is why i still think this is a rounding error with the floats used.
French gui
18
Years of Service
User Offline
Joined: 11th May 2004
Location: France
Posted: 30th Apr 2013 22:36 Edited at: 30th Apr 2013 22:47
I mean only one object for the whole planet and each tile is a limb of this main object. Then no need of EZrotate just rotate the main object. I 've just recompiled my code and no seam appear even with the planet in rotation.

edit: attached compiled version (move with WSAD + shift to speed up and space for wireframe)

Attachments

Login to view attachments
paul5147
16
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 30th Apr 2013 22:45 Edited at: 30th Apr 2013 23:31
Thats how the first version of this worked but i soon ran into the vertex limit for objects,which limits the size and detail of the sphere,and as that was the whole reason for splitting it up.I dont want to end up with a spiky terrain,it also brings back up the culling problem if the object at the center that all the limbs are attached to goes off the screen.

Edit: Tried your exe but i just get a black screen with yellow text showing cam position and fps but 0 polys and no planet?
Green Gandalf
VIP Member
17
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 1st May 2013 00:49
Quote: "Tried your exe but i just get a black screen with yellow text showing cam position and fps but 0 polys and no planet?"


Same here.
Matty H
14
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 1st May 2013 02:05
I also did something very similar to this with LOD, I was not happy with the way the LOD joined up, but that's a different issue.

I think you really need it to be one object, you are then guaranteed it will always look right no matter what the rotation.
As far as I know there is no vertex limit for objects, only for meshes/limbs, so you can add lots of limbs, this is how I did it.

I also turned off culling and added my own system, it was very basic but worked fine. I basically tested each limb to see if it was inside a massive sphere in front of the camera, there are better methods but that was easy to get up and running quickly.

This looks awesome by the way, good luck with it, let me know if you think I may be able to help.

paul5147
16
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 1st May 2013 08:26 Edited at: 1st May 2013 09:30
Thanks French gui an Matty H,i think im going to go back to the first version that was all one object and try and figure out why it kept failing as the sizes of tiles increased,i all ways assumed that the the 65535 vertex limit was for the whole object,limbs included,maybe im missing something.
Strange thing is after rebooting the pc this morning for the first few times a ran the same code,the tares never appeared,feeling pleased with myself i went and made breakfast leaving it running,only to come back and see what looked like the aftermath of an earthquake had happened.
Edit :
Gone back to the original code i had of making this as one object with limbs and found a typo in the generation of the limbs which seems to have cured the limits i was having making the sphere larger,unfortunately i'm now starting to get tares appearing in this version too.
This wasn't the case when i first started this project,so i have tried a few of my other projects and noticed this happening with them too.I have tried out this version with 1 object and multiple limbs,and the previous version with multiple objects on my laptop and don't get the problem at all,so i think this could be a hardware/driver issue,i have just updated my nvidia display drivers?
Edit:
Rolled back the driver version and as if by magic the problems fixed for now,maybe its time think about upgrading this PC,especially as my laptop was getting a much higher fps!
French gui
18
Years of Service
User Offline
Joined: 11th May 2004
Location: France
Posted: 1st May 2013 10:45
Quote: "Tried your exe but i just get a black screen with yellow text showing cam position and fps but 0 polys and no planet?"


Camera angles are controlled by mouse, so move mouse a bit down and planet should appear
Green Gandalf
VIP Member
17
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 1st May 2013 12:16
So it does. Thanks.
paul5147
16
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 1st May 2013 13:08
French gui,now i get it.
Sorted my problems with the seams by going back to one object and lots of limbs,but its made a mess of the editing routines now as they were relying on multiple objects,so its back to the drawing board for that feature at present.I did run back into the index limit of 65535 per object,but that just means i had to split it up into more smaller limbs,so far so good
WLGfx
15
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 1st May 2013 14:36
When you say after so many revolutions the seams appear, are you using the modulus to get the rotation angles between 0 and 360 or are the angle values going on forever? I know you've probably already thought about it but one objects has many limbs, and each limb could be offset too which might make it easier to rotate instead of orbiting using EZRotate.

I'm not that far off trying this out for myself too. This looks cool. The last time I played with the 3D noise I just created a spherical texture, but this, wow...

By looking at the way you've done this, I was also thinking that the separate sections can be generated on a thread, when complete can replace the underlying one. For LOD processing anyway.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
paul5147
16
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 1st May 2013 15:56 Edited at: 1st May 2013 19:10
Thanks WLGfx,i think my rotation problems were due to float rounding errors,i've tried various routines on different machines and got different results,my main PC that I usually program on,I had just updated the graphics drivers on,and on rolling back the drivers the results changed yet again,so for now i've given up on the separate object path and gone back to a single multi limbed object.
Is there a way of changing the seed for you snoise plugin,thanks again by the way i couldn't have done this without it.
All the calculations that go on to create the sphere are done on an array of data before any tile objects are created,as for LOD it would simply be a case of building however many versions of each tile you want from that same data,but going through the data in larger steps.That is unless you want to iron out the kinks in the edges,i still haven't seen a good way of doing that.
The complicated thing to get your head around when doing this is the normal creation,you can't just use "set object normals",well you can but it wont look smooth like mine,believe me i tried.
I came up with what i think is a very novel solution to the problem and i'm quite proud of it,just imagine 6 shoe box lids made into a cube,all sharing the same data and you will be halfway there.



Thanks to every one for there help and sugestions.
Nabz_32x
14
Years of Service
User Offline
Joined: 25th Oct 2008
Location:
Posted: 1st May 2013 16:32
I also tried to add Level of detail to terrain, by going through my data in larger steps and also got the problem with edges not fitting correctly between different LOD step variations, if you find a good solution for this, please let me know, as I would be very pleased to learn how to do this correctly.

Very good work and good to know this project is still advancing.

MrValentine
AGK Backer
11
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 1st May 2013 21:44
Oooooh pretty, hi all just tagging in!

paul5147
16
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 1st May 2013 21:50
Hi and thanks MrValentine,how did you get on with using Dark Occlusion with your projects,did it make a big difference,i'm thinking of purchasing it,and this could be the ideal project for me to try it out on.
MrValentine
AGK Backer
11
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 1st May 2013 22:00
Umm, I was waiting for the DLL version to be released, as it would make for simplified development and packaging, it was completed in a basic functionality form as stated by the developer and was submitted to TGC for adding to user lists for download... but... [goes to check] IT IS AVAILABLE TO DOWNLOAD TODAY!!! how funny if that wee time to go test it out!

So as such I cannot state anything until I test it out now

I did however attempt to use it in a test with 5000-10000 rotating randomly generated randomly scaled cubes but as I did not optimise the code I did not gain more than about 20~fps still not bad though but I will test now with the DLL version

WLGfx
15
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 1st May 2013 22:46
I'm assuming all of this is being done in DBPro and not C/C++. I'll dig out the source code and boot up into Windows (not done that for a while) and look at changing the seed for the simplex noise. As I remember the perlin noise had a seed changer but wasn't 3d or 4d but simplex noise was fast and I never got around to changing the seed value.

I'll post back here with an update to the simplex noise dll for you with the seed value... The simplex noise is table based so I'll add a function to randomise the table used by the algorithm...

Fingers crossed I'll have it done within the next hour or two...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
WLGfx
15
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 2nd May 2013 00:43
@paul5147 - attached to this post is a new dll and ini file with an added function which uses a temp table to regenerate the permutation table for the simplex noise functions using a new seed value.

New command:

SN NEW SEED intvalue

I just tested that it works with this:



Another note... Try setting the setup size of your sphere so that it's size is around 1.0 and then scale it from there. The rounding errors on floats happen often in worlds generated with coords over 60k, but never if it is scaled down to values of -1.0 to 1.0... Well, rarely anyway...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!

Attachments

Login to view attachments
paul5147
16
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 2nd May 2013 07:43
@ MrValentine look froward to hearing your results and opinions on it.

@ WLGfx thanks for that ,ill take a look as soon as i get home but the little snippet works great.
MrValentine
AGK Backer
11
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 2nd May 2013 10:00
Ah yes Materials, you can create your own, control the rebounds etc...

MATERIAL

DYN GET MATERIAL
DYN MATERIAL GET DIR OF ANISOTROPY
DYN MATERIAL GET DYNAMIC FRICTION
DYN MATERIAL GET DYNAMIC FRICTION V
DYN MATERIAL GET FLAGS
DYN MATERIAL GET MATERIAL INDEX
DYN MATERIAL GET STATIC FRICTION
DYN MATERIAL GET STATIC FRICTION V
DYN MATERIAL SET DIR OF ANISOTROPY
DYN MATERIAL SET DYNAMIC FRICTION
DYN MATERIAL SET DYNAMIC FRICTION V
DYN MATERIAL SET FLAGS
DYN MATERIAL SET STATIC FRICTION
DYN MATERIAL SET STATIC FRICTION V
DYN SET MATERIAL

Hope that helps...

Phaelax
DBPro Master
19
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 2nd May 2013 12:30
From the first picture I could tell you were using simplex noise. I was just reading over it last week and wanted to implement it but hadn't found a detailed resource yet explaining the algorithm.

"You're all wrong. You're all idiots." ~Fluffy Rabbit
paul5147
16
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 2nd May 2013 22:50
@ WLGfx works great,i was getting fed up staring at the same world rotating over an over.Never really thought about keeping the world small and just zooming in,or scaling it.I'll give it a try with the multiple object version and see what happens,I could have been beating this with the wrong end of the stick.
@ Phaelax i was trying to do this previously with perlin noise but i just couldn't get rid of the seams where the faces joined on the left and right sides,perlin is great around in a loop as it tiles well opposite edge to edge, but your left with the 2 sides that need the same pattern along all four edges.With 3d simplex noise this isn't an issue.I couldn't find a decent description of the algorithm either,and was surprised to find WLGfx's plugin which works great.
French gui
18
Years of Service
User Offline
Joined: 11th May 2004
Location: France
Posted: 3rd May 2013 19:34
Whoa! "Leaving the moon" animation:

WLGfx
15
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 7th May 2013 19:57
How are you getting on with the problems with seams. Any luck yet. I'm about to start work on something similar

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
paul5147
16
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 7th May 2013 22:38
@WLGfx I've tried various methods of doing this now,but end up back with the one object multiple limb set up,it seems its the best way to keep this whole thing together,making the step size really small so the whole thing is only around 1 unit diameter also seemed to work for the multiple object route of doing this,but it only really just delayed the problem and over time the errors still occurred.
I'm a bit tied up with work this week,but hopefully this weekend i will have the editor code optimised enough to make it usable at a decent frame rate,it was much simpler with the multiple object version and sparkys collision,now i have to convert the face hit to a limb first,which is ok while the sphere is small,but soon adds up to a few fps when the number of limbs per side start going up.
pavel_sv_1982
9
Years of Service
User Offline
Joined: 9th Apr 2013
Location: Russia
Posted: 28th Aug 2013 03:49
How textured spherical terrains?

textured object x,x - no can do

Attachments

Login to view attachments
Ashingda 27
14
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 28th Aug 2013 06:22
This is good stuff!

pavel_sv_1982
9
Years of Service
User Offline
Joined: 9th Apr 2013
Location: Russia
Posted: 28th Aug 2013 18:26
sorry for frequent messages

i use this code



and get this image:

Why is green terrain?

Attachments

Login to view attachments
paul5147
16
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 1st Sep 2013 13:45
try not scaling it an see what you get

Login to post a reply

Server time is: 2022-12-02 20:12:58
Your offset time is: 2022-12-02 20:12:58