skydome scenenode

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

skydome scenenode

Post by Midnight »

can anyone tell me how to correct implement the skydome from 1.1?

I'm not sure what values it's asking me for.

and there is nothing in the api or tutorials.
trivtn
Posts: 132
Joined: Tue Jan 17, 2006 12:30 pm
Location: Viet Nam
Contact:

Post by trivtn »

Skydome sceneNode is similar the SkyBox but You just manage 1 texture instead of 6 texures as skyBox.
Use it very simple
1) Get the texure in the net here :http://vterrain.org/Atmosphere/Domes/philo_sky1_2k.jpg
2) Then use the code:
smgr->addSkyDomeSceneNode(driver->getTexture("Your skydome texure path",16,16,1.0f,1.0f);//because the texure is half of Sky and so the SkyDome I make is a half sphere. Good luck!
There's something is fantastic, there's nothing is absolute.
alc
Posts: 31
Joined: Sun Jun 25, 2006 10:59 pm
Location: Denmark

Post by alc »

Since I'm the original author of the sky dome function, allow me to elaborate the previous answer:

The four values 16, 16, 1.0f and 1.0f means

1) The entire sky dome (which is a sphere made of of rectangles) is made from 16 rows of rectangles from top to bottom. The rows 8 and 9 are closest to the equator of the sphere, and thus contains the largest of the rectangles consistuting the sphere.

2) Each row consists of 16 rectangles.

Imagine a disco ball (you know, the ones covered with flat rectangular mirrors) seen from inside. Same thing :D

Here's an example of a sphere consisting of 12 rows with each 20 rectangles. The top is missing here, but in skydome the top it is actually made of of triangles to avoid a hole at the very top of the sky ...

Image

(Actually, the two arguments are reverse compared to my explanation here, but I found it a bit easier this way).

If you want a more smooth sphere increase these numbers. However, you will most likely be satisfied with these.

3) This number (here 1.0f) is how much of the sphere is covered with the texture. This number ranges from 0 to 2. When you choose 1.0, exactly the upper half of the sphere is covered. If you choose, say, 1.2 the texture will go a little below the equator of the sphere. If you choose 2 the texture will cover the entire sphere from top to bottom. Ideally, this should be 1, but sometimes you'd like the horizon to be shown even when you are elevated over the ground plane, and then it is useful to set this number slightly higher. Experiment, and you'll see the difference.

4) This number (here also 1.0f) is how large percentage of the texture is actually used. Sometimes sky textures include some text or other graphics at the bottom, and this number here allows you to skip this without changing the graphics file. Setting this number to, say, 0.9 make the skydome use the upper 90% of the texture, thus skipping the lowermost 10%. Note that this number is independent of the third argument, so you can change this without changing how much of the sphere is covered with texture.

I hope this helps understand the four arguments.
andrei25ni
Posts: 326
Joined: Wed Dec 14, 2005 10:08 pm

Post by andrei25ni »

trivtn,
you forgot a ")" in your code.

Code: Select all

smgr->addSkyDomeSceneNode(driver->getTexture("Your skydome texure path"),16,16,1.0f,1.0f);

alc,

nice skydome implementation.
andrei25ni
Posts: 326
Joined: Wed Dec 14, 2005 10:08 pm

Post by andrei25ni »

I'll hijack this thread to ask if it's possible to delete the SkyDomeSceneNode.

I have the following code :

Code: Select all

	case KEY_RETURN: //change sky
				{
                   
                       if (show_sky== 0)
                       {
                                     show_sky= 1;
//delete previous sky here , but how ?? 

// add  new sky                                smgr->addSkyDomeSceneNode(driver->getTexture("data/sky/day/sphere.jpg"),16,16,1.0f,1.0f);

                       } else {
                                     show_sky= 0;
//delete previous sky here , but how ??  

// add new sky                                     smgr->addSkyDomeSceneNode(driver->getTexture("data/sky/day/sphere2.jpg"),16,16,1.0f,1.0f);

                              }
}
Any suggestion? The problem is that when I press Enter, a new sky is added above the previous sky, and this lowers the FPS very much!
I want the previous sky to be deleted and then replaced with a new one.
:roll:
alc
Posts: 31
Joined: Sun Jun 25, 2006 10:59 pm
Location: Denmark

Post by alc »

Well, if you have only two domes, maybe you just want to hide it (and thus it is not rendered). Otherwise, I believe, you have use the ->remove() function.

In any case, you need to assign the pointer returned by smgr->addSky ... to a variable, say 'sky', like

Code: Select all

ISceneNode *sky =  smgr->addSkyDome ...
and then use either

Code: Select all

sky->remove();
or

Code: Select all

sky->setVisible(false);
andrei25ni
Posts: 326
Joined: Wed Dec 14, 2005 10:08 pm

Post by andrei25ni »

Ok, thank you. It was so simple. How come I didn't figured that out ?
I think I'll use "setVisible(false);" .

Cheers.
:wink:
humbrol
Posts: 83
Joined: Sun Nov 18, 2007 8:22 pm

Post by humbrol »

Is there a program to create skydome files or a good tutorial most im finding are for skyboxes
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

This method works in the real world, should also work in a 3D modeling package, but probably isn't the best way because some information is lost during conversion.

- Get a mirrored ball, place it on the ground.
- Take a picture from above
- Open the picture in Gimp, center the image and use the "filters->distorts->polar coordinates" tool to convert from polar coordinates.
- Tidy the image and save

You should end up with something like this
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
humbrol
Posts: 83
Joined: Sun Nov 18, 2007 8:22 pm

Post by humbrol »

<saves those tips> the problem is that im trying to recreate a space skydome with the entire sphere being space. found a good starmap that molded around to the sphere nicely at the sites listed above, now to just paint it in, once its done ill post a copy here for anyone else looking for space skydomes
Post Reply