[2.3] Overlays not rendering correctly

Problems building or running the engine, queries about how to use features etc.
Post Reply
psysu
Halfling
Posts: 72
Joined: Tue Jun 01, 2021 7:47 am
x 6

[2.3] Overlays not rendering correctly

Post by psysu »

Ogre Version: 2.3.0
Operating System: Windows 10
Render System: Direct3D 11

Hi, im using testing text overlay element in a scene. its not rendering properly, like instead of captions i get white bars in its place and all of them are rendering in 3D.

like here :
Image

here how i initialize overlay system and created overlay elements.

Setting up Overlay System:

Code: Select all

{
	/** 
	* Root instance creation and getting the RenderSystem through config dialog
	*/
	m_pOverlaySystem = OGRE_NEW Ogre::v1::OverlaySystem();
        m_upRoot->initialise( false, m_upWindow->GetWindowTitle() );

    CreateRenderWindow();
    SetupResources();
    LoadResources();
    CreateSceneManager();
    SetupOverlaySystem();
    CreateCamera();
    SetupCompositor();
}

void SetupOverlaySystem()
{
	m_pSceneManager->addRenderQueueListener(m_pOverlaySystem);
        m_pSceneManager->getRenderQueue()->setSortRenderQueue(
            Ogre::v1::OverlayManager::getSingleton().mDefaultRenderQueueId,
            Ogre::RenderQueue::StableSort
        );
}

Creating Overlay Elements:

Code: Select all

	auto* overlay_manager = v1::OverlayManager::getSingletonPtr();
        auto* overlay = overlay_manager->create("Test_Overlay");
        
auto* panel = static_cast<Ogre::v1::PanelOverlayElement*>( overlay_manager->createOverlayElement("Panel", "Test Panel") ); panel->setMetricsMode(Ogre::v1::GuiMetricsMode::GMM_RELATIVE); panel->setPosition(0.35, 0.2); panel->setDimensions( 0.35, 0.35 ); auto textarea_element = [&overlay_manager]( const std::string& instance_name, const sample::utils::vec2f& position, const float& char_height, const std::string& caption) -> Ogre::v1::TextAreaOverlayElement* { auto textarea = static_cast<Ogre::v1::TextAreaOverlayElement*>( overlay_manager->createOverlayElement("TextArea", instance_name) ); textarea->setMetricsMode(Ogre::v1::GuiMetricsMode::GMM_RELATIVE); const auto& [pos_x, pos_y] = position; textarea->setPosition( pos_x, pos_y ); textarea->setCharHeight(char_height); textarea->setFontName( "DebugFont" ); textarea->setCaption(caption); return textarea; }; auto caption_1 = "hello this is an text area element"; auto caption_2 = "This is to test multiple text area elements in a container"; auto char_height = 0.03f; auto textarea_1 = textarea_element( "DebugTextArea_1", {0.0, 0.0}, char_height, caption_1 ); auto textarea_2 = textarea_element( "DebugTextArea_2", {0.0, 0.2}, char_height, caption_2 ); panel->addChild(textarea_1); panel->addChild(textarea_2); overlay->add2D(panel); overlay->show();

Here's the Ogre log:

Code: Select all

