DDS environment map issue

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
alphageek
Gnome
Posts: 365
Joined: Mon Jan 03, 2005 11:56 am

DDS environment map issue

Post by alphageek »

I am having some trouble using dds images for environment mapping. I use a set of 6 dds images for a skybox like so:

Code: Select all

{
	technique
	{
		pass
		{
			lighting off
			depth_write off

			texture_unit
			{
                filtering none
				cubic_texture bw.dds separateUV
				tex_address_mode clamp
			}
		}
	}
}
This works fine. However, in trying to use this same set for environment mapping I get an error. The relevant .material:

Code: Select all

{
    technique
    {
        pass
        {
            ambient 1 1 1

            diffuse 0.5 0.5 0.5
            #specular 1.0 1.0 1.0 15

            texture_unit
            {
                cubic_texture bw.dds combinedUVW
                colour_op add
                env_map cubic_reflection
            }
        }
    }
}
The error:

Code: Select all

Function: ResourceGroupManager::openResource
Description: Cannot locate resource bw.dds in resource group Common.. 
This makes no sense to me.

Edit:
I should say, I have no trouble at all when using .png images instead.
Axiomatic: action-packed space shooter
TaskScheduler 0.3
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

Resource group Common? We don't call any of our resource groups Common and I can find no reference to this string in the OGRE source (for a minute I thought we might have left one in by mistake). Where is that coming from?
User avatar
alphageek
Gnome
Posts: 365
Joined: Mon Jan 03, 2005 11:56 am

Post by alphageek »

Whoops. That is my resource group which is "Common" to a number of scenarios that I load.

Both materials (skybox and environment map) are part of that group, and the DDS (and PNG) files are located in the search path for the group.

During loading of the group I get to see

Code: Select all

12:44:30: D3D9 : Loading 2D Texture, image name : 'bw_fr.dds' with 2147483647 mip map levels
12:44:30: D3D9 : Loading 2D Texture, image name : 'bw_bk.dds' with 2147483647 mip map levels
12:44:31: D3D9 : Loading 2D Texture, image name : 'bw_lf.dds' with 2147483647 mip map levels
12:44:31: D3D9 : Loading 2D Texture, image name : 'bw_rt.dds' with 2147483647 mip map levels
12:44:31: D3D9 : Loading 2D Texture, image name : 'bw_up.dds' with 2147483647 mip map levels
12:44:31: D3D9 : Loading 2D Texture, image name : 'bw_dn.dds' with 2147483647 mip map levels
12:44:31: An exception has been thrown!

-----------------------------------
Details:
-----------------------------------
Error #: 8
Function: ResourceGroupManager::openResource
Description: Cannot locate resource bw.dds in resource group Common.. 
File: c:\documents and settings\pbridger\my documents\development\ogrenew\ogremain\src\ogreresourcegroupmanager.cpp
Line: 491
Stack unwinding: <<beginning of stack>>
12:44:31: Error loading texture bw.dds. Texture layer will be blank. Loading the texture failed with the following exception: An exception has been thrown!

...


12:44:31: Finished loading resource group Common

-----------------------------------
And then when I am creating an entity that wants the environment map material, I get the error.

Code: Select all

12:44:33: An exception has been thrown!

-----------------------------------
Details:
-----------------------------------
Error #: 8
Function: ResourceGroupManager::openResource
Description: Cannot locate resource bw.dds in resource group Common.. 
File: c:\documents and settings\pbridger\my documents\development\ogrenew\ogremain\src\ogreresourcegroupmanager.cpp
Line: 491
Stack unwinding: <<beginning of stack>>
:(
Axiomatic: action-packed space shooter
TaskScheduler 0.3
User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post by :wumpus: »

The problem currently is, that if you use .dds and TEXTYPE_CUBEMAP, it is assumed all the textures are in one file. This is due to the following problem:

1 - When loading a cubemap from one image file, a texture is created with the name envmap.<ext>, and Texture::load() is called.

2 - When loading a cubemap from multiple image files, a texture is created with the name envmap.<ext>. and Texture::load() is called.

These cases cannot be distinguished in Texture::load(), so currently if you use .dds it is assumed you use approach 1. For all other extensions case 2 is assumed.

This extension-based hack should be removed eventually and the interface changed a bit, but an intermediate way of solving it would be to either use another format for your skybox, or create a single dds file with the entire cubemap. (but you'd still need the seperate ones for the skybox :( )
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

I think it's pretty typical to use separate textures for skybox and cubemaps in any case, since the cubemap can be a lot lower resolution than the skybox has to be.
User avatar
alphageek
Gnome
Posts: 365
Joined: Mon Jan 03, 2005 11:56 am

Post by alphageek »

Thanks guys. I will do the low-res cubemap thing.
Axiomatic: action-packed space shooter
TaskScheduler 0.3
Post Reply