Impostors not generated

guru

06-07-2009 00:32:49

Hi,
updating to latest ogre and pagedgeometry svn I encounter a problem where no impostors are generated. Thus, once impostor trees come into view ogre raises an exception:

01:40:57: Added resource location '.' of type 'FileSystem' to resource group 'BinFolder'
01:40:57: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Impostor.RIKJRQHATGKWUIOGOAKGNWJIRMERFJLW.128.dds in resource group BinFolder or any other group. in ResourceGroupManager::openResource at /ogre/OgreMain/src/OgreResourceGroupManager.cpp (line 738)
01:40:57: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Impostor.RIKJRQHATGKWUIOGOAKGNWJIRMERFJLW.128.png in resource group BinFolder or any other group. in ResourceGroupManager::openResource at /ogre/OgreMain/src/OgreResourceGroupManager.cpp (line 738)
01:40:57: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Impostor.RIKJRQHATGKWUIOGOAKGNWJIRMERFJLW.128.png in resource group BinFolder or any other group. in ResourceGroupManager::openResource at /ogre/OgreMain/src/OgreResourceGroupManager.cpp (line 738)

The meshes are loaded but impostor images never get generated. When I disable the impostor detail level everything works as expected. I'm on gentoo linux.
Maybe someone has an idea?

tdev

06-07-2009 08:50:45

ouch. Are the images somewhere to be found on your system?
i will have a look at the code, since i modfied that behavior.

guru

06-07-2009 09:41:22

Ah, why didn't I spot it earlier? The first png gets generated but is named ".Impostor.RIKJRQHATGKWUIOGOAKGNWJIRMERFJLW.128.png" with a leading period. I think tempdir is generated or used wrongly. When I change line 602 in ImpostorPage.cpp torenderTarget->writeContentsToFile(tempdir + "/" + fileNamePNG); the problem is gone.

tdev

06-07-2009 11:32:07

Ah, why didn't I spot it earlier? The first png gets generated but is named ".Impostor.RIKJRQHATGKWUIOGOAKGNWJIRMERFJLW.128.png" with a leading period. I think tempdir is generated or used wrongly. When I change line 602 in ImpostorPage.cpp torenderTarget->writeContentsToFile(tempdir + "/" + fileNamePNG); the problem is gone.
thanks, i changed the code to this:


String tempFileName = tempdir.empty()?fileNamePNG:tempdir + fileNamePNG;
renderTarget->writeContentsToFile(tempFileName);


please update and test :)

guru

06-07-2009 21:37:23

It working fine now, thanks. At first I was a bit surprised the new code was working, then I saw that you also changed the tempdir initial value :) Thanks for the quick fix!

Btw - what is the status of paged geometry and dynamic lighting? I saw you incorporated some old diffs? Also does that mean support for fixed function pipeline is compromized? Not that I care about ff, I'm just curious because I think JohnJ refrained from applying some of the diffs because of this reason (thread here).

tdev

06-07-2009 23:38:23

It working fine now, thanks. At first I was a bit surprised the new code was working, then I saw that you also changed the tempdir initial value :) Thanks for the quick fix!

Btw - what is the status of paged geometry and dynamic lighting? I saw you incorporated some old diffs? Also does that mean support for fixed function pipeline is compromized? Not that I care about ff, I'm just curious because I think JohnJ refrained from applying some of the diffs because of this reason (thread here).

good to hear :)
about dynamic lighting: i have not looked into adding more features myself yet, since i want to finish integrating the examples into cmake first. This could work out as good test scenario for the lighting issues.

i also added a new method with which you can disable some shaders that are being used. (That was not tested yet)
see PagedGeometry::setShadersEnabled(bool)

there might also some timing conditions that this must be disabled if wished before you add anything.

AndiNo

02-02-2011 11:52:21

I'm using PagedGeometry version 1.1.0 and my app is crashing when I try to use Impostors. The images never get created which leads to this crash:
12:46:58: Creating resource group BinFolder
12:46:58: Added resource location '.' of type 'FileSystem' to resource group 'BinFolder'
12:46:58: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Impostor.IQCKFEJTPODAADCBVBPEBKJLVYBKWYTZ.128.dds in resource group BinFolder or any other group. in ResourceGroupManager::openResource at ../../../../../OgreMain/src/OgreResourceGroupManager.cpp (line 753)

I'm using only slightly modified code from example 8 coming with PG. Additionally I set the temporary directory to "." as the pre compiled example 8 seems to do, too, whereas PG sets the tempDir to "" by default. Am I missing something? Or is there a newer version of PG available?
PS: I'm using Ogre 1.7.1 in OpenGL mode on WindowsXP.

tod

10-08-2011 19:26:39

I also got into something similar as the last post. Paged Geometry has a try catch when loading impostors and the exception can be caught by the debugger. That's part of the normal flow.

AndiNo

10-08-2011 21:14:51

I'm still interested in getting this to work, too. So if there's any updated information about this, please tell us about it.

tod

11-08-2011 08:19:33

What I was trying to say was to tell the debugger not to catch exceptions. PG tells ogre to load the impostor image and if an exception is thrown the imposter is then generated. If the debugger catches this exception it looks like something is wrong but if you just pass it to the program it is catch and everything work just fine.
That was my case at least.

AndiNo

12-08-2011 12:09:53

Oh okay, thanks for the clarification. I will test this when I have the time. But I guess this is not the intended behaviour of the PG code. Maybe you can change the code so it "works" and submit it to the PG devs as a patch :)

tod

12-08-2011 13:24:28

It is as intended as it can be :D

AndiNo

04-09-2011 22:58:19

It seems you were right, the code works. I was not using a debugger though but compiled in debug mode. To make it work I changed PG so it just checks if the given file already exists and then loads it or recreates it. It's not nice but it works :)
However it seems I've got another problem with impostors now... :(

duststorm

18-07-2012 09:27:16

I have noticed that (on linux) it is required that you add "/" at the end of your path. It's quite easy to miss, certainly because the API does not document it. This is how you need to do it.
// Set impostor cache path (NOTE: the / at the end is needed!!)
mTrees->setTempDir("cache/PagedGeometry/");

Forgetting the trailing slash will cause the usual resource not found exception. Maybe the code can proactively add an extra "/" to the end of tempdir?

This is with the latest hg version of ogre-paged, by the way.

The patch I propose:
diff -r 06de7ef9f790 source/PagedGeometry.cpp
--- a/source/PagedGeometry.cpp Thu Feb 16 15:01:04 2012 +0000
+++ b/source/PagedGeometry.cpp Wed Jul 18 10:29:08 2012 +0200
@@ -86,7 +86,7 @@

void PagedGeometry::setTempDir(Ogre::String dir)
{
- tempdir = dir;
+ tempdir = dir + "/";
}

void PagedGeometry::setPageLoader(PageLoader *loader)

Someone first needs to test whether it still works on windows, though.