Creating resource group General
Creating resource group Internal
Creating resource group Autodetect
SceneManagerFactory for type 'DefaultSceneManager' registered.
Registering ResourceManager for type Material
Registering ResourceManager for type Mesh
Registering ResourceManager for type Mesh2
Registering ResourceManager for type OldSkeleton
MovableObjectFactory for type 'ParticleSystem' registered.
ArchiveFactory for archive type FileSystem registered.
ArchiveFactory for archive type Zip registered.
ArchiveFactory for archive type EmbeddedZip registered.
DDS codec registering
FreeImage version: 3.15.3
This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
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,pfm,pct,pict,pic
ETC codec registering
OITD codec registering
Registering ResourceManager for type HighLevelGpuProgram
MovableObjectFactory for type 'Decal' registered.
MovableObjectFactory for type 'InternalCubemapProbe' registered.
MovableObjectFactory for type 'Entity' registered.
MovableObjectFactory for type 'Item' registered.
MovableObjectFactory for type 'Light' registered.
MovableObjectFactory for type 'Rectangle2Dv2' registered.
MovableObjectFactory for type 'BillboardSet' registered.
MovableObjectFactory for type 'ManualObject2' registered.
MovableObjectFactory for type 'BillboardChain' registered.
MovableObjectFactory for type 'RibbonTrail' registered.
MovableObjectFactory for type 'WireAabb' registered.
Loading library Plugins\RenderSystem_Direct3D11_d
Installing plugin: D3D11 RenderSystem
D3D11: Direct3D11 Rendering Subsystem created.
D3D11: Driver Detection Starts
D3D11: "AMD Radeon(TM) Graphics"
D3D11: "NVIDIA GeForce RTX 3050 Laptop GPU"
D3D11: "Microsoft Basic Render Driver (software)"
D3D11: Driver Detection Ends
Plugin successfully installed
Loading library Plugins\RenderSystem_GL3Plus_d
Installing plugin: GL 3+ RenderSystem
OpenGL 3+ Rendering Subsystem created.
Plugin successfully installed
*-*-* OGRE Initialising
*-*-* Version 2.3.0 (Daedalus)
D3D11: RenderSystem Option: sRGB Gamma Conversion = Yes
D3D11: RenderSystem Option: Rendering Device = (default)
D3D11: RenderSystem Option: Allow NVPerfHUD = No
D3D11: RenderSystem Option: Backbuffer Count = Auto
D3D11: RenderSystem Option: Driver type = Hardware
D3D11: RenderSystem Option: FSAA = 1x MSAA
D3D11: RenderSystem Option: Fast Shader Build Hack = Yes
D3D11: RenderSystem Option: Floating-point mode = Fastest
D3D11: RenderSystem Option: Full Screen = No
D3D11: RenderSystem Option: Information Queue Exceptions Bottom Level = Info (exception on any message)
D3D11: RenderSystem Option: Max Requested Feature Levels = 11.1
D3D11: RenderSystem Option: Min Requested Feature Levels = 9.1
D3D11: RenderSystem Option: VSync = No
D3D11: RenderSystem Option: VSync Interval = 1
D3D11: RenderSystem Option: Vendor Extensions = Auto
D3D11: RenderSystem Option: Video Mode = 1024 x 768 @ 32-bit colour
D3D11: RenderSystem Option: sRGB Gamma Conversion = Yes
OverlayElementFactory for type Panel registered.
OverlayElementFactory for type BorderPanel registered.
OverlayElementFactory for type TextArea registered.
Registering ResourceManager for type Font
CPU Identifier & Features
-------------------------
 *   CPU ID: AuthenticAMD: AMD Ryzen 7 5800HS with Radeon Graphics
 *   Logical cores: 16
 *      SSE: yes
 *     SSE2: yes
 *     SSE3: yes
 *      MMX: yes
 *   MMXEXT: yes
 *    3DNOW: no
 * 3DNOWEXT: no
 *     CMOV: yes
 *      TSC: yes
 *      FPU: yes
 *      PRO: yes
 *       HT: no
