Skybox upside down [2.1]
- spookyboo
- Silver Sponsor
- Posts: 1141
- Joined: Tue Jul 06, 2004 5:57 am
- x 151
- Contact:
Skybox upside down [2.1]
I've made a skybox from a cubemap and a cube.mesh. The problem is that the cubemap is projected nicely inside my cube.mesh, but it is upside down. I don't want to modify the Ogre code and I don't want to flip the texture file itself, so I ended up with editting my cube.mesh (or at least the xml). I tried flipping the normals and the vertices (multiply them with -1) ect. but the cubemap stays either upside down or is completely deformed. Any suggestions? (I also tried adding a new workspace, but it keeps crashing so this approach looked like a good alternative).
Gui generator tool https://github.com/spookyboo/Magus ==> Windows binaries https://github.com/spookyboo/Magus_bin
HLMS editor https://github.com/spookyboo/HLMSEditor ==> Windows setup https://github.com/spookyboo/HLMSEditor ... e?raw=true
HLMS editor https://github.com/spookyboo/HLMSEditor ==> Windows setup https://github.com/spookyboo/HLMSEditor ... e?raw=true
- dark_sylinc
- OGRE Team Member
- Posts: 5296
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1278
- Contact:
Re: Skybox upside down [2.1]
Picture?
Is this on both GL & D3D11? Are you using PBSM_REFLECTION? Did you render the cubemap yourself?
Is this on both GL & D3D11? Are you using PBSM_REFLECTION? Did you render the cubemap yourself?
- spookyboo
- Silver Sponsor
- Posts: 1141
- Joined: Tue Jul 06, 2004 5:57 am
- x 151
- Contact:
Re: Skybox upside down [2.1]
I am using a simple datablock with PBSM_REFLECTION applied to a cube.mesh (large scale; in the picture you are looking inside the cube). On the outside of the cube, the cubemap is upright (the same as the sphere).
This is with D3D11 and GL (I had to enable two sided lighting in case of GL. This was not needed for D3D11)
Gui generator tool https://github.com/spookyboo/Magus ==> Windows binaries https://github.com/spookyboo/Magus_bin
HLMS editor https://github.com/spookyboo/HLMSEditor ==> Windows setup https://github.com/spookyboo/HLMSEditor ... e?raw=true
HLMS editor https://github.com/spookyboo/HLMSEditor ==> Windows setup https://github.com/spookyboo/HLMSEditor ... e?raw=true
- dark_sylinc
- OGRE Team Member
- Posts: 5296
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1278
- Contact:
Re: Skybox upside down [2.1]
I cannot reproduce in the 2.1-pso branch (it will soon merge with 2.1). Haven't tested in 2.1.
However it's also that you're rendering the sky like we do in SkyPostprocess. We've discovered there was a bug there. To correct it you need to flip the Z coordinate before sampling the cubemap.
However it's also that you're rendering the sky like we do in SkyPostprocess. We've discovered there was a bug there. To correct it you need to flip the Z coordinate before sampling the cubemap.
- spookyboo
- Silver Sponsor
- Posts: 1141
- Joined: Tue Jul 06, 2004 5:57 am
- x 151
- Contact:
Re: Skybox upside down [2.1]
Ok. I'm reverting to the TutorialSky_PostprocessWorkspace approach again (so, without the cube.mesh). The skybox renders perfect in GL, but I get an exception with D3D11.
This exception occurs both with my own application but also with the TutorialSky_PostprocessWorkspace example (and only D3D11. TutorialSky_PostprocessWorkspace works fine with GL). Anyone else has the same experience? I will rebuild everything from scratch again, just in case
Code: Select all
D3D11 ERROR: ID3D11DeviceContext::Draw: The Shader Resource View dimension declared in the shader code (TEXTURECUBE) does not match the view type bound to slot 0 of the Pixel Shader unit (TEXTURE2D). This mismatch is invalid if the shader actually uses the view (e.g. it is not skipped due to shader code branching). [ EXECUTION ERROR #354: DEVICE_DRAW_VIEW_DIMENSION_MISMATCH]
Gui generator tool https://github.com/spookyboo/Magus ==> Windows binaries https://github.com/spookyboo/Magus_bin
HLMS editor https://github.com/spookyboo/HLMSEditor ==> Windows setup https://github.com/spookyboo/HLMSEditor ... e?raw=true
HLMS editor https://github.com/spookyboo/HLMSEditor ==> Windows setup https://github.com/spookyboo/HLMSEditor ... e?raw=true
- dark_sylinc
- OGRE Team Member
- Posts: 5296
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1278
- Contact:
Re: Skybox upside down [2.1]
Nope, it's working fine here (except D3D11 loads texture without gamma correction, which is a bug).
Maybe your repository has some changes or an extra file overriding a material or shader?
Maybe your repository has some changes or an extra file overriding a material or shader?
- SolarPortal
- OGRE Contributor
- Posts: 203
- Joined: Sat Jul 16, 2011 8:29 pm
- Location: UK
- x 51
- Contact:
Re: Skybox upside down [2.1]
the only thing i get with the Skybox Post FX Sample in D3D11 is a black sky and no texture shows on any 2-1 branch.
Only the OpenGL3+ works for me Hope this helps
Only the OpenGL3+ works for me Hope this helps
Lead developer of the Skyline Game Engine: https://aurasoft-skyline.co.uk
- dark_sylinc
- OGRE Team Member
- Posts: 5296
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1278
- Contact:
Re: Skybox upside down [2.1]
Let me guess... you both have NVIDIA cards? (The sample works fine on Intel and AMD cards.)
- spookyboo
- Silver Sponsor
- Posts: 1141
- Joined: Tue Jul 06, 2004 5:57 am
- x 151
- Contact:
Re: Skybox upside down [2.1]
Yes. I have NVidia.
Just updated to the latest branch and did a clean install. Sample_TutorialSky_Postprocess.exe crashed again with D3D11 (same exception).
Just updated to the latest branch and did a clean install. Sample_TutorialSky_Postprocess.exe crashed again with D3D11 (same exception).
Gui generator tool https://github.com/spookyboo/Magus ==> Windows binaries https://github.com/spookyboo/Magus_bin
HLMS editor https://github.com/spookyboo/HLMSEditor ==> Windows setup https://github.com/spookyboo/HLMSEditor ... e?raw=true
HLMS editor https://github.com/spookyboo/HLMSEditor ==> Windows setup https://github.com/spookyboo/HLMSEditor ... e?raw=true
- dark_sylinc
- OGRE Team Member
- Posts: 5296
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1278
- Contact:
Re: Skybox upside down [2.1]
Mmmm.... perhaps the cube texture is not correctly loaded as such; maybe even a branch based on some D3D11 report. More research would be needed.
Try checking what happens inside void D3D11Texture::_create2DResourceView(). It should follow a cubemap path.
Can you send a RenderDoc capture? (it shouldn't crash because RenderDoc will force-ignore the error)
Try checking what happens inside void D3D11Texture::_create2DResourceView(). It should follow a cubemap path.
Can you send a RenderDoc capture? (it shouldn't crash because RenderDoc will force-ignore the error)
-
- OGRE Expert User
- Posts: 1227
- Joined: Thu Dec 11, 2008 7:56 pm
- Location: Bristol, UK
- x 157
Re: Skybox upside down [2.1]
I have been away from a computer for a little while so can't check code but could this be anything to-do with a bug I found a while ago and completely forgot about?
http://ogre3d.org/forums/viewtopic.php? ... 4a#p524851
http://ogre3d.org/forums/viewtopic.php? ... 4a#p524851
- dark_sylinc
- OGRE Team Member
- Posts: 5296
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1278
- Contact:
Re: Skybox upside down [2.1]
That does sound like the problem. Does that fix it for you SolarPortal & spookeyboo?
- SolarPortal
- OGRE Contributor
- Posts: 203
- Joined: Sat Jul 16, 2011 8:29 pm
- Location: UK
- x 51
- Contact:
Re: Skybox upside down [2.1]
surprisingly, it has fixed the demo in ogre3d source for me now, but it didn't back then on those posts when i tried... but like i said then, i could have easily made a mistake especially if it was late night hehe
Perhaps its all the updates/changes to the ogre engine lol Thanks again... just have to get that sky working in our engine on DX11 now which sets cubic textures to the material manually from code to change skybox on the fly
Edit: The skybox is still black if i set the cubictexture to the material in c++ either as a cubemap texture or 6 individual textures and OpenGL does not chagne the textures now with this code . OpenGL did before because i used a blitting method which crashed in DX11 so had to change to this code:
Edit2: The code does appear to change if a single cubemap image is loaded for the sky in OpenGl contrary to what i said before, but not for individual frames.
Please Note: that some code is specific to our engine for grabbing resources through our own resource system. Saying this though, the textures are fully loaded and in ogre at time of setting material texture.
Also, the other error i get, is when changing some reflection textures in Datablocks. The sky post processor material also changes to the Datablock Reflection Cubemap image, which doesn't really help lol
Again, DX11 just stays black in the sky with this error also. Hope this helps
Perhaps its all the updates/changes to the ogre engine lol Thanks again... just have to get that sky working in our engine on DX11 now which sets cubic textures to the material manually from code to change skybox on the fly
Edit: The skybox is still black if i set the cubictexture to the material in c++ either as a cubemap texture or 6 individual textures and OpenGL does not chagne the textures now with this code . OpenGL did before because i used a blitting method which crashed in DX11 so had to change to this code:
Code: Select all
Ogre::RenderSystem *renderSystem = Ogre::Root::getSingletonPtr()->getRenderSystem();
//Ogre::String shaderSyntax = "GLSL";
//if (renderSystem->getName() == "Direct3D11 Rendering Subsystem") { return; }
Ogre::String skyMatFile = skyBoxMaterial;//+".material";
Ogre::CompositorNodeDef *nodeDef;
Ogre::CompositorManager2 *compositorManager = Ogre::Root::getSingleton().getCompositorManager2();
nodeDef = compositorManager->getNodeDefinitionNonConst("AurasoftUK_StartingNode");
if (!state){
// Disable Skybox -- todo <<<
return;
}
std::string filePath = skyResource.getV1MaterialResourceFilePath(skyMatFile);
if (filePath != ""){
QFileInfo fi(filePath.c_str());
std::string path = fi.absolutePath().toStdString();
std::string baseName = fi.baseName().toStdString();
SkyMaterial2::StoreData data = skyResource.getMaterialDataFromFile(filePath, baseName, "Scene", "");
if (data.convertRequired){
if (data.isUsed && data.isCubic){
Ogre::MaterialPtr baseSkyMat = Ogre::MaterialManager::getSingleton().getByName("SkyPostprocess");
if (baseSkyMat.isNull()) return;
if (data.isSeperate){
Ogre::String mReflectTexNames[6];
for (int i = 0; i < 6; i++){
skyResource.loadTextureResource(data.diffuseTetxureNames[i], false, "General");
mReflectTexNames[i] = data.diffuseTetxureNames[i];
}
baseSkyMat->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setCubicTextureName(mReflectTexNames);
}else{
skyResource.loadCubicTextureResource(data.diffuseTetxureName, "General");
baseSkyMat->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setCubicTextureName(data.diffuseTetxureName);
}
assert(nodeDef->getNumTargetPasses() >= 1);
Ogre::CompositorTargetDef *targetDef = nodeDef->getTargetPass(0);
const Ogre::CompositorPassDefVec &passDefs = targetDef->getCompositorPasses();
assert(passDefs.size() >= 1);
Ogre::CompositorPassDef *passDef = passDefs[1];
if (passDef->getType() != Ogre::PASS_QUAD && dynamic_cast<Ogre::CompositorPassQuadDef*>(passDef));
Ogre::CompositorPassQuadDef *quadDef = static_cast<Ogre::CompositorPassQuadDef*>(passDef);
quadDef->mMaterialName = "SkyPostprocess";
}
else{
lprint("Error: Only Cubmap or 6 frame textures can be used to create a material.");
}
}
else{
//2-1UPGRADEREQUIRED -- | How to apply Material files that are correct and "not" HLMS!
// Edit: It is the old way of material loading that is required, but how to tell if it is correct and intact.
return;
assert(nodeDef->getNumTargetPasses() >= 1);
Ogre::CompositorTargetDef *targetDef = nodeDef->getTargetPass(0);
const Ogre::CompositorPassDefVec &passDefs = targetDef->getCompositorPasses();
assert(passDefs.size() >= 1);
Ogre::CompositorPassDef *passDef = passDefs[1];
assert(passDef->getType() == Ogre::PASS_QUAD && dynamic_cast<Ogre::CompositorPassQuadDef*>(passDef));
Ogre::CompositorPassQuadDef *quadDef = static_cast<Ogre::CompositorPassQuadDef*>(passDef);
quadDef->mMaterialName = skyMatFile;
}
}
Please Note: that some code is specific to our engine for grabbing resources through our own resource system. Saying this though, the textures are fully loaded and in ogre at time of setting material texture.
Also, the other error i get, is when changing some reflection textures in Datablocks. The sky post processor material also changes to the Datablock Reflection Cubemap image, which doesn't really help lol
Again, DX11 just stays black in the sky with this error also. Hope this helps
Lead developer of the Skyline Game Engine: https://aurasoft-skyline.co.uk
- spookyboo
- Silver Sponsor
- Posts: 1141
- Joined: Tue Jul 06, 2004 5:57 am
- x 151
- Contact:
Re: Skybox upside down [2.1]
Changing the material into "texture SaintPetersBasilica.dds cubic gamma" did the trick. Sometimes things can be easily solved
Both GL and D3D11 work now.
Thanks
Both GL and D3D11 work now.
Thanks
Gui generator tool https://github.com/spookyboo/Magus ==> Windows binaries https://github.com/spookyboo/Magus_bin
HLMS editor https://github.com/spookyboo/HLMSEditor ==> Windows setup https://github.com/spookyboo/HLMSEditor ... e?raw=true
HLMS editor https://github.com/spookyboo/HLMSEditor ==> Windows setup https://github.com/spookyboo/HLMSEditor ... e?raw=true