[2.2] Setting up skybox

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
DOS
Gnoblar
Posts: 19
Joined: Tue Oct 27, 2020 5:34 pm

[2.2] Setting up skybox

Post by DOS »

Hello,

we are migrating from Ogre 2.1 to 2.2, but I am triggering an assert in Image2::loadDynamicImage when trying to set up the skybox.

Code: Select all

assert( (textureType != TextureTypes::TypeCube || depthOrSlices == 6u) && "depthOrSlices must be 6!" );

The skybox is set up just like in the tutorial (Sample_TutorialSky_Postprocess), I am creating a render window with createRenderWindow and adding the workspace with addWorkspace, passing in the texture of the render window just like in the sample. The post-process material and compositor settings are also like in the sample as far as I can tell. "depthOrSlices" is 1 by the way, but I don't know where I would change that since in the sample there also does not seem to be any special setup regarding the texture.

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.2] Setting up skybox

Post by dark_sylinc »

Hi!

Can you post the code that is triggering it and a bit more context?

Because as the assert shows, if the type TextureTypes::TypeCube, then depthOrSlices must be 6. It can't be 1.

Figuring out what you're doing will help establishing what's wrong.

zxz
Gremlin
Posts: 184
Joined: Sat Apr 16, 2016 9:25 pm
x 19

Re: [2.2] Setting up skybox

Post by zxz »

This looks similar to what I ran into here: viewtopic.php?p=547682#p547682

For me it was triggered by the fallback code that tries to load a dummy texture when the loading of the actual texture fails with an exception (for whatever reason). I think that the fallback case fails to take cubemaps into consideration, and calls loadDynamicImage with a set of arguments that always fail for cubemaps.

See: https://github.com/OGRECave/ogre-next/b ... .cpp#L1777

That line forces depthOrSlices == 1, and if texture->getTextureType() == Cubemap, the assert is triggered.

I think that the problem was "solved" for me by adding support for the format I needed, thus avoiding the exception altogether.

Hilarius86
Halfling
Posts: 48
Joined: Thu Feb 14, 2019 11:27 am
x 8

Re: [2.2] Setting up skybox

Post by Hilarius86 »

Thanks for the feedback. This was indeed triggered by a "faulty" dds file. In earlier versions it was handled fine, but now it failed. I changed the dds from XBGR to ABGR and I was able to continue.

Post Reply