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.

Dark GDK / Inifitely Large Sky Sphere

Author
Message
iSilver
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 19th Mar 2011 04:11
I'm creating a Space Game.

So far I've created a Sky Sphere like this:

// ********* Make SkySphere *************

int Skyboxid = 2;

// create, load and scale the skybox - OUTER
dbMakeObjectSphere( Skyboxid ,-100000);
dbLoadImage("DebrisField.png", 3);
dbTextureObject( Skyboxid ,3);
dbScaleObjectTexture( Skyboxid, 5, 5 );
dbSetObjectTexture( Skyboxid, 0, 1);
dbPositionObject( Skyboxid ,0,0,0);
dbSetObjectAmbient ( 2, 1 ); // ambient light
dbSetObjectLight ( 2, 0 );

dbSetCameraRange ( 1.0f, 100000.0f ); // set range




One problem is that when I'm far away from the edge of the universe, the texture becomes really dark.

Second problem is scale. I intend on the universe being very very big. Like, right now my character can travel through the world in 2 minutes, and that's not acceptable. I'd like it to take about 5+ minutes to go from one end to the other.

Any advice?

While I'm at it, anyone know where I can find free skysphere textures for space that would be 360 degrees?


Thanks,

Flamesilver


PS: Without you guys, I wouldn't've gotten very far. So far I've got a 3D space game with overhead fixed, overhead chase, and 3rd person view, full physics implemented via fulcrum, and I can fire bullets that interact with other ships (and give knockback). Soon I'll have a working game! Thanks guys!
WLGfx
16
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 19th Mar 2011 04:30 Edited at: 19th Mar 2011 04:31
This is something I was thinking about sometime ago. I'd like to see how you get on with this.

My thoughts initially was to use a random seed for each cubed area of space and place textured objects in the areas surrounding it. Each time you moved into a different cube area of space then delete old objects and add the others for the new surrounding areas. That way space could go on forever.

Warning! May contain Nuts!
F4SHAD0
13
Years of Service
User Offline
Joined: 28th Jan 2011
Location: Behind You
Posted: 19th Mar 2011 05:32
I know it sounds a little crazy and I am still new to the forums...sort of. How about having the skysphere MOVE with the player. Not necessarily rotating with the players view, just positioning it at the players position. Whenever you get out of range to the point to where you can't make out any shapes, do what WLGfx say and delete the objects and/or reposition them somewhere in the surrounding area. How to go about that last part, I'm still thinking about it.
iSilver
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 19th Mar 2011 06:00
Ha, I just solved my own problem after a month of thinking about it over and over in the back of my mind!

For everyone who wants to know, it's really simple:

Just move your skybox to the location of the player/camera every update!

As to your problem, WLGfx, which I'll be trying to implement soon as well (already had a prototype, wasn't satisfactory):

The Sky Sphere is the absolute furthest backdrop. To give a sense of depth, you can create a bunch of random particles (say 100 pieces of space dust/star specks) within a spherical visual radius of the player. On every update, you just check every piece of dust and see if it's out of spherical range. If it is, you wrap it to the other side.

So say you want to see a visual range for the space dust to be 100 units away from the player. For each piece of dust, you check the distance to the player. If it's out of range, you check its angle to the player and move it 180 degrees away to the opposite side.

I'll be putting code up into this thread when I have it finished. I tried to prototype this once before but it didn't work out. I'll see what happens this time.

Thanks,

Flamesilver
iSilver
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 19th Mar 2011 06:02
Oh, and in regards to your "infinitely large" problem (continuous space that goes on forever), I believe the thing to look up is called "Spatial Indexing." It's pretty much exactly what you're talking about.
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 19th Mar 2011 13:25
As a tip, the sky sphere actually doesn't need to be big in size, it can be as small as the near camera range.
Just texture it with a low texture ID (ideally '1'), and set disable object zread on it (dbDisableObjectZRead).
It will be rendered behind all other objects in the scene

WLGfx
16
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 19th Mar 2011 18:05
Spatial Indexing can only go on for as far as say a double float can go. If the random seed value is set using the x,y,z coords of where you are in space then the scenery can be randomised from that. I suppose that could be very big (I was just imagining it then).

It's pretty much similar to the galaxies generated in Elite. I've a few ideas in mind to expand on it.

You would only really need to place the scenery as defined by the surround areas using the seed value (ie density of stars, galaxies and debris).

It would be interesting to see how you get on with this iSilver.

Warning! May contain Nuts!
McLaine
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location:
Posted: 20th Mar 2011 02:48
The sky sphere represents the visible universe of your player, therefore the skysphere moves with the player.

Look into Oct tree's for breaking your 'infinite' universe into smaller chunks.

It's not my fault!
WLGfx
16
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 20th Mar 2011 03:27
If the surrounding area is set up as a cubed surrounding (with the player in the middle), the surround areas within space would be better represented. I'm deffo not knocking the sphere mapping but as a last resort a cube map for the surround areas in space would show the clusters (sparse to dense) better as they can be generated more easily in real time even when crossing boundaries.

Warning! May contain Nuts!
McLaine
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location:
Posted: 20th Mar 2011 12:51 Edited at: 20th Mar 2011 12:52
Seems we're working on similar things.

The trick is to have a distance threshold for objects in relation to your player object.

when objects are inside that threshold, they are drawn on screen at 100% size. If they are outside that distance threshold then you lock them to that distance and instead scale them down to give the illusion they are still moving away.

This distance threshold can be set to the same as the radius of your skybox, meaning that objects effectively 'stick' to the skysphere as the player moves away from them.

It's not my fault!

Login to post a reply

Server time is: 2024-06-27 22:09:05
Your offset time is: 2024-06-27 22:09:05