Colurmap image file must have mipmaps to produce colourmap.

Description

Original Reporter: XSampled

When you try to create colourmap:

File without mipmaps
only one mipmap will be loaded from file without mipmaps
(Black mess will appear on terrain afterwards).

File with mipmaps
Only TextureManager->getDefaultNumMipmaps() or less mipmaps will be loaded from file with mipmaps exception will be thrown otherwise.

Colourmap image file must have at least TextureManager->getDefaultNumMipmaps() mipmaps to produce colourmap.

We have two options
1. Image with mipmaps
2. Image without mipmaps

Step 1. Image with mipmaps
If i want to use this colourmap i have to set

Ogre:Real NumMipMaps = Math::Log2(4096/My map size/);
TextureManager->setDefaultNumMipmaps(NumMipMaps);

before loading the colourmap with (NumMipMaps) mipmaps or ill face an exception otherwise.

(This step is have to be done before you'll try to set up a colourmap due to
createOrDestroyGPUColourMap() must create enough mipmaps)

When you load colourmap texture with a new image
colourmap texture will not be updated an old texture will be used instead. If a new image have more mipmaps than constructed via createOrDestroyGPUColourMap()
an exception will be thrown.

Step 2.
Image without mipmaps have one base mipmap. While a texture will never be updated since createOrDestroyGPUColourMap() the load function will load the base
texture as #0 mipmap.

--------------------------------------

Possible solution:

At the source part of OgreTerrain.cpp line 3415 in the function createOrDestroyGPUColourMap()
I change the texture usage from TU_STATIC to TU_AUTOMIPMAP | TU_STATIC so the texture can generate the mipmap on the fly
[code]mColourMap = TextureManager::getSingleton().createManual(
mMaterialName + "/cm", _getDerivedResourceGroup(),
TEX_TYPE_2D, mGlobalColourMapSize, mGlobalColourMapSize, MIP_DEFAULT,
PF_BYTE_RGB, TU_AUTOMIPMAP | TU_STATIC);/code

Original Mantis Ticket: http://www.ogre3d.org/mantis/view.php?id=345

Environment

None

Activity

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Created November 19, 2012 at 10:44 AM
Updated May 26, 2013 at 6:50 AM
Resolved May 26, 2013 at 6:50 AM