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.

DarkBASIC Professional Discussion / make a high-def starry background skysphere?

Author
Message
JoeOh
17
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 18th Jul 2010 16:25
I know how to make a large sphere of negative size that has a texture to be used as the distant backdrop image.

My problem is that I don't want to use a super-huge image file to provide enough detail so that the stars look like fine dots instead of blurry squares.

I tried using sphere mapping but that didn't help much. I seen other games pull off the high-def starry background, I'm just wondering how they did it and if it can be done in DBPro.

Home is where my souped-up computer is...
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 18th Jul 2010 16:45
Tiling the texture across the sphere sometimes gives good enough results, so something like this;

scale object texture 1,8,8

Boo!
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 18th Jul 2010 22:42
Or you could texture planes and position them randomly:


That's the code straight from "EnviroSCOPE" so it'll need tweeking but you should get the idea...

Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 19th Jul 2010 17:59
You will only see half the sphere at any given time, so that's half your texture down. You can texture each face of the sphere with different UV coordinates, so use that to your advantage-- make some areas with a large section of the texture filling that area and others with a smaller section of the texture. This will give the "cluster" effect. You may want to make a texture that has a variation of clusters and sparce space....

The fastest code is the code never written.
JoeOh
17
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 19th Jul 2010 21:28 Edited at: 19th Jul 2010 21:29
I came up with a solution decent solution. I made to negative sized sphere's. The large sphere has a 250x250 star image scale copied using the "scale object texture" function. The smaller negative sphere is textured with a 1200x600 mask alpha transparency image that is only letting through some of the star tile texture.

Both sky-spheres are moving along with the camera that you can move with the arrow-keys to give that infinite distance feel of the galaxy strip.

I also made a random star field to fly through with various colored randomly sized stars. Each star is a 3D sphere with a cube that has a glare texture. The cubes are constantly pointing in the camera's position to give that consistency off effect.

Enjoy!

[Post Edit: Change the resolution to your screen size before running. Just as the post was uploading the file I realized this.]

Home is where my souped-up computer is...
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 20th Jul 2010 03:57
You don't need a cube for the glare. Use a billboard.

The fastest code is the code never written.
WickedVixen
19
Years of Service
User Offline
Joined: 28th Mar 2007
Location: New Brisbane, Utopia Prime, VGC GHQ
Posted: 3rd Nov 2010 21:10
I just checked this out.
Very impressive.

Now if I could just get a couple of things working for my game ... I think I could be in [i]heaven[/]... LOL

Thanks for the idea JoeOh. Now to implement this idea I have... ^_^

dark coder
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 4th Nov 2010 04:23
Use planes like baxslash does in his snippet. Though you should also merge the objects down because it's not like they will need to move, and one object renders far faster than more than one, if your star texture contains many types of star then you could also adjust the UV data so they still look different when merged.

A more advanced technique is to use a point sprite shader to handle the stars, that way you only need one vertex per star, and they will always face the camera and can easily be made to move around without complex maths.

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 4th Nov 2010 10:43
Quote: "A more advanced technique is to use a point sprite shader to handle the stars, that way you only need one vertex per star, and they will always face the camera and can easily be made to move around without complex maths."

That sounds nice. I haven't heard of that technique, I don't suppose you have an example of a shader that does this?

dark coder
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 5th Nov 2010 08:45
Quote: "That sounds nice. I haven't heard of that technique, I don't suppose you have an example of a shader that does this?"


Yep, I made THIS ages ago. However I'm pretty sure the scaling code there used in the shader has some issues with certain ATI cards, in one of my projects I calculated the size in the application.

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 5th Nov 2010 10:55
Thanks DC I'll take a look when I get time!

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 5th Nov 2010 14:29
I believe Ermes could give you some good advice on this subject. Check out his WIP thread about his space sim.

TheComet

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 5th Nov 2010 14:45
That demo was really great, I think I might use this on my game Iridium which I'm close to resurrecting

Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 5th Nov 2010 16:11
If you go the texture way, which is handy in many circumstances, remember to turn off the texture filtering to keep the original pixel quality (1 pixel = 1 star).

Also remember that the "large sphere of negative size that has a texture to be used as the distant backdrop image" can be as tiny as the near camera range, by setting disable object zread on the sphere. That will make any other object, with a higher texture Id, to appear 'in front' of the skydome sphere (so I recommend to give the sphere the texture Id=1).
Having such a tiny sphere also allows/helps to keep low the texture size, hmmm doesn't it?

Visigoth
21
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Bakersfield, California
Posted: 6th Nov 2010 18:21
@dark coder
some of the scaling issues with ATI cards and point sprites is that on older ATI cards point sprites are limited in size to 256x256 pixels. NVIDEA does not have this limitation, and newer ATI cards are fixed as well. Just something to consider when using that technique.

p.s.
congrats on the netbook game win

Login to post a reply

Server time is: 2026-07-26 05:03:43
Your offset time is: 2026-07-26 05:03:43