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.

Newcomers DBPro Corner / A Starry Background

Author
Message
lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 31st Jan 2009 06:17
Hi i have been working on some space code lately and now im trying to add a starry background (infinate), i have tried using


But that code doesnt work, if there is an easier way to do this or more efficient please tell me.

All i want is static dots painted in the bacground with a depth to determine the brighness and a few random colored ones, i dont want it to be drawn every frame only when i say so....

Any help will be greatly appreciated..
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 31st Jan 2009 12:15
Just cut and pasted the above code into the IDE and press F5, ran and a good looking start field was on the screen.

using DBP 7.1.

Dark Physics makes any hot drink go cold.
lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 31st Jan 2009 12:37
sorry what i meant to say is that it isnt working the way i want, im using a 3d simulation and it doesnt really do anything in there.

I need a simple way of displaying a starry background without using a skybox or sjysphere as i have already tried those and the texture always had bad resolutions because it was being stretched not tiled...
lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 31st Jan 2009 14:28
i have managed to diplay a starry background with


Thanks anyway
Kira Vakaan
15
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 31st Jan 2009 23:18 Edited at: 31st Jan 2009 23:33
You intrigued me. And so, never having done something like this, I decided I had to come up with a solution.

Here:



This should create a starry background that doesn't rotate with the camera. Use the mouse to look around.

I had to get into some interesting math to calculate the star positions in the sky. I left comments in the code, but if you have questions, feel free to ask.

Edit: Oops, I hadn't taken into account camera movement, so when I decided to try moving the camera, I got stars flying a little crazily around the screen. I've fixed the code above now.
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 1st Feb 2009 15:59
Alternatively if you want to tile a texture on a sphere you can UV map each face of a geosphere seperately and overlap all of them in the texture, then whatever texture you use will be applied to every face.

lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 2nd Feb 2009 08:33
i have found an alternative thanls anyway.
Cloggy
20
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 2nd Feb 2009 13:09
You can use my D3DFunc dll. It has a 3d dot function. It also has a batch option to enable you to create a number of 3d dots that can be drawn very quickly.

Login to post a reply

Server time is: 2024-11-24 14:45:00
Your offset time is: 2024-11-24 14:45:00