-------------------------
D3D11: Subsystem Initialising
D3D11: Driver Detection Starts
D3D11: "AMD Radeon(TM) Graphics"
D3D11: "NVIDIA GeForce RTX 3050 Laptop GPU"
D3D11: "Microsoft Basic Render Driver (software)"
D3D11: Driver Detection Ends
D3D11: Requested "(default)", selected "AMD Radeon(TM) Graphics"
D3D11: Device Feature Level 11.1
***************************************
*** D3D11: Subsystem Initialized OK ***
***************************************
D3D11RenderSystem::_createRenderWindow "OverlayTest", 1024x768 windowed  miscParams: FSAA=1x MSAA externalWindowHandle=26807160 gamma=Yes title=OverlayTest vsync=No
Registering ResourceManager for type GpuProgram
RenderSystem capabilities
-------------------------
RenderSystem Name: Direct3D11 Rendering Subsystem
GPU Vendor: amd
Device Name: AMD Radeon(TM) Graphics
Driver Version: 30.0.13002.1001
 * Fixed function pipeline: no
 * Hardware generation of mipmaps: yes
 * Texture blending: yes
 * Anisotropic texture filtering: yes
 * Dot product texture operation: yes
 * Cube mapping: yes
 * Hardware stencil buffer: yes
   - Stencil depth: 8
   - Two sided stencil support: yes
   - Wrap stencil values: yes
 * Hardware vertex / index buffers: yes
 * 32-bit index buffers: yes
 * Vertex programs: yes
 * Number of floating-point constants for vertex programs: 512
 * Number of integer constants for vertex programs: 16
 * Number of boolean constants for vertex programs: 16
 * Fragment programs: yes
 * Number of floating-point constants for fragment programs: 512
 * Number of integer constants for fragment programs: 16
 * Number of boolean constants for fragment programs: 16
 * Geometry programs: yes
 * Number of floating-point constants for geometry programs: 512
 * Number of integer constants for geometry programs: 16
 * Number of boolean constants for geometry programs: 16
 * Tessellation Hull programs: yes
 * Number of floating-point constants for tessellation hull programs: 512
 * Number of integer constants for tessellation hull programs: 16
 * Number of boolean constants for tessellation hull programs: 16
 * Tessellation Domain programs: yes
 * Number of floating-point constants for tessellation domain programs: 512
 * Number of integer constants for tessellation domain programs: 16
 * Number of boolean constants for tessellation domain programs: 16
 * Compute programs: yes
 * Number of floating-point constants for compute programs: 512
 * Number of integer constants for compute programs: 16
 * Number of boolean constants for compute programs: 16
 * Supported Shader Profiles: cs_5_0 ds_5_0 gs_4_0 gs_4_1 gs_5_0 hlsl hs_5_0 ps_4_0 ps_4_0_level_9_1 ps_4_0_level_9_3 ps_4_1 ps_5_0 vs_4_0 vs_4_0_level_9_1 vs_4_0_level_9_3 vs_4_1 vs_5_0
 * Texture Compression: yes
   - DXT: yes
   - VTC: no
   - PVRTC: no
   - ATC: no
   - ETC1: no
   - ETC2: no
   - BC4/BC5: yes
   - BC6H/BC7: yes
   - ASTC: no
 * Hardware Occlusion Query: yes
 * User clip planes: yes
 * VET_UBYTE4 vertex element type: yes
 * Infinite far plane projection: yes
 * Hardware render-to-texture: yes
 * Floating point textures: yes
 * Non-power-of-two textures: yes
 * 1d textures: yes
 * Volume textures: yes
 * Max Texture resolution (2D) 16384
 * Max Texture resolution (3D) 2048
 * Max Texture resolution (Cubemaps) 16384
 * Multiple Render Targets: 8
   - With different bit depths: yes
 * Point Sprites: yes
 * Extended point parameters: yes
 * Max Point Size: 256
 * Vertex texture fetch: yes
 * Number of world matrices: 0
 * Number of texture units: 16
 * Stencil buffer depth: 8
 * Number of vertex blend matrices: 0
   - Max vertex textures: 4
   - Vertex textures shared: no
 * Render to Vertex Buffer : yes
 * Hardware Atomic Counters: no
 * Compute max threads per threadgroup per axis: 1024, 1024, 64
 * Compute max threads per threadgroup total: 1024
 * Using Reverse Z: yes
