[solved] Camera/Entity problem (blank white screen)

Letschki

14-12-2008 13:01:45

Hello,

i am currently learning Ogre/QuickGUI and encountered a problem i cannot track down.

If i am using QuickGUI without additionally Ogre::Entity objects everything renders fine. But by adding one entity and moving the camera ogre only renders a blank white screen.

I am using Ogre 1.6 and QuickGUI_8_12. I have added the following code to the PlayPen example (Window constructor) and it only displays a white screen:


...
Ogre::Entity * m_entVisual = mSceneManager->createEntity("testSphere", Ogre::SceneManager::PT_SPHERE);

Ogre::SceneNode * m_nodeVisual = mSceneManager->getRootSceneNode()->createChildSceneNode("test");
if(m_nodeVisual != NULL) {
m_nodeVisual->attachObject(m_entVisual);
}
mCamera->setPosition(0, 0, 100);
mCamera->lookAt(0,0,0);


I have searched for hints in the ogre.log file but couldn't find the problem:


13:41:34: Creating resource group General
13:41:34: Creating resource group Internal
13:41:34: Creating resource group Autodetect
13:41:34: SceneManagerFactory for type 'DefaultSceneManager' registered.
13:41:34: Registering ResourceManager for type Material
13:41:34: Registering ResourceManager for type Mesh
13:41:34: Registering ResourceManager for type Skeleton
13:41:34: MovableObjectFactory for type 'ParticleSystem' registered.
13:41:34: OverlayElementFactory for type Panel registered.
13:41:34: OverlayElementFactory for type BorderPanel registered.
13:41:34: OverlayElementFactory for type TextArea registered.
13:41:34: Registering ResourceManager for type Font
13:41:34: ArchiveFactory for archive type FileSystem registered.
13:41:34: ArchiveFactory for archive type Zip registered.
13:41:34: FreeImage version: 3.10.0
13:41:34: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
13:41:34: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2
13:41:34: DDS codec registering
13:41:34: Registering ResourceManager for type HighLevelGpuProgram
13:41:34: Registering ResourceManager for type Compositor
13:41:34: MovableObjectFactory for type 'Entity' registered.
13:41:34: MovableObjectFactory for type 'Light' registered.
13:41:34: MovableObjectFactory for type 'BillboardSet' registered.
13:41:34: MovableObjectFactory for type 'ManualObject' registered.
13:41:34: MovableObjectFactory for type 'BillboardChain' registered.
13:41:34: MovableObjectFactory for type 'RibbonTrail' registered.
13:41:34: *-*-* OGRE Initialising
13:41:34: *-*-* Version 1.6.0 (Shoggoth)
13:41:34: Loading library RenderSystem_GL_d.dll
13:41:34: Installing plugin: GL RenderSystem
13:41:34: OpenGL Rendering Subsystem created.
13:41:34: Plugin successfully installed
13:41:34: Loading library RenderSystem_Direct3D9_d.dll
13:41:34: Installing plugin: D3D9 RenderSystem
13:41:34: D3D9 : Direct3D9 Rendering Subsystem created.
13:41:35: D3D9: Driver Detection Starts
13:41:35: D3D9: Driver Detection Ends
13:41:35: Plugin successfully installed
13:41:35: D3D9 : RenderSystem Option: Allow NVPerfHUD = No
13:41:35: D3D9 : RenderSystem Option: Anti aliasing = None
13:41:35: D3D9 : RenderSystem Option: Floating-point mode = Fastest
13:41:35: D3D9 : RenderSystem Option: Full Screen = No
13:41:35: D3D9 : RenderSystem Option: VSync = No
13:41:35: D3D9 : RenderSystem Option: Video Mode = 800 x 600 @ 32-bit colour
13:41:35: Added resource location 'resources' of type 'FileSystem' to resource group 'General'
13:41:35: CPU Identifier & Features
13:41:35: -------------------------
13:41:35: * CPU ID: GenuineIntel: Intel(R) Core(TM)2 CPU 6400 @ 2.13GHz
13:41:35: * SSE: yes
13:41:35: * SSE2: yes
13:41:35: * SSE3: yes
13:41:35: * MMX: yes
13:41:35: * MMXEXT: yes
13:41:35: * 3DNOW: no
13:41:35: * 3DNOWEXT: no
13:41:35: * CMOV: yes
13:41:35: * TSC: yes
13:41:35: * FPU: yes
13:41:35: * PRO: yes
13:41:35: * HT: no
13:41:35: -------------------------
13:41:35: D3D9 : Subsystem Initialising
13:41:35: D3D9RenderSystem::_createRenderWindow "OGRE Render Window", 800x600 windowed miscParams: FSAA=0 FSAAQuality=0 colourDepth=32 gamma=false useNVPerfHUD=false vsync=false
13:41:35: D3D9 : Created D3D9 Rendering Window 'OGRE Render Window' : 800x600, 32bpp
13:41:35: D3D9 : WARNING - disabling VSync in windowed mode can cause timing issues at lower frame rates, turn VSync on if you observe this problem.
13:41:35: Registering ResourceManager for type Texture
13:41:35: Registering ResourceManager for type GpuProgram
13:41:35: D3D9: Vertex texture format supported - PF_FLOAT16_RGB
13:41:35: D3D9: Vertex texture format supported - PF_FLOAT16_RGBA
13:41:35: D3D9: Vertex texture format supported - PF_FLOAT32_RGB
13:41:35: D3D9: Vertex texture format supported - PF_FLOAT32_RGBA
13:41:35: D3D9: Vertex texture format supported - PF_FLOAT16_R
13:41:35: D3D9: Vertex texture format supported - PF_FLOAT32_R
13:41:35: D3D9: Vertex texture format supported - PF_FLOAT16_GR
13:41:35: D3D9: Vertex texture format supported - PF_FLOAT32_GR
13:41:35: RenderSystem capabilities
13:41:35: -------------------------
13:41:35: RenderSystem Name: Direct3D9 Rendering Subsystem
13:41:35: GPU Vendor: nvidia
13:41:35: Device Name: NVIDIA GeForce 8800 GTS
13:41:35: Driver Version: 7.15.11.8048
13:41:35: * Fixed function pipeline: yes
13:41:35: * Hardware generation of mipmaps: yes
13:41:35: * Texture blending: yes
13:41:35: * Anisotropic texture filtering: yes
13:41:35: * Dot product texture operation: yes
13:41:35: * Cube mapping: yes
13:41:35: * Hardware stencil buffer: yes
13:41:35: - Stencil depth: 8
13:41:35: - Two sided stencil support: yes
13:41:35: - Wrap stencil values: yes
13:41:35: * Hardware vertex / index buffers: yes
13:41:35: * Vertex programs: yes
13:41:35: * Fragment programs: yes
13:41:35: * Geometry programs: no
13:41:35: * Supported Shader Profiles: hlsl ps_1_1 ps_1_2 ps_1_3 ps_1_4 ps_2_0 ps_2_a ps_2_b ps_2_x ps_3_0 vs_1_1 vs_2_0 vs_2_a vs_2_x vs_3_0
13:41:35: * Texture Compression: yes
13:41:35: - DXT: yes
13:41:35: - VTC: no
13:41:35: * Scissor Rectangle: yes
13:41:35: * Hardware Occlusion Query: yes
13:41:35: * User clip planes: yes
13:41:35: * VET_UBYTE4 vertex element type: yes
13:41:35: * Infinite far plane projection: yes
13:41:35: * Hardware render-to-texture: yes
13:41:35: * Floating point textures: yes
13:41:35: * Non-power-of-two textures: yes
13:41:35: * Volume textures: yes
13:41:35: * Multiple Render Targets: 4
13:41:35: - With different bit depths: yes
13:41:35: * Point Sprites: yes
13:41:35: * Extended point parameters: yes
13:41:35: * Max Point Size: 8192
13:41:35: * Vertex texture fetch: yes
13:41:35: - Max vertex textures: 4
13:41:35: - Vertex textures shared: no
13:41:35: * Render to Vertex Buffer : no
13:41:35: * DirectX per stage constants: yes
13:41:35: ***************************************
13:41:35: *** D3D9 : Subsystem Initialised OK ***
13:41:35: ***************************************
13:41:35: ResourceBackgroundQueue - threading disabled
13:41:35: Particle Renderer Type 'billboard' registered
13:41:36: Parsing scripts for resource group Autodetect
13:41:36: Finished parsing scripts for resource group Autodetect
13:41:36: Parsing scripts for resource group General
13:41:36: Parsing script Example.material
13:41:36: Parsing script Sphere_Game.material
13:41:36: Parsing script Button.skinTypes
13:41:36: Parsing script CheckBox.skinTypes
13:41:36: Parsing script ComboBox.skinTypes
13:41:36: Parsing script Console.skinTypes
13:41:36: Parsing script HScrollBar.skinTypes
13:41:36: Parsing script Image.skinTypes
13:41:36: Parsing script Label.skinTypes
13:41:36: Parsing script List.skinTypes
13:41:36: Parsing script ListTextItem.skinTypes
13:41:36: Parsing script Menu.skinTypes
13:41:36: Parsing script MenuLabel.skinTypes
13:41:36: Parsing script MenuPanel.skinTypes
13:41:36: Parsing script MouseCursor.skinTypes
13:41:36: Parsing script Panel.skinTypes
13:41:36: Parsing script ProgressBar.skinTypes
13:41:36: Parsing script Sheet.skinTypes
13:41:36: Parsing script Tab.skinTypes
13:41:36: Parsing script TabControl.skinTypes
13:41:36: Parsing script TabPage.skinTypes
13:41:36: Parsing script TextArea.skinTypes
13:41:36: Parsing script TextBox.skinTypes
13:41:36: Parsing script TextCursor.skinTypes
13:41:36: Parsing script TitleBar.skinTypes
13:41:36: Parsing script ToolBar.skinTypes
13:41:36: Parsing script VScrollBar.skinTypes
13:41:36: Parsing script Window.skinTypes
13:41:36: Parsing script micross.fontdef
13:41:36: Finished parsing scripts for resource group General
13:41:36: Parsing scripts for resource group Internal
13:41:36: Finished parsing scripts for resource group Internal
13:41:36: Font micross.8.5using texture size 256x128
13:41:36: Info: Freetype returned null for character 160 in font micross.8.5
13:41:36: Texture: micross.8.5Texture: Loading 1 faces(PF_BYTE_LA,256x128x1) with 0 generated mipmaps from Image. Internal format is PF_BYTE_LA,256x128x1.
13:41:36: Font micross.12using texture size 256x256
13:41:36: Info: Freetype returned null for character 160 in font micross.12
13:41:36: Texture: micross.12Texture: Loading 1 faces(PF_BYTE_LA,256x256x1) with 0 generated mipmaps from Image. Internal format is PF_BYTE_LA,256x256x1.
13:41:36: Texture: qgui.cursor.textselect.png: Loading 1 faces(PF_A8R8G8B8,15x26x1) with 4 generated mipmaps from Image. Internal format is PF_A8R8G8B8,15x26x1.
13:41:36: Texture: qgui.progressbar1.bar.png: Loading 1 faces(PF_A8R8G8B8,117x16x1) with 6 generated mipmaps from Image. Internal format is PF_A8R8G8B8,117x16x1.
13:41:36: Texture: qgui.progressbar1.clipbox.png: Loading 1 faces(PF_A8R8G8B8,117x16x1) with 6 generated mipmaps from Image. Internal format is PF_A8R8G8B8,117x16x1.
13:41:36: Texture: qgui.panel.png: Loading 1 faces(PF_A8R8G8B8,408x217x1) with 8 generated mipmaps from Image. Internal format is PF_A8R8G8B8,408x217x1.
13:41:36: Texture: qgui.scrollbar.horizontal.png: Loading 1 faces(PF_A8R8G8B8,131x14x1) with 7 generated mipmaps from Image. Internal format is PF_A8R8G8B8,131x14x1.
13:41:36: Texture: qgui.scrollbar.horizontal.left.png: Loading 1 faces(PF_A8R8G8B8,14x14x1) with 3 generated mipmaps from Image. Internal format is PF_A8R8G8B8,14x14x1.
13:41:36: Texture: qgui.scrollbar.horizontal.right.png: Loading 1 faces(PF_A8R8G8B8,14x14x1) with 3 generated mipmaps from Image. Internal format is PF_A8R8G8B8,14x14x1.
13:41:36: Texture: qgui.scrollbar.horizontal.slider.png: Loading 1 faces(PF_A8R8G8B8,44x14x1) with 5 generated mipmaps from Image. Internal format is PF_A8R8G8B8,44x14x1.
13:41:36: Texture: qgui.scrollbar.vertical.png: Loading 1 faces(PF_A8R8G8B8,14x158x1) with 7 generated mipmaps from Image. Internal format is PF_A8R8G8B8,14x158x1.
13:41:36: Texture: qgui.scrollbar.vertical.bottom.png: Loading 1 faces(PF_A8R8G8B8,14x14x1) with 3 generated mipmaps from Image. Internal format is PF_A8R8G8B8,14x14x1.
13:41:36: Texture: qgui.scrollbar.vertical.slider.png: Loading 1 faces(PF_A8R8G8B8,14x44x1) with 5 generated mipmaps from Image. Internal format is PF_A8R8G8B8,14x44x1.
13:41:36: Texture: qgui.scrollbar.vertical.top.png: Loading 1 faces(PF_A8R8G8B8,14x14x1) with 3 generated mipmaps from Image. Internal format is PF_A8R8G8B8,14x14x1.
13:41:36: Texture: qgui.toolbar.background.png: Loading 1 faces(PF_R8G8B8,196x22x1) with 7 generated mipmaps from Image. Internal format is PF_X8R8G8B8,196x22x1.
13:41:36: Texture: qgui.combobox.png: Loading 1 faces(PF_A8R8G8B8,146x19x1) with 7 generated mipmaps from Image. Internal format is PF_A8R8G8B8,146x19x1.
13:41:36: Texture: qgui.combobox.button.png: Loading 1 faces(PF_A8R8G8B8,14x19x1) with 4 generated mipmaps from Image. Internal format is PF_A8R8G8B8,14x19x1.
13:41:36: Texture: qgui.textbox.png: Loading 1 faces(PF_A8R8G8B8,233x24x1) with 7 generated mipmaps from Image. Internal format is PF_A8R8G8B8,233x24x1.
13:41:37: Texture: qgui.progressbar1.background.png: Loading 1 faces(PF_A8R8G8B8,121x20x1) with 6 generated mipmaps from Image. Internal format is PF_A8R8G8B8,121x20x1.
13:41:37: Texture: qgui.button.png: Loading 1 faces(PF_A8R8G8B8,78x23x1) with 6 generated mipmaps from Image. Internal format is PF_A8R8G8B8,78x23x1.
13:41:37: Texture: qgui.checkbox.unchecked.png: Loading 1 faces(PF_A8R8G8B8,12x12x1) with 3 generated mipmaps from Image. Internal format is PF_A8R8G8B8,12x12x1.
13:41:37: Texture: qgui.window.png: Loading 1 faces(PF_A8R8G8B8,256x256x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x256x1.
13:41:37: Texture: qgui.window.titlebar.png: Loading 1 faces(PF_A8R8G8B8,407x20x1) with 8 generated mipmaps from Image. Internal format is PF_A8R8G8B8,407x20x1.
13:41:37: Texture: qgui.window.titlebar.close.png: Loading 1 faces(PF_A8R8G8B8,17x15x1) with 4 generated mipmaps from Image. Internal format is PF_A8R8G8B8,17x15x1.
13:41:37: Texture: qgui.cursor.png: Loading 1 faces(PF_A8R8G8B8,28x40x1) with 5 generated mipmaps from Image. Internal format is PF_A8R8G8B8,28x40x1.
13:41:42: Texture: qgui.cursor.grabable.png: Loading 1 faces(PF_A8R8G8B8,25x22x1) with 4 generated mipmaps from Image. Internal format is PF_A8R8G8B8,25x22x1.
13:41:44: *-*-* OGRE Shutdown
13:41:44: Unregistering ResourceManager for type Compositor
13:41:44: Unregistering ResourceManager for type Font
13:41:44: Unregistering ResourceManager for type Skeleton
13:41:44: Unregistering ResourceManager for type Mesh
13:41:44: Unregistering ResourceManager for type HighLevelGpuProgram
13:41:44: Uninstalling plugin: D3D9 RenderSystem
13:41:44: D3D9 : Shutting down cleanly.
13:41:44: Unregistering ResourceManager for type Texture
13:41:44: Unregistering ResourceManager for type GpuProgram
13:41:44: D3D9 : Direct3D9 Rendering Subsystem destroyed.
13:41:44: Plugin successfully uninstalled
13:41:44: Unloading library RenderSystem_Direct3D9_d.dll
13:41:44: Uninstalling plugin: GL RenderSystem
13:41:44: *** Stopping Win32GL Subsystem ***
13:41:44: Plugin successfully uninstalled
13:41:44: Unloading library RenderSystem_GL_d.dll
13:41:44: Unregistering ResourceManager for type Material


Thanks in advance :)

