OGRE Wiki
Support and community documentation for Ogre3D
Ogre Forums
ogre3d.org
Log in
Username:
Password:
CapsLock is on.
Remember me (for 1 year)
Log in
Home
Tutorials
Tutorials Home
Basic Tutorials
Intermediate Tutorials
Mad Marx Tutorials
In Depth Tutorials
Older Tutorials
External Tutorials
Cookbook
Cookbook Home
CodeBank
Snippets
Experiences
Ogre Articles
Libraries
Libraries Home
Alternative Languages
Assembling A Toolset
Development Tools
OGRE Libraries
List of Libraries
Tools
Tools Home
DCC Tools
DCC Tutorials
DCC Articles
DCC Resources
Assembling a production pipeline
Development
Development Home
Roadmap
Building Ogre
Installing the Ogre SDK
Setting Up An Application
Ogre Wiki Tutorial Framework
Frequently Asked Questions
Google Summer Of Code
Help Requested
Ogre Core Articles
Community
Community Home
Projects Using Ogre
Recommended Reading
Contractors
Wiki
Immediate Wiki Tasklist
Wiki Ideas
Wiki Guidelines
Article Writing Guidelines
Wiki Styles
Wiki Page Tracker
Ogre Wiki Help
Ogre Wiki Help Overview
Help - Basic Syntax
Help - Images
Help - Pages and Structures
Help - Wiki Plugins
Toolbox
Freetags
Categories
List Pages
Structures
Trackers
Statistics
Rankings
List Galleries
Ogre Lexicon
Comments
History: Common Mistakes
View page
Source of version: 21
(current)
{BOX(title="FAQ",align="center")}{IMG(src="img/icons/help.gif")}{IMG} Frequently Asked Questions about OGRE topics such as Initialisation, Lighting, Transparency, Animation, Resources and Materials, Orienting an Object, Performance, etc.{BOX} {maketoc} !!Initialisation __Why is my render window black?__ * Way too many possibilities...start first with: ** Have you created a ((-camera|camera)) and a ((-viewport|viewport))? See Ogre demo code in ''createScene()'' methods for more... ** Have you set camera clip distances to some sane values? ** Are you trying to render a black cat on a black background? ** Do you have any lights set up (e.g. SceneManager::setAmbientLight)? ** If you are using multiple ((-SceneManager|SceneManagers)), did you populate the currently active scene graph (SceneManager) or another? ** If you are using the demo ExampleApplication framework, did you call startRendering()? Did you implement ''createScene()''? ** If you are using a custom main loop, are you calling the host windowing system's message loop to allow its PAINT messages to fall through and be processed? ** Is your camera INSIDE a model you've placed in your scene? Try moving your camera backwards on the Z plane. ** If you previously broke up startRendering() into a custom main loop, do you still call renderOneFrame() on Ogre::Root? !!Lighting __Why does my dynamic lighting look all wrong?__ * Check you have ((-normal|normals)) on your mesh * Check they are pointing in the right direction (i.e. out of the model) * If you have scaled any of the ((-scenenode|nodes)) the objects are attached to, note that this scaling distorts the size of the normals too. You should either avoid scaling dynamically lit objects (e.g. rescale them in the modeller instead), or use ''Entity::setNormaliseNormals()'' to compensate !!Transparency __Why don't areas behind transparent objects get rendered properly?__ * Just blending through ''scene_blend'' isn't enough - you have to think about what happens with depth information. By default the rasteriser uses depth information to decide whether to render a ((-pixel|pixel)), so if your transparent object is updating the depth even in transparent areas, it will occlude objects rendered afterwards. If your material has partially transparent areas (not just fully solid or fully transparent), then you need to turn depth writing off for your transparent material (''depth_write off'' in the pass section). If your material only has \''hard\'' alpha i.e. either 100% transparent or fully solid, then a more optimal setting is ''alpha_rejection'', which rejects depth updates in transparent areas too. !!Animation __Why does my animation not run?__ * You have to call ''AnimationState::addTime()'' each frame to advance the animation. See the [http://www.ogre3d.org/docs/api/html/classOgre_1_1AnimationState.html#4670365ae58e531297816ede430b0971| AnimationState::addTime() API reference] for more * You might have forgotten to turn it on using ''AnimationState::SetEnabled(true)'' * Maybe it did run once at the start, you just didn't see it. Check if you are looping or not, if not: use ''AnimationState::SetLoop(true)'' !!Resources And Materials __Why does my object display as white (or black) in Ogre?__ * Check the Ogre.log that resides by default in your program's directory . It will contain information about the materials that were not found or could not be parsed for some reason. * Make sure you place your materials either in the locations mentioned in resources.cfg, or, if assigning resource locations manually, make sure you add the location of the .material script using ''ResourceGroupManager::addResourceLocation()'' * Make sure that you are calling ''ResourceGroupManager::initialiseAllResourceGroups()'' or ''ResourceGroupManager::initialiseResourceGroup()'' until you do, your materials, even if they are found, will neither be parsed or available, and you will get lines in Ogre.log asking you if you forgot to define a material. __Why does my resource creation or load fail in strange ways?__ * Check you have created at least one render window before loading a resource. Both ((-Direct3D|Direct3D)) and ((-OpenGL|OpenGL)) need a primary window context and many aspects of resources cannot be loaded until there is a window. __OgreCore.zip missing?__ * OgreCore.zip belongs to Ogre 1.6.0 and was removed in 2009 (It seems the mac and iphone versions of ogre still include it in the xcode templates). * Add SdkTrays.zip to your resources config file (it's in media/packs). !!Orienting An Object __What are the differences between ''lookAt()'', ''setAutoTracking()'', ''setDirection()'', ''setOrientation()''...__ * ''setDirection()'' makes your node face parallel to a provided vector. You provide the vector, transform space (local, relative to parent or absolute), and the local axis with which to point (usually the negative Z axis). * ''lookAt()'' uses ''setDirection()''. It makes your node face a certain point. The difference is subtle. Picture object A at 100,100 and B at 90,10. ''B.lookAt(100,100)'' will point B at A. ''B.setDirection(100,100)'' will point it parallel to the line (0,0)-(100,100). * ''setAutoTracking()'' means lookAt another node and keep looking at it, even if it moves. * ''setOrientation()'' and ''rotate()'' are the most useful methods for orienting objects. They are discussed at length along with Quaternions in the ((Quaternion and Rotation Primer)). * See the [http://www.ogre3d.org/docs/api/html/classOgre_1_1SceneNode.html|API documentation on SceneNode] for further details on the above functions. !!Performance __My program is running too slow! (or takes a long time to shutdown)__ * __Debug vs Release__ ** You could be building it in 'Debug' mode. Debug mode enables a lot of checks and functions to help debug the code, but at the cost of processor overhead; when you are finished debugging the program, make sure you select 'Release' mode (on Windows systems, on Linux you should add -O3 to your compiler flags) so you can see it run at the proper speed. The difference is usually quite significant. One user reported a 400% difference. * __Batching__ ** You may be using too many individual objects/submeshes. Graphics cards (((-GPU|GPU))) like to have rendering queued into a relatively small number of large batches to operate at peak efficiency. If you use lots of small movable objects, especially if they are composed of multiple submeshes (each of which is its own render operation), the GPU underperforms because too much time is being spent in the overhead of setting up the individual rendering operations. This enqueueing process is done in the driver, which is constrained by the speed of the ((-CPU|CPU)), not the GPU. [http://download.nvidia.com/developer/presentations/2005/GDC/Direct3D_Day/D3DTutorial03_Optimization.pdf|This presentation] explains that 25000 batches per second will saturate (completely, on its own) a 1Ghz CPU. That means to maintain 60 ((-FPS|FPS)) on a 1Ghz CPU you cannot issue more than about 416 batches per frame, where a batch is one instance of a submesh (for example). Of course, other factors may limit your performance earlier. You can improve batching by grouping static objects together in a StaticGeometry object, or by reducing the number of submeshes you use per mesh (do you really need that many different materials per mesh?). __Why does the camera 'lurch' regularly as I move?__ * This appears to be an internal window timing issue which only happens at relatively low frame rates (<200) on D3D9 when you use windowed mode and don't use VSync. Turning on ((-VSync|VSync)), or switching to full screen (or indeed, using GL in any mode) resolves the problem, and you also won't see it at higher frame rates. If you suffer from this in windowed mode, just enable vsync to resolve the problem. In full screen you can continue to leave VSync disabled if you want. !!Exceptions and Asserts __ My Ogre application builds fine, but when I run it I get an error saying it can't find OgreMain_d.dll. Help! __ * Chances are you are running this in the debugger. How do I know? It's looking for the Debug build of the main Ogre ((-DLL|DLL)). If you are running your app in the Debugger (for instance, inside ((-VisualStudio|VisualStudio))) then you need to set the ''Working Directory'' in your project's settings (under the ''Debugging'' tab in the project property sheet) to the location where your app resides. Visual C++ defaults to the location of the .vcproj project file for its working directory when running instances in the ((-IDE|IDE)). If you are running your app outside the IDE, you need either to have the path to OgreMain_d.dll (as well as the other Ogre DLLs and plugins) in your system PATH, or move the DLLs to where your application EXE resides. + Tips for setting up ((-VisualStudio|VisualStudio)) are here: ((Visual Studio Debugging Settings)) __ Ogre Application throws Exception: ''Cannot find -Camera with name PlayerCam'' __ * This is almost a sure sign that you need to build/rebuild Ogre, probably after a ((-SVN|SVN)) update. __ Ogre is debugging with Microsoft MFC, and Ogre Memory Manager keeps reporting Leakage assert...__ * When Ogre's memory debug macro works with ((MFC|MFC's)) counterparts,they always got each other redefined. This makes OgreMemoryManager to report ''deallocate RAM that wasn't allocated by this memory manager'' -- they are allocated by MFC debug routines. One Possible solution is to remove all MFC ''*define new DEBUG_NEW'' macros from your source code. The removal does no harm to your code because the Ogre Memory Manager works just as well as the MFC Memory Manager. __ Each and every Ogre Application throws ''Run-Time Check Failure *0 - The value of ESP was not properly saved across a function call.''__ * This usually happens when rebuilding the Ogre source after a SVN update. Do a complete ''clean'' and build again. If this doesn't fix it, check that you are not loading any ''uncleaned'' addon plugins, like the DotSceneOctreeManager. Just comment it out in ''plugins.cfg''. __I get an exception from the Cg plugin about not being able to find the image when launching the SampleBrowser or my own app on Mac OS X! What image is it talking about?__ * This is actually NVIDIA's fault and seems to be something that they changed between Cg Toolkit 2.0 and 2.2. It's unclear on whether it is an intentional or accidental change. But anyways, OGRE looks for Cg.framework in the standard place which is MyApp.app/Contents/Frameworks/Cg.framework. The problem is that even if the framework is in the right place, information included in the framework when it was built says that it is somewhere else. + So if you are seeing errors like this: An exception has occurred: OGRE EXCEPTION(7:InternalErrorException): Could not load dynamic library Plugin_CgProgramManager. System Error: dlopen(//Path/To/Your/App/build/Debug/MyApp.app/Contents/Plugins/Plugin_CgProgramManager.dylib, 9): Library not loaded: @executable_path/../Library/Frameworks/Cg.framework/Cg Referenced from: /Path/To/Ogre/Source/build/bin/Debug/Plugin_CgProgramManager.dylib Reason: image not found in DynLib::load at /Path/To/Ogre/Source/OgreMain/src/OgreDynLib.cpp (line 91) + You will need to do this: + First, open Terminal.app and navigate to where your Cg framework is. Not the copy inside your application. It's possible that it could be in the Dependencies folder or /Library/Frameworks. + {MONO()}sudo install_name_tool -id @executable_path/../Frameworks/Cg.framework/Cg Cg.framework/Versions/1.0/Cg{MONO}%%%{MONO()}sudo install_name_tool -change @executable_path/../Library/Frameworks/Cg.framework/Cg{MONO} + {MONO()}@executable_path/../Frameworks/Cg.framework/Cg Cg.framework/Versions/1.0/Cg{MONO} + You will be prompted for your administrator password so that the commands can make changes to the file. Note that unless NVIDIA changes this you may need to do it again if you upgrade to future versions of the Cg Toolkit. __D3D11 device can't create shader resource view__ * Check the version of your used shader model:{QUOTE()}Direct3D 9 shaders can be designed using shader model 1, shader model 2 and shader model 3; Direct3D 10 shaders can only be designed on shader model 4. Direct3D 11 shaders can be designed on shader model 5.{QUOTE}See: [http://msdn.microsoft.com/en-us/library/windows/desktop/bb509635%28v=vs.85%29.aspx|Microsoft: Programming Guide for HLSL] !!Debug To Release __ Running application in debug mode is ok, but in release it crashes...__ * If you're compiling your app for first time in release mode since a long time, then, you might have interest in this document [http://www.flounder.com/debug_release.htm|Surviving the Release Version]. Most important thing to remember is that Debug not only adds many checks but also initialize variables, something that release mode won't do for you. The common problems which occur when switching from debug to release mode and their solutions can be found in this article: ((Heap Corruption)) !!Deployment __Can I statically link OGRE?__ * Since ((Eihort|Ogre 1.4)) static link targets are provided, see ((StaticLinking|Static Linking OGRE)) __How to deploy to Windows without an installation?__ * You'll just need to transfer your game executable and any Ogre .dlls you're using (eg RenderSystem_GL.dll), your media and config files (by default, resources.cfg and plugins.cfg) and a copy of the Ogre license although this could be done in the form of an in-game message rather than a separate text file. * If you use Visual Studio you will need to install the Visual C++ 2010 Redistributable package ([http://www.microsoft.com/en-us/download/details.aspx?id=8328|x86], [http://www.microsoft.com/en-us/download/details.aspx?id=13523|amd64]) on the target machine before you start you application. * If you use DirectX you will need to install the latest [http://www.microsoft.com/en-us/download/details.aspx?id=35|DirectX End-User Runtime] on the target machine before you start you application. Normally you don't have to install DirectX because Windows install and update DirectX with the Windows Update Service. --- Alias: (alias(CommonMistakes))
Search by Tags
Search Wiki by Freetags
Latest Changes
Ogre 2.1 FAQ
Minimal Ogre Collision
Artifex Terra
OpenMB
Advanced Mogre Framework
MogreSocks
Critter AI
Mogre Add-ons
MOGRE
Mogre MyGUI wrapper
...more
Search
Find
Advanced
Search Help
Online Users
171 online users