Space Environment

Started by
28 comments, last by jason83 19 years, 8 months ago
Hey there, I am using the DirectX 9 API in C++. I am working in a team to create a space based massively multiplayer online roll playing game. The problem i have is that i wish to create a space environment with stars etc. I was advised that a way to do this is by using a sphere, and map a texture on the sphere. My first question is if i texture the sphere, will the textures be visable from inside the sphere (which is where all the objects of the game will be located). The sphere will be huge. If this is a good way to do it, could someone explain how it can be achieved, as i have got some 3d models, and when the camera is placed inside, the model textures cannot be seen. If there is another way to do this, please explain this also. I am a relatively new directx developer, and this is my first project. Thank you for reading my post ;)
Advertisement
Hi there FMD, welcome to GameDev. There's a special place in my heart for space games (check my sig for my game [smile]). The way we render outer space in my game is inside a cube. Take a cube and flip the normals so the polygons are actually facing in. Then place the camera in the center of cube, and texture the inside with six nice space backdrop textures. Then you have to make sure the camera never leaves the exact center of the cube so you can maintain the illusion that you're surrounded by space. If you do a search on here for "skyboxes", you'll find all kinds of info. I think the DirectX SDK even has a demo application explaining skyboxes. Check out the video of my game to see how this works.

Much luck to you on your project! Have a great day,

Ryan Buhr

Technical Lead | Sector 13

Reactor Interactive, LLC

Facebook | Twitter

Thanks very much. Im too lazy to create a cube and flip it, so ill ask my 3d Artist to instead lol. :)

Thanks again
Hmm, ive got a problem with lighting, before i flip the cube, i can see the textures, after tho, i cant. It seems to be a lighting problem. Would you be able to post some source code to help me as this is being un-cooperative. :( Oh and i did move the camera before anyone asks :P

Thanks :)
I use the same technique as HanSoL0 so I might be able to help. There are a few things I can think of that might be your problem.

By "flipping textures" do you mean "flipping normals" because flipping normals is what you need to do. Try turning off backface culling to see if this is your problem.

You should turn off lighting when rendering your star skybox.

I might not be understanding what the problem is so you might want to post a screen shot.

Check the bottom of the Screenshots section for some examples
Quote:Original post by Nuget5555
Try turning off backface culling to see if this is your problem.

My money is on that one. I remember having that problem way back when I implimented my skybox, and all I had to do was either turn off backface culling, or reverse the order.

Ryan Buhr

Technical Lead | Sector 13

Reactor Interactive, LLC

Facebook | Twitter

Nope, still cant see it.

Could someone post an example here, so i can look at it since i cant seem to implement it correctly :S
Posting an example from my code probably wouldn't help you because the interfaces/data structions/general flow might be completely different.

However if you post what you are having problems with (setting states, textures, and rendering the skybox) it would be much easier to find problem and help you fix it.
Ok,

Could you post the command you use to flip the normals if any?

Thanks
Im partial to sprites myself, simulating a skybox with a repeating sprite is

a) faster on the FFP
b) uses TnL vertices by default
c) gives u better simulation of a background (9 faces vs. 6)
d) requires no normal/culling state change costs

Of course you can argue that all these are pretty insignificant on faster cards, and you'd be right...

as for your problem have you tried disabling lighting and setting the ambient light color to bright white? Also make sure your box is big enough and not z-fighting with some other mesh..

EDIT: to flip the normals on a mesh change the D3DRS_CULLMODE renderstate to CCW or CW (one is flipped, one is unflipped, depending on your face data..)
________________
"I'm starting to think that maybe it's wrong to put someone who thinks they're a Vietnamese prostitute on a bull"       -- Stan from South Park
Lab74 Entertainment | Project Razor Online: the Future of Racing (flashsite preview)

This topic is closed to new replies.

Advertisement