NickM

15-12-2008 06:50:52

Sounds a bit silly but have you tried just moving the camera further away in case it's just that your sphere is really big and the white you are seeing is the sphere, or are you not seeing any GUI tuff either?

Letschki

15-12-2008 07:43:58

Thanks NickM,

no the gui is not displayed. i have already tried:


mCamera->setPosition(0, 0, 500);
mCamera->lookAt(0,0,0);


I noticed one more thing during debugging. It seems that the first number of frames are rendered correctly and then the screen turns to white. As far as i can see there are no errors reported. Additionally even if i change the ambient colour to red the 'blank' screen is rendered white.

If I remove the lines with the camera code everything is rendered fine.


// mCamera->setPosition(0, 0, 500);
// mCamera->lookAt(0,0,0);


I guess it is something silly, but currently i cannot see it :(

kungfoomasta

15-12-2008 19:10:31

I recently made my own Mesh Viewer application, and I noticed that for 5 models (out of the 40 I was using), the screen would go entirely white when I selected them for display. The models in my case are from neverwinter nights, and I just assumed there was some odd issue with the model. Are you using a standard Ogre model like ninja.mesh? Try a different model and see if the result occurs. I don't really know how a model could interfere with the GUI, its puzzling to me also.

Letschki

16-12-2008 09:46:59

You are right. The ogre example model "ninja.mesh" is rendered fine. The first model not rendered was a simple sphere with one texture exported from blender. The second 'model' was the prefab sphere from ogre.

I have used your PlayPen sample to re-create the problem (added to the end of the window constructor):

Ogre::Entity * m_entVisual = mSceneManager->createEntity("testSphere", Ogre::SceneManager::PT_SPHERE);
//Ogre::Entity * m_entVisual = mSceneManager->createEntity("ninja", "ninja.mesh");

Ogre::SceneNode * m_nodeVisual = mSceneManager->getRootSceneNode()->createChildSceneNode("test");
if(m_nodeVisual != NULL) {
m_nodeVisual->attachObject(m_entVisual);
}
mCamera->setPosition(0, 0, 500);
mCamera->lookAt(0,0,0);



This code renders the white screen. Again i have noticed that the first frames were correctly rendered. If i uncomment the "ninja" line and remove the "testSphere" line everything renders fine.

kungfoomasta

16-12-2008 19:01:53

I noticed with that code, the Sphere would not have any material assigned to it. Or does the SceneManager::PT_Sphere mesh have a default material? I don't understand how a mesh could interfere with rendering the UI. If you strip out all the GUI code and just render the sphere and camera setup as in your code, does everything become white?

Letschki

17-12-2008 15:13:36

Sorry, but it seems some kind of side effect of the GUI code. I have stripped the GUI code out of the PlayPen example and the sphere is rendered in plain white in the middle of the screen. The remaininig part of the screen displays the background color as expected.

kungfoomasta

17-12-2008 18:34:27

I figured it might be, I just don't know how thats possible. I will have to add this to the list of things to investigate, basically by enabling parts of the GUI until the issue occurs. Does the white screen display if there is only a sheet on the screen? This is a guess but maybe the primitive type is somehow altering the textures and making them white, so everything on the screen becomes white.

Letschki

17-12-2008 18:53:27

I have added the QuickGUI code step by step. The sphere is rendered until i add the statement:


mGUIManager = QuickGUI::Root::getSingletonPtr()->createGUIManager(d);


The instantiation of QuickGUI (new QuickGUI::Root()) and the loadTypes() method doesn't stop the correct rendering. As far as i can see i haven't used any widgets :)

