Page 1 of 1

The skybox is backwards?

Posted: Mon Sep 17, 2007 7:45 pm
by ispeedonthe405
I used 'search' first so don't yell at me.

Screenshot says it all:

http://www.ispeedonthe405.com/pics/screenshot.jpg

I've tried this with multiple formats, and in the samples as well as my own project, with the same results. The texture is about as simple as you can get:

http://www.ispeedonthe405.com/pics/def_skybox.png

I'm not doing anything tricky with the code, either:

Code: Select all

// default skybox
video::ITexture* pTex = m_VideoDriver->getTexture( "Textures\\def_skybox.png" );
m_SceneManager->addSkyBoxSceneNode( pTex, pTex, pTex, pTex, pTex, pTex ); 

What's the deal?

Posted: Mon Sep 17, 2007 10:05 pm
by mybrainisfull
http://irrlicht.sourceforge.net/phpBB2/ ... rt+texture

This is a discussion about something else but people have posted the solution to your problem

Posted: Mon Sep 17, 2007 10:47 pm
by ispeedonthe405
No, that doesn't actually solve the problem.

I'll just mirror the skybox textures before I export them. Works fine.

Posted: Mon Sep 17, 2007 10:50 pm
by CuteAlien
There's an older patch for that here: http://irrlicht.sourceforge.net/phpBB2/ ... torder=asc

I think I used that patch and it worked (I'm not 100% sure if it was from this thread, as I did patch that more than a year ago and had completely forgotten about it).

Posted: Tue Sep 18, 2007 12:51 pm
by ispeedonthe405
Maybe that did work under an earlier version but in the current build you end up with only one poly on each face. Or at least, I do.

The following however does work; each face is textured as you'd expect looking towards each direction:

http://www.ispeedonthe405.com/pics/forward.jpg
http://www.ispeedonthe405.com/pics/back.jpg
http://www.ispeedonthe405.com/pics/left.jpg
http://www.ispeedonthe405.com/pics/right.jpg
http://www.ispeedonthe405.com/pics/up.jpg
http://www.ispeedonthe405.com/pics/down.jpg

Code: Select all

// create front side

Material[2] = mat;
Material[2].Textures[0] = front;
Vertices[8]  = video::S3DVertex( l,-l, l, 0,0,1, video::SColor(255,255,255,255), t, t);
Vertices[9]  = video::S3DVertex(-l,-l, l, 0,0,1, video::SColor(255,255,255,255), o, t);
Vertices[10] = video::S3DVertex(-l, l, l, 0,0,1, video::SColor(255,255,255,255), o, o);
Vertices[11] = video::S3DVertex( l, l, l, 0,0,1, video::SColor(255,255,255,255), t, o);

// create left side

Material[3] = mat;
Material[3].Textures[0] = left;
Vertices[12] = video::S3DVertex(-l,-l, l, -1,0,0, video::SColor(255,255,255,255), t, t);
Vertices[13] = video::S3DVertex(-l,-l,-l, -1,0,0, video::SColor(255,255,255,255), o, t);
Vertices[14] = video::S3DVertex(-l, l,-l, -1,0,0, video::SColor(255,255,255,255), o, o);
Vertices[15] = video::S3DVertex(-l, l, l, -1,0,0, video::SColor(255,255,255,255), t, o);

// create back side

Material[0] = mat;
Material[0].Textures[0] = back;
Vertices[0] = video::S3DVertex(-l,-l,-l, 0,0,-1, video::SColor(255,255,255,255), t, t);
Vertices[1] = video::S3DVertex( l,-l,-l, 0,0,-1, video::SColor(255,255,255,255), o, t);
Vertices[2] = video::S3DVertex( l, l,-l, 0,0,-1, video::SColor(255,255,255,255), o, o);
Vertices[3] = video::S3DVertex(-l, l,-l, 0,0,-1, video::SColor(255,255,255,255), t, o);

// create right side

Material[1] = mat;
Material[1].Textures[0] = right;
Vertices[4] = video::S3DVertex( l,-l,-l, 1,0,0, video::SColor(255,255,255,255), t, t);
Vertices[5] = video::S3DVertex( l,-l, l, 1,0,0, video::SColor(255,255,255,255), o, t);
Vertices[6] = video::S3DVertex( l, l, l, 1,0,0, video::SColor(255,255,255,255), o, o);
Vertices[7] = video::S3DVertex( l, l,-l, 1,0,0, video::SColor(255,255,255,255), t, o);

// create top side

Material[4] = mat;
Material[4].Textures[0] = top;
Vertices[16] = video::S3DVertex( l, l, l, 0,1,0, video::SColor(255,255,255,255), t, t);
Vertices[17] = video::S3DVertex(-l, l, l, 0,1,0, video::SColor(255,255,255,255), o, t);
Vertices[18] = video::S3DVertex(-l, l,-l, 0,1,0, video::SColor(255,255,255,255), o, o);
Vertices[19] = video::S3DVertex( l, l,-l, 0,1,0, video::SColor(255,255,255,255), t, o);

// create bottom side

Material[5] = mat;
Material[5].Textures[0] = bottom;
Vertices[20] = video::S3DVertex(-l,-l, l, 0,-1,0, video::SColor(255,255,255,255), o, o);
Vertices[21] = video::S3DVertex( l,-l, l, 0,-1,0, video::SColor(255,255,255,255), t, o);
Vertices[22] = video::S3DVertex( l,-l,-l, 0,-1,0, video::SColor(255,255,255,255), t, t);
Vertices[23] = video::S3DVertex(-l,-l,-l, 0,-1,0, video::SColor(255,255,255,255), o, t);

Posted: Fri Sep 28, 2007 11:22 pm
by hybrid
I have fixed the skybox. You need to update existing skyboxes, though. Exchange right and left texture, rotate up-texture 270 degrees clockwise, and rotate down-texture 90 degrees clockwise.
I have checked the new orientation with TerraGen skyboxes which work out of the box.