star field, and some ideas to implement
4 posters
star field, and some ideas to implement
Newbers here....
Id like to model a star field that I can then place a simple model on and move about the starfield. Should I go the route of a sky box? If so will it will be possible to reach the end of the sky box, what then are my options. Mainly I want to be able to fly away from static objects for a very long time with a star field in the background, and then be able to turn back and reach those same points. A 2d camera point of view/or orthagonal(diablo style) will be fine. Any conceptual answers and also methods of creating this with the blender/sio2 workflow will be much appreciated! Will be using a waypoint method to move my flying object ( click on screen, object and camera move till object is at waypoint, object then sits)
Id like to model a star field that I can then place a simple model on and move about the starfield. Should I go the route of a sky box? If so will it will be possible to reach the end of the sky box, what then are my options. Mainly I want to be able to fly away from static objects for a very long time with a star field in the background, and then be able to turn back and reach those same points. A 2d camera point of view/or orthagonal(diablo style) will be fine. Any conceptual answers and also methods of creating this with the blender/sio2 workflow will be much appreciated! Will be using a waypoint method to move my flying object ( click on screen, object and camera move till object is at waypoint, object then sits)
Blamm!- Posts : 23
Join date : 2008-11-18
Re: star field, and some ideas to implement
To create the illusion that the stars are far far away, simply disable the depth buffer when you render your stars (skybox or 2D background). To do in 3D simply call:
glDisable( GL_DEPTH_TEST );
glDepthMask( GL_FALSE );
...
...
render the sky
...
...
glEnable( GL_DEPTH_TEST );
glDepthMask( GL_TRUE );
...
...
render the rest of your scene
...
...
glDisable( GL_DEPTH_TEST );
glDepthMask( GL_FALSE );
...
...
render the sky
...
...
glEnable( GL_DEPTH_TEST );
glDepthMask( GL_TRUE );
...
...
render the rest of your scene
...
...
Re: star field, and some ideas to implement
I asked the same question some time ago while I was wondering whether SIO2 offers something like that. Here's the idea a little bit more detailled:
1. Get the SIO2object* which represents your skybox from the resources.
2. In your render-loop, right after you've applied the camera (sio2CameraRender, sio2CameraUpdateFrustum) and culled the scene (sio2ResourceCull), disable Z-buffer writing and testing as sio2interactive suggested.
3. Render the sky. One particular thing to remember is to set the "dst" attribute of the object in question to a value above 0, otherwise it won't become rendered (this value is filled by the culling implementation, 0 means that the object is currently out of sight). This fact of course becomes handy when rendering the rest of the world below, so we're setting it to 0.0f right after we rendered it.
4. Reenable Z-buffer writing and testing.
5. Render the rest of your scene.
Best,
Matt
1. Get the SIO2object* which represents your skybox from the resources.
- Code:
SIO2object* skybox = (SIO2object*) sio2ResourceGet( sio2->_SIO2resource, SIO2_OBJECT, "object/skybox" );
2. In your render-loop, right after you've applied the camera (sio2CameraRender, sio2CameraUpdateFrustum) and culled the scene (sio2ResourceCull), disable Z-buffer writing and testing as sio2interactive suggested.
- Code:
glDisable( GL_DEPTH_TEST );
glDepthMask( GL_FALSE );
3. Render the sky. One particular thing to remember is to set the "dst" attribute of the object in question to a value above 0, otherwise it won't become rendered (this value is filled by the culling implementation, 0 means that the object is currently out of sight). This fact of course becomes handy when rendering the rest of the world below, so we're setting it to 0.0f right after we rendered it.
- Code:
skybox->dst = 1.0f;
sio2ObjectRender( skybox, sio2->_SIO2camera, 1 );
skybox->dst = 0.0f;
4. Reenable Z-buffer writing and testing.
- Code:
glEnable( GL_DEPTH_TEST );
glDepthMask( GL_TRUE );
5. Render the rest of your scene.
- Code:
sio2ResourceRender( sio2->_SIO2resource, sio2->_SIO2window, sio2->_SIO2camera, SIO2_RENDER_SOLID_OBJECT | SIO2_RENDER_EMITTER );
Best,
Matt
thanks!
thanks, Ill look into this, right now however i am struggling with my crashing blender and my macbook which i dumbly upgraded to 10.5.5
Blamm!- Posts : 23
Join date : 2008-11-18
Re: star field, and some ideas to implement
Hey,
Would anyone care to share code to display a 2D background image?
Thanks in advance,
-joshua
Would anyone care to share code to display a 2D background image?
Thanks in advance,
-joshua
meteors- Posts : 241
Join date : 2008-11-08
Location : Sunny Florida
Re: star field, and some ideas to implement
yes that would be helpful if anyone has code that I could look over.
Blamm!- Posts : 23
Join date : 2008-11-18
Permissions in this forum:
You cannot reply to topics in this forum