kungfoomasta

17-12-2008 20:29:42

Thanks for helping with this. When the GUIManager is created, it creates a default sheet. Could you try:

mGUIManager->getActiveSheet()->setVisible(false);

And seeing if the screen is white? I don't remember if I allowed Sheets to be set visible or not.

The only other thing drawn besides the Sheet is the mouse cursor. You could try making that invisible also.

Letschki

17-12-2008 21:01:30

I have tried it and you were right. It seems somehow related to the sheet. Adding your suggested line results in 'normal' rendering.


// Sphere is rendered normaly
mGUIManager->getActiveSheet()->setVisible(false);



// Screen wents to blank white after some frames
mGUIManager->getActiveSheet()->setVisible(true);

kungfoomasta

17-12-2008 21:09:42

Test 1:

Create a window of the sheet and see if it draws properly:

WindowDesc wd;
mGUIManager->getActiveSheet()->createWindow(wd);


It looks like the Sheets texture is getting written over by the primitive's material. Both the Sheet and Window have its own texture, this test will see if the Windows texture is getting altered as well, or if its just the sheet.

Test 2:

Assign the ninja material to the primitive mesh (sphere), and see what the affects are against the sheet and window.

Hopefully this will give us some good information.

Letschki

17-12-2008 21:26:20

I hope i have tested it correctly. Here are my results:

