Page 1 of 1

C++ debug material with vertex color

Posted: Thu Dec 04, 2025 5:13 pm
by slapin

Hi, all!
I need to produce various debug geometry using ManualObject. For that I need vertex-color only material generated in C++,
which should be seen on top of everything ignoring depth and render ordering. How can I do this? Or maybe there is existing embedded one?
My last attempt is not quite adequate...

Code: Select all

Ogre::MaterialPtr
createVertexColorNoDepthMaterial(const std::string &materialName)
{
	Ogre::MaterialPtr material =
		Ogre::MaterialManager::getSingleton().create(
			materialName,
			Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);

Ogre::Pass *pass = material->getTechnique(0)->getPass(0);
pass->setLightingEnabled(false);
pass->setCullingMode(Ogre::CULL_NONE);
pass->setVertexColourTracking(Ogre::TVC_DIFFUSE | Ogre::TVC_AMBIENT |
			      Ogre::TVC_SPECULAR);
// pass->setDepthCheckEnabled(true);
 pass->setDepthCheckEnabled(false);
// pass->setDepthWriteEnabled(false);
pass->setDepthWriteEnabled(false);
material->load();
return material;
}

The problem it is both occluded by everything and still affected by other objects :(
The color works but it is not the color I thought it would be... would be nice to make it finally work...
@paroj sorry to bother but I struggle with this one for a long time :(


Re: C++ debug material with vertex color

Posted: Thu Dec 04, 2025 6:36 pm
by paroj

follow the DebugDrawer and put it on RENDER_QUEUE_OVERLAY for good measure.
https://github.com/OGRECave/ogre/blob/a ... er.cpp#L50


Re: C++ debug material with vertex color

Posted: Fri Dec 05, 2025 11:48 am
by slapin

Could you please elaborate about RENDER_QUEUE_OVERLAY?


Re: C++ debug material with vertex color

Posted: Fri Dec 05, 2025 3:26 pm
by paroj

Re: C++ debug material with vertex color

Posted: Sat Dec 06, 2025 10:20 pm
by slapin

Thanks a lot!