Mixing Texture Creation Compositor & TextureManager

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
ChristophLGDV
Gnoblar
Posts: 18
Joined: Mon Jun 01, 2015 3:09 pm

Mixing Texture Creation Compositor & TextureManager

Post by ChristophLGDV »

Hi, first of I am composing my first Compositor :)

I want to implement some temporal anti-aliasing using color, depth and history textures.

The idea is as follows:

I have two historyMaps, one to read from, one to write to.
Both are to be swapped after every render pass, from the "outside".

The important bit is that I want to define the history map outside of the compositor via Ogres TextureManager:
Or rather I need the texture after the rendering is done.

Code: Select all

mHistoryTexture[0] = Ogre::TextureManager::getSingleton().createManual(
				"???historyMap???", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
				Ogre::TEX_TYPE_2D, recommendedTexSize[EYE::LEFT].w, recommendedTexSize[EYE::LEFT].h, 0, Ogre::PF_R8G8B8A8,
				Ogre::TU_RENDERTARGET );
I know how to add textures to a materials textureunit state but not much more.
I guess the key phrase is: adding manual textures to a compositor.


Down below is my compositor.

I would appreciate some help on this matter, there is probably an answer to this I have not yet found.

Thanks for reading.

Code: Select all

compositor TXAA
{
	technique
	{
		texture colorDepthMRT target_width target_height  PF_R8G8B8A8 PF_FLOAT32_R
		texture historyMap target_width target_height  PF_R8G8B8A8
	
		target colorDepthMRT
		{
			input previous
		}
		target_output
		{
			render_quad
			{
				material TXAA
				input 0 colorDepthMRT 0
				input 1 colorDepthMRT 1
				input 2 historyMap 0
			}
		}		
	}
}
Last edited by ChristophLGDV on Mon Jun 08, 2015 7:13 am, edited 1 time in total.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5514
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1379

Re: Mixing Texture Creation Compositor & TextureManager

Post by dark_sylinc »

ChristophLGDV wrote:I know how to add textures to a materials textureunit state but not much more.
Just set the material's texture name in the texture unit as the same as the manual texture you create; and ensure the manual texture is created before the material is loaded.

Otherwise you can set the TU's texture via material->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTexture. (note you should check the technique, pass & TU index exist unless you're sure they will.
ChristophLGDV
Gnoblar
Posts: 18
Joined: Mon Jun 01, 2015 3:09 pm

Re: Mixing Texture Creation Compositor & TextureManager

Post by ChristophLGDV »

Hello dark_sylinc,

thank you for your quick reply.

Does that mean that I can ignore the additional texture in the compositor and add as many manual textures to the material as I wish?