Ogre Version: 2.3.0
Operating System: Windows 7 x64
Render System: Direct3D11
I'm running into an issue currently where materials are not properly applying to meshes that are created manually in C++ code. The meshes themselves appear to be intact and fine, and manual meshes that use vertex colors instead of any textures or PBS material work (though it does require an unlit datablock to be present).
The datablocks themselves appear to be fine, as I can use them on a generic plane mesh (as can be seen in the background of the attached screenshot) - but when I attempt to use them on the mesh, they don't show up and one of them seems to give some sort of error:
Code: Select all
OGRE EXCEPTION(1:InvalidStateException): Renderable needs at least 2 coordinates in UV set #0. Either change the mesh, or change the UV source settings in HlmsPbs::calculateHashForPreCreate at C:\Projects\Ogre\Ogre\ogre-next\Components\Hlms\Pbs\src\OgreHlmsPbs.cpp (line 805)Not entirely sure what this means exactly - seems to suggest that the renderable (or maybe just a particular submesh) has less than 2 UV coordinates. The vertex layout gets generated at runtime based on the number of UV and color channels in the mesh - but for this particular mesh, this is the layout that it ends up using:
Code: Select all
Ogre::VertexElement2(Ogre::VertexElementType::VET_FLOAT3, Ogre::VertexElementSemantic::VES_POSITION);
Ogre::VertexElement2(Ogre::VertexElementType::VET_FLOAT3, Ogre::VertexElementSemantic::VES_TEXTURE_COORDINATES);
I've also tried applying a datablock to the Ogre::Item that the mesh gets assigned to - but it ends up spitting out the same error as before and doesn't change the appearance of the mesh at all.
The other datablocks don't log any errors - though I don't know if that's because they're "working", or if it's because it just stops trying to use any datablocks as soon as one fails.
The only other potentially relevant detail is that, at shutdown, an exception is thrown when it attempts to free vertex buffers - where it seems the data is already deleted/invalid, however this only happens if the mesh is placed in the scene. Not sure if that's related or if that's a separate issue elsewhere.
Below is an image of the mesh in-engine (and the plane that uses one of the meshes' datablocks):
Any help or clues anyone can share is greatly appreciated!


