Sign in to follow this  

HLSL and Stars

This topic is 2963 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there, for my game i'm using Direct3D9 and HLSL. I've been looking at several ways to render stars (my game is based in space). I've looked at skyboxes and skydomes but one dominant flaw is the fact that they will never be truely 3d, so from any angle other than directly facing stars will look distorted due to projection. I had an idea that i could use a skybox, but instead of texturing it normally i could use HLSL to render in real time stars and make them appear more realistic. To explain it further, i'm not sure exactly how i will achieve this but could anyone shed any light on this? I don't really mind about close stars and simulating it truely 3d. I just want to be able to look at the stars at any angle and not be able to tell that i'm actually looking at a sphere or skybox. I was thinking that obviously one of the key factors is camera projection. To demonstrate it further here is some images demonstrating what i'm talking about: This shows what it will actually appear like ingame because of projection. And this is the effect i desire, that no matter where you look, the stars appear to be facing you relative, because light sources aren't solid and shouldn't be projected flat. Any help you could provide me with is greatly appreciated, Thanks, Dan

Share this post


Link to post
Share on other sites
With a properly rendered skybox you will never see the stars from more than one angle, even when rotating the camera. I think a high-resolution skybox will give very good results. I've seen it used in many games with realistic space scenes.
I found the following thread right here at GameDev.net with Google: http://www.gamedev.net/community/forums/topic.asp?topic_id=463506.

Share this post


Link to post
Share on other sites
Thanks for the input, well my main problem is, i'm using an engine which doesn't directly support traditional skyboxes, and natively supports physical skydomes which you place above the level. Which is probably the main reason why i'm facing this problem.

I've updated the thread with examples of my problem.

Thanks,
Dan

Share this post


Link to post
Share on other sites
The engine should have some kind of documentation about how you're supposed to make skies..

In any case, any engine can easily use sky-boxes. All you need to do is draw a cube viewed from the inside without depth-testing, centered on the origin, the first thing every frame, instead of clearing the back-buffer color. Set up your matrices with only the camera rotation and no translation, and that's it.

Share this post


Link to post
Share on other sites
Quote:
Original post by Erik Rufelt
All you need to do is draw a cube viewed from the inside without depth-testing, centered on the origin, the first thing every frame, instead of clearing the back-buffer color.


Bad bad bad bad baaaad idea. DO NOT DO THIS. Every presentation or summit I've ever run across on the subject of performance explicitly states you should Clear() at the beginning of a frame. This breaks more internal optimizations than you can shake a stick at. Also, you can avoid redundant ROP and texture traffic by doing the skybox *last* and taking advantage of depth culling.

Share this post


Link to post
Share on other sites
Good advise. =) I was mostly trying to explain the process as easily as possible, getting the skybox as the background. I don't think it's that essential to clear color buffers though.. for example http://developer.download.nvidia.com/presentations/2008/GDC/GDC08-D3DDay-Performance.pdf even says that on Radeon cards you should not clear render targets unnecessarily.

Share this post


Link to post
Share on other sites

This topic is 2963 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this