Test 1:
Adding the window hasn't changed the outcome. The screen is stil rendered plain white.

QuickGUI::WindowDesc wd;
QuickGUI::Window * win = mGUIManager->getActiveSheet()->createWindow(wd);

Test 2:
After i have added the material to the sphere the output is correct. The window is displayed in the upper, left corner of the screen and the "ninja textured" sphere is displayed at the screen's center.

m_entVisual->setMaterialName("Examples/Ninja");


Hope this helps.

kungfoomasta

17-12-2008 21:42:33

Thanks! I think you've helped me figure out the problem while I'm at work!

One last thing, if you could do this for me, or I can do it later tonight. Are you familiar with the MaterialSerializer class? The sphere uses a default Ogre material, for objects that do not have materials. We need to output this to file and compare with normal materials.

My theory:

All QuickGUI does is render textures onto the screen. However, if a material is renderer prior to rendering of the GUI, the GUI will inherit the last pass' properties.

SceneManager::_setPass

So basically the problem is that the Ogre default material is being set prior to rendering of the GUI, making all textures inherit the pass properties, which is probably white with no lighting, or something. The solution? QuickGUI::Root needs to create a plain pass, and each GUIManager needs to set it prior to rendering of the Sheet.

I'm fairly confident this is the problem. Thanks so much for helping me figure this out. Even if you aren't able to serialize the default material, I know where to look and what to do to fix this issue. :D

kungfoomasta

18-12-2008 07:00:55

I created an "empty" pass, with scene blending alpha and lighting disabled. I verified your code above works, I will upload the updated lib in a day or so.

Letschki

18-12-2008 07:47:30

Sorry, i have missed your last post (time-lag). But thanks for your effort! I really appreciate the work you and other contributers put into both QuickGUI and Ogre. :)

I hope that someday i am able to help, too.

Greetings from Germany.

Letschki

02-01-2009 12:07:11

The problem is solved with the 8.12 update (QuickGUI_8_12.zip)! Thanks!!!