[Solved] Customize HLMS Unlit w piece

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
mmixLinus
Silver Sponsor
Silver Sponsor
Posts: 199
Joined: Thu Apr 21, 2011 3:08 pm
Location: Lund, Sweden
x 12
Contact:

[Solved] Customize HLMS Unlit w piece

Post by mmixLinus »

Hi,

[TL;DR Can I make my own custom Unlit (with pieces), and still let "the system" (material scripts) see vanilla Unlit? How? ]

As mentioned, I am porting a small project from 1.10 to 2.1. The project wants to display a "POINT_LIST" using the Unlit shader template.

Problem: Because I want to send additional data to the vertex shader, I am adding a piece file (under "/Stars/") to the system, so that when I load Unlit

Code: Select all

		Ogre::Archive *customLibrary = Ogre::ArchiveManager::getSingletonPtr()->load(
			dataFolder + "Hlms/Stars/" + shaderSyntax,
			"FileSystem", true);


		Ogre::Archive *archiveLibrary = Ogre::ArchiveManager::getSingletonPtr()->load(
			dataFolder + "Hlms/Common/" + shaderSyntax,
			"FileSystem", true);

		Ogre::ArchiveVec library;
		library.push_back(customLibrary);
		library.push_back(archiveLibrary);


		// ******************
		// ** UNLIT SHADER **
		// ******************
		Ogre::Archive *archiveUnlit = Ogre::ArchiveManager::getSingletonPtr()->load(
			dataFolder + "Hlms/Unlit/" + shaderSyntax,
			"FileSystem", true);

		Ogre::HlmsUnlit *hlmsUnlit = OGRE_NEW Ogre::HlmsUnlit(archiveUnlit, &library);
		Ogre::Root::getSingleton().getHlmsManager()->registerHlms(hlmsUnlit);
I have added my parameters to VS_INPUT. However, I am also (temporarily I suppose) using Overlays to display some sort of UI. The materials used for the overlays are defined in a .material file, and based on Unlit. Unfortunately it seems that my customization piece file is redefining Unlit even for these materials, causing a clash between my input semantics and those implied by the .material-script materials.

Example material in OgreCore.zip

Code: Select all

hlms Core/OgreText unlit : BaseSettingsAlphaBlend
{
	diffuse_map ogretext.png
}
Q: Can I make my own custom Unlit (with pieces), and still let "the system" (material scripts) see vanilla Unlit? How?

Thanks!
Powered by Ogre3D:
MMiX.Me 3D - 3D Music Player
Galaxy Navigator 3D - 2 million stars (ESA's Gaia satellite)
YouTube|Facebook
User avatar
mmixLinus
Silver Sponsor
Silver Sponsor
Posts: 199
Joined: Thu Apr 21, 2011 3:08 pm
Location: Lund, Sweden
x 12
Contact:

Re: [Solved] Customize HLMS Unlit w piece

Post by mmixLinus »

Powered by Ogre3D:
MMiX.Me 3D - 3D Music Player
Galaxy Navigator 3D - 2 million stars (ESA's Gaia satellite)
YouTube|Facebook
Post Reply