Page 1 of 1

setPosition doesn't seem to work on skybox/skydome

Posted: Sun Jan 02, 2011 4:22 pm
by yaten
hi sirs,

Pardon my noobishness, but I have encountered another most likely trivial problem. I was experimenting a bit with skyboxes and skydomes and I encountered a little snag and I wanted to confirm if its just my noobishness that's getting me into trouble again.

Taking the example from 12.TerrainRendering, just below the lines:

Code: Select all

	scene::ISceneNode* skybox=smgr->addSkyBoxSceneNode(
		driver->getTexture("../../media/irrlicht2_up.jpg"),
		driver->getTexture("../../media/irrlicht2_dn.jpg"),
		driver->getTexture("../../media/irrlicht2_lf.jpg"),
		driver->getTexture("../../media/irrlicht2_rt.jpg"),
		driver->getTexture("../../media/irrlicht2_ft.jpg"),
		driver->getTexture("../../media/irrlicht2_bk.jpg"));
	scene::ISceneNode* skydome=smgr->addSkyDomeSceneNode(driver->getTexture("../../media/skydome.jpg"),16,8,0.95f,2.0f);

I just added this 2 lines to test the setPosition:

Code: Select all

skybox->setPosition(core::vector3df(0.f, -10000.f, 0.f));
skydome->setPosition(core::vector3df(0.f, -10000.f, 0.f));
it didn't show any warnings and errors so i'm expecting it to work, but it didn't. I already tried huge numbers (millions) but the position won't budge. Is the setPosition intended to work on skyboxes/skydomes? Again, please forgive my noobishness.

Posted: Sun Jan 02, 2011 4:27 pm
by Radikalizm
A skybox/skydome sets its position to the active camera position every frame, it doesn't have a fixed position since you shouldn't be able to reach the sides at any time

Out of interest, why would you want to set its position anyway?

Posted: Sun Jan 02, 2011 4:47 pm
by yaten
cool! it makes sense, unlike my old engine which i'm able to reach the sky border, and is awkward. thanks sir radz for the precious info ^_^

As for why I wanted to change the position, I have a sky which I wanted to drag down a bit so that my horizon is a bit lower. I guess I'd have to do that on the images, I was just wondering if I could do it on codes so that I could preserve the image. ^_^

Posted: Sun Jan 02, 2011 5:37 pm
by macron12388
I have a sky which I wanted to drag down a bit so that my horizon is a bit lower.
Moving the skyboxs' position manually seems a bit like a dirty fix. I think it would be best just to edit the skybox/skydome texture itself to get the desired effect. :)

Posted: Sun Jan 02, 2011 6:35 pm
by yaten
macron12388 wrote:
I have a sky which I wanted to drag down a bit so that my horizon is a bit lower.
Moving the skyboxs' position manually seems a bit like a dirty fix. I think it would be best just to edit the skybox/skydome texture itself to get the desired effect. :)
yup, and besides, I don't have a choice, since irrlicht is making me do things the right way ^_^ one more thing why I switched engine, with irrlicht, i'm learning to be a good programmer ^_^

Posted: Sun Jan 02, 2011 7:42 pm
by macron12388
Well, just remember there's more than one way to do something. ^.^

I've taken a look at CSkyBoxSceneNode && CSkyDomeSceneNode source code and it should be fairly easy to modify them to do things you want them to do.

Also, irrlicht isn't perfect and has bugs, so it won't always make you do things the right way, sometimes it'll do things that you don't want it to do. :wink:

Posted: Sun Jan 02, 2011 7:59 pm
by yaten
sir macron, thanks for the hint about CSkyBoxSceneNode, i'll keep that in mind ^_^

Posted: Sun Jan 02, 2011 11:45 pm
by hybrid
You can always use the texture matrix to reposition textures. However, this would probably corrupt the texture seam in the skybox. For the skydome you can alter the texture usage. Texture matrix would also work.

Posted: Mon Jan 03, 2011 7:21 am
by yaten
hybrid wrote:You can always use the texture matrix to reposition textures. However, this would probably corrupt the texture seam in the skybox. For the skydome you can alter the texture usage. Texture matrix would also work.
thanks sir hybrid, i think that's the best solution ^_^ it preserves the image and still have the flexibility of moving the texture as desired. thanks so much for the help ^_^