DefaultWorkQueue('Root') initialising on thread main.
Particle Renderer Type 'billboard' registered
Creating resource group Essential
Added resource location '../Data/Packs/DebugPack.zip' of type 'Zip' to resource group 'Essential'
Creating resource group Popular
Added resource location '../Data' of type 'FileSystem' to resource group 'Popular'
Added resource location '../Data/Models' of type 'FileSystem' to resource group 'Popular'
Added resource location '../Data/2.0/scripts/materials/PbsMaterials' of type 'FileSystem' to resource group 'General'
Parsing scripts for resource group Autodetect
Finished parsing scripts for resource group Autodetect
Creating resources for group Autodetect
All done
Parsing scripts for resource group Essential
Parsing script Materials.material
Parsing script DebugFont.fontdef
Finished parsing scripts for resource group Essential
Creating resources for group Essential
All done
Parsing scripts for resource group General
Finished parsing scripts for resource group General
Creating resources for group General
All done
Parsing scripts for resource group Internal
Finished parsing scripts for resource group Internal
Creating resources for group Internal
All done
Parsing scripts for resource group Popular
Finished parsing scripts for resource group Popular
Creating resources for group Popular
All done
Font DebugFont using texture size 512x512
Info: Freetype returned null for character 127 in font DebugFont
Info: Freetype returned null for character 128 in font DebugFont
Info: Freetype returned null for character 129 in font DebugFont
Info: Freetype returned null for character 130 in font DebugFont
Info: Freetype returned null for character 131 in font DebugFont
Info: Freetype returned null for character 132 in font DebugFont
Info: Freetype returned null for character 133 in font DebugFont
Info: Freetype returned null for character 134 in font DebugFont
Info: Freetype returned null for character 135 in font DebugFont
Info: Freetype returned null for character 136 in font DebugFont
Info: Freetype returned null for character 137 in font DebugFont
Info: Freetype returned null for character 138 in font DebugFont
Info: Freetype returned null for character 139 in font DebugFont
Info: Freetype returned null for character 140 in font DebugFont
Info: Freetype returned null for character 141 in font DebugFont
Info: Freetype returned null for character 142 in font DebugFont
Info: Freetype returned null for character 143 in font DebugFont
Info: Freetype returned null for character 144 in font DebugFont
Info: Freetype returned null for character 145 in font DebugFont
Info: Freetype returned null for character 146 in font DebugFont
Info: Freetype returned null for character 147 in font DebugFont
Info: Freetype returned null for character 148 in font DebugFont
Info: Freetype returned null for character 149 in font DebugFont
Info: Freetype returned null for character 150 in font DebugFont
Info: Freetype returned null for character 151 in font DebugFont
Info: Freetype returned null for character 152 in font DebugFont
Info: Freetype returned null for character 153 in font DebugFont
Info: Freetype returned null for character 154 in font DebugFont
Info: Freetype returned null for character 155 in font DebugFont
Info: Freetype returned null for character 156 in font DebugFont
Info: Freetype returned null for character 157 in font DebugFont
Info: Freetype returned null for character 158 in font DebugFont
Info: Freetype returned null for character 159 in font DebugFont
Info: Freetype returned null for character 160 in font DebugFont
Invalid parameter at line 418 (@foreach). 'first_valid_detail_map_nm' is not a number nor a variable
Invalid parameter at line 466 (@foreach). 'hlms_lights_directional' is not a number nor a variable
Invalid parameter at line 473 (@foreach). 'hlms_lights_directional_non_caster' is not a number nor a variable
Invalid parameter at line 481 (@foreach). 'hlms_lights_point' is not a number nor a variable
DefaultWorkQueue('Root') shutting down on thread main.
*-*-* OGRE Shutdown
Unregistering ResourceManager for type OldSkeleton
Unregistering ResourceManager for type Mesh2
Unregistering ResourceManager for type Mesh
Unregistering ResourceManager for type Material
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.3] Overlays not rendering correctly

Post by dark_sylinc »

Don't create m_pOverlaySystem before m_upRoot->initialise.
It needs to be done after the first m_upRoot->createRenderWindow call (see Samples/2.0/Common/src/GraphicsSystem.cpp).

As for the rest, I don't know what's the exact cause unless initialization order was the cause.
It sounds like the overlays are using Pbs materials instead of Unlit.

These errors:

Invalid parameter at line 418 (@foreach). 'first_valid_detail_map_nm' is not a number nor a variable
Invalid parameter at line 466 (@foreach). 'hlms_lights_directional' is not a number nor a variable
Invalid parameter at line 473 (@foreach). 'hlms_lights_directional_non_caster' is not a number nor a variable
Invalid parameter at line 481 (@foreach). 'hlms_lights_point' is not a number nor a variable

Are highly suspicious because they indicate an error in how your Hlms is setup, more specifically the Samples/Media/Hlms folder is being improperly loaded or has been corrupted with wrong files (e.g. left over from 2.2 installation?).

Update: Oh I also forgot. See if Colibri is a better fit for your needs. Overlays are no longer maintained and cause a few problems due to their v1 interface.

psysu
Halfling
Posts: 72
Joined: Tue Jun 01, 2021 7:47 am
x 6

Re: [2.3] Overlays not rendering correctly

Post by psysu »

Found the Issue!!! while registering HlmsUnlit, instead of giving default paths of HlmsUnlit, i had given default paths of HlmsPbs. now the overlays are working properly

Post Reply