Porting Gorilla

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
User avatar
Thyrion
Goblin
Posts: 224
Joined: Wed Jul 31, 2013 1:58 pm
Location: germany
x 8

Re: Porting Gorilla

Post by Thyrion »

what rendersystem do you use? just to be sure. font 40 exists in your gorilla file?

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1147
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 166

Re: Porting Gorilla

Post by xrgo »

OgreGLRenderSystem
yes font 40 does exists =)
thank!

User avatar
Thyrion
Goblin
Posts: 224
Joined: Wed Jul 31, 2013 1:58 pm
Location: germany
x 8

Re: Porting Gorilla

Post by Thyrion »

i am using directx 11 currently and it works.
i think november's version should work, because he showed a working example vid :) but i didn't tried his version.
if i would have this problem, i would set a breakpoint in void Screen::renderQueueEnded( ... and would look if the caption is realy in the rendered layers.
i don't think there is a problem with opengl renderer, else november had said something?

tried to render a rectangle with background?

N0vember
Gremlin
Posts: 196
Joined: Tue Jan 27, 2009 12:27 am
x 24

Re: Porting Gorilla

Post by N0vember »

Well Ogre 2.0 won't render anything if you didn't create a Workspace.
Did you set one up ? If not how was the viewport created ? That's the code I would look at.
Also you don't even have to bother with viewports if you're going to render to the whole screen, just pass the window RenderTarget to gorilla.
(Actually I'm thinking this may be the reason, if you did setup a Workspace, try replacing the viewport with the renderwindow itself to see if that makes a difference)

Example :

Code: Select all

	Ogre::CompositorManager2* compositorManager = ogreRoot->getCompositorManager2();
		compositorManager->createBasicWorkspaceDef("Basic Workspace", Ogre::ColourValue::Black);

		compositorManager->addWorkspace(sceneManager, renderWindow, camera, "Basic Workspace", true);

		silverback->createScreen(sceneManager, renderWindow, "uiatlas"); // Pass the Ogre::RenderWindow here 

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1147
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 166

Re: Porting Gorilla

Post by xrgo »

Thank you very much for your response!
It actually works now! (maybe has been working all the time) but... only when using "createBasicWorkspaceDef", the problem is that I am using a workspace defined in a script file, and I am adding it like this:
compositorManager->addWorkspace( sceneManager, renderWindow, mainCamera, "Workspace", true );
and I can see all my objects ok

this is my workspace:

Code: Select all

compositor_node mainRenderNode
{
	texture mrt target_width target_height PF_R8G8B8 PF_R8G8B8

	target mrt
	{
		pass clear
		{
			colour_value 0 0 0 1
		}
		pass render_scene
		{
			//shadows ShadowNode
			rq_first 0
			rq_last max
		}
	}

	out 0 mrt	
}

compositor_node FinalCompositionNode
{
	in 0 finalRender
	in 1 toRenderWindow

	target toRenderWindow
	{
		pass clear
		{
		}
		pass render_quad
		{
			material ByPassMat //just copy eveything
			input 0 finalRender
		}
	}
}

workspace Workspace
{
	connect mainRenderNode 0 FinalCompositionNode 0
	connect_output FinalCompositionNode 1 
}
I am doing some post process effects in between, they work, I just removed them for now to test

Thanks for everything!

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1147
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 166

Re: Porting Gorilla

Post by xrgo »

Hi! I managed to make it work by changing this:

Code: Select all

    void Screen::renderQueueEnded(Ogre::uint8 queueGroupId, const Ogre::String& invocation, bool& repeatThisInvocation)
    {
        if(queueGroupId == Ogre::RENDER_QUEUE_OVERLAY &&  mRenderSystem->_getViewport() == mViewport->getViewport(1) && mRenderSystem->_getViewport()->getOverlaysEnabled()){
            if(mIsVisible && mLayers.size()){
                renderOnce();
            }
        }
    }
to this:

Code: Select all

    void Screen::renderQueueEnded(Ogre::uint8 queueGroupId, const Ogre::String& invocation, bool& repeatThisInvocation)
    {
        if(queueGroupId == Ogre::RENDER_QUEUE_OVERLAY && mRenderSystem->_getViewport()->getOverlaysEnabled()){
            if(mIsVisible && mLayers.size()){
                renderOnce();
            }
        }
    }
the bad thing is that I am getting post process effects on top of gorilla, maybe I have to create a different compositor pass or something. but its good enough for now since I am just using it for simple stuffs

thank you very much for the help!

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1147
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 166

Re: Porting Gorilla

Post by xrgo »

WTF, I just updated ogre (hg pull && hg update v2-0-0RC1) build it again... and now my Gorilla stuffs looks like this xD

Image

I made a sky, the sun and the moon are a texture in a plane, and when either of those appears on the screen those gorilla "letters" actually disappear

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1147
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 166

Re: Porting Gorilla

Post by xrgo »

its fixed now, I just re-estructured my project files/folders and now works again, I dont know why that happpend :S

User avatar
c6burns
Beholder
Posts: 1511
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 134

Re: Porting Gorilla

Post by c6burns »

xrgo wrote:its fixed now, I just re-estructured my project files/folders and now works again, I dont know why that happpend :S
Obv it was a signal from aliens ... Jodie Foster and Matt McConaughey have been dispatched to your house to debate the scientific and religious implications respectively. John Hurt is standing by from orbit!

User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56
Contact:

Re: Porting Gorilla

Post by Klaim »

Maybe you tried to parse HTML using regex?

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1147
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 166

Re: Porting Gorilla

Post by xrgo »

c6burns wrote:
xrgo wrote:its fixed now, I just re-estructured my project files/folders and now works again, I dont know why that happpend :S
Obv it was a signal from aliens ... Jodie Foster and Matt McConaughey have been dispatched to your house to debate the scientific and religious implications respectively. John Hurt is standing by from orbit!
Image

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1147
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 166

Re: Porting Gorilla

Post by xrgo »

Anyone got this working with Ogre 2.1?
I have the materials with shaders
I noticed that Screen::renderQueueEnded is not getting called

User avatar
AlexeyKnyshev
Goblin
Posts: 213
Joined: Sat May 26, 2012 10:37 am
Location: Russia
x 13

Re: Porting Gorilla

Post by AlexeyKnyshev »

Please, create pull requests into git repository as soon as you have a progress in your development. Community is interested in Ogre 2.x port of Gorilla.

Regards, Alexey Knyshev
Voltage Engine - boost your ogre project with realtime physics and interactive scripting!
OgreBullet & CMake - easy to use bullet physics integration.

User avatar
Thyrion
Goblin
Posts: 224
Joined: Wed Jul 31, 2013 1:58 pm
Location: germany
x 8

Re: Porting Gorilla

Post by Thyrion »

Shouldn't that make the 2d material transparent?
old from working 2.0:
pass->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
new in 2.1:

Code: Select all

  d2Material = Ogre::MaterialManager::getSingletonPtr()->create("Gorilla2D", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
  Ogre::Pass* pass = d2Material->getTechnique(0)->getPass(0);
  Ogre::HlmsBlendblock transparent;
  Ogre::Pass::_getBlendFlags(Ogre::SceneBlendType::SBT_TRANSPARENT_ALPHA,
	  transparent.mSourceBlendFactor,
	  transparent.mDestBlendFactor);
  pass->setBlendblock(transparent);
  Ogre::TextureUnitState* texUnit = pass->createTextureUnitState();
  texUnit->setTextureAddressingMode(Ogre::TextureUnitState::TAM_CLAMP);
  texUnit->setTextureFiltering(Ogre::FO_NONE, Ogre::FO_NONE, Ogre::FO_NONE);
The bitmapfonts still having the black background.
Attachments
gorilla.png
gorilla.png (3.01 KiB) Viewed 2788 times

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1147
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 166

Re: Porting Gorilla

Post by xrgo »

Thyrion wrote:The bitmapfonts still having the black background.
I guess youre lacking of:

Code: Select all

  Ogre::Pass::_getBlendFlags(Ogre::SBT_TRANSPARENT_ALPHA,
     transparent.mSourceBlendFactorAlpha,
     transparent.mDestBlendFactorAlpha);
mmm... but I tested this in another material and its not working either, it works with every other SceneBlendType but no SBT_TRANSPARENT_ALPHA... but I just started to investigate =)

Can you share your code?

User avatar
Thyrion
Goblin
Posts: 224
Joined: Wed Jul 31, 2013 1:58 pm
Location: germany
x 8

Re: Porting Gorilla

Post by Thyrion »

Can you share your code?
what code? i thought i did that in my last post :)

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1147
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 166

Re: Porting Gorilla

Post by xrgo »

Thyrion wrote:
Can you share your code?
what code? i thought i did that in my last post :)
ahaha yes, but in 2.1 I cant see anything on my screen yet, I thought you made something different for 2.1
Screen::renderQueueEnded its not being called =(

User avatar
Thyrion
Goblin
Posts: 224
Joined: Wed Jul 31, 2013 1:58 pm
Location: germany
x 8

Re: Porting Gorilla

Post by Thyrion »

ahaha yes, but in 2.1 I cant see anything on my screen yet, I thought you made something different for 2.1
i just used the code from the mygui port from scrawl.
http://www.ogre3d.org/addonforums/viewt ... 17&t=30366
https://github.com/MyGUI/mygui/commit/8 ... f5574f934c
i picked out the compositorprovider.

Code: Select all

Ogre::IdString OgreCompositorPassProvider::mPassId = Ogre::IdString("MYGUI");

	MyGUIPass::MyGUIPass(const Ogre::CompositorPassDef *definition, const Ogre::CompositorChannel &target,
		Ogre::CompositorNode *parentNode, GraphicsManager& graphicsMgr)
		: Ogre::CompositorPass(definition, target, parentNode) ,m_GraphicsManager(graphicsMgr)
	{}

	void MyGUIPass::execute(const Ogre::Camera *lodCameraconst)
	{
	//here i call the gorilla renderonce method from the screen .. had to make it public
	//m_GraphicsManager.getGUIRenderer()._t_update();
	}

	m_compositorManager->setCompositorPassProvider(mPassProvider.get());

//--->>> added this pass to the CompositorTargetDef like in mygui
	// For the MyGUI pass
	targetDef->addPass(Ogre::PASS_CUSTOM, OgreCompositorPassProvider::mPassId);
and in the gorilla code the pass seems not to work correctly now:
in the function:

Code: Select all

 Ogre::MaterialPtr TextureAtlas::createOrGet2DMasterMaterial()

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1147
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 166

Re: Porting Gorilla

Post by xrgo »

Thank you! did you solve the transparency issue?

I am having the same problem even with other materials, SBT_TRANSPARENT_ALPHA dont work, but SBT_ADD, SBT_MODULATE, etc they do.
I cant make transparent objects =(, I guess its the same issue you're having

This is my code, in this case pbs:

Code: Select all

    Ogre::HlmsManager *hlmsManager = Ogre::Root::getSingletonPtr()->getHlmsManager();
    Ogre::HlmsTextureManager *hlmsTextureManager = hlmsManager->getTextureManager();

    Ogre::HlmsBlendblock blendBlock;
    Ogre::HlmsMacroblock macroBlock;
    macroBlock.mDepthWrite = false;
    blendBlock.setBlendType(Ogre::SBT_TRANSPARENT_ALPHA,Ogre::SBT_TRANSPARENT_ALPHA);

    Ogre::String datablockName = "transparentMatTest";
    Ogre::HlmsPbsDatablock *datablock = static_cast<Ogre::HlmsPbsDatablock*>(
                hlmsPbs->createDatablock( datablockName,
                                          datablockName,
                                          macroBlock,
                                          blendBlock,
                                          Ogre::HlmsParamVec() ) );

    Ogre::HlmsTextureManager::TextureLocation texLocation = hlmsTextureManager->createOrRetrieveTexture( "textureWithAlpha.png", Ogre::HlmsTextureManager::TEXTURE_TYPE_DIFFUSE );
    datablock->setTexture( Ogre::PBSM_DIFFUSE, texLocation.xIdx, texLocation.texture );

    item->setDatablock(datablock);

User avatar
Thyrion
Goblin
Posts: 224
Joined: Wed Jul 31, 2013 1:58 pm
Location: germany
x 8

Re: Porting Gorilla

Post by Thyrion »

did you solve the transparency issue?
nope. i have no clue :( i think it's just not ready ?...

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4501
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 936
Contact:

Re: Porting Gorilla

Post by dark_sylinc »

Thyrion wrote:
did you solve the transparency issue?
nope. i have no clue :( i think it's just not ready ?...
I don't know why is not working with you.
If transparent modes wouldn't be working, text rendering wouldn't work; and other UI code we have in an client engine wouldn't work either.

User avatar
Thyrion
Goblin
Posts: 224
Joined: Wed Jul 31, 2013 1:58 pm
Location: germany
x 8

Re: Porting Gorilla

Post by Thyrion »

Thx for the answer. At least i know now it should work.
Will try it again tonight. Maybe i find the solution in the Font.cpp file. :)

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4501
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 936
Contact:

Re: Porting Gorilla

Post by dark_sylinc »

Thyrion wrote:Thx for the answer. At least i know now it should work.
Will try it again tonight. Maybe i find the solution in the Font.cpp file. :)
You want to look for Font::loadImpl()

Also load Samples\Media\packs\OgreCore.zip and checkout HlmsTranslator::translate (remember the old gui widgets before SampleBrowser took over?) to see how they are getting parsed. They work as well.

N0vember
Gremlin
Posts: 196
Joined: Tue Jan 27, 2009 12:27 am
x 24

Re: Porting Gorilla

Post by N0vember »

YEEEES

I got it to work :)

So it seems... When manually rendering with a RenderOp. (Which is the way Gorilla draws stuff for now)
- The scene blend parameter specified in the v1 material script does nothing at all.
- Setting the blendblock on the v1 material doesn't actually do anything at all.
- But setting the blendblock manually on the rendersystem before calling _render works.

Mattias, would that be a bug ? I'm a bit lost here but it feels a bit like something in the old materials got broken and no one noticed because Hlms is the way forward.
Or is it a side-effect of drawing manually with a material which is just not supposed to work anymore ?

It's different from how the Overlay are drawn with transparency, because they use Hlms, and here we are not using Hlms at all.

The drawing code was like this :

Code: Select all

mSceneMgr->_setPass(mPass);
mRenderSystem->_render(mRenderOp);
Now to render with the material transparency you have to do like this :

Code: Select all

mSceneMgr->_setPass(mPass);
mRenderSystem->_setHlmsBlendblock(mPass->getBlendblock());
mRenderSystem->_render(mRenderOp);
Shouldn't that have been handled by SceneManager::_setPass or RenderSystem::_render ?

User avatar
Thyrion
Goblin
Posts: 224
Joined: Wed Jul 31, 2013 1:58 pm
Location: germany
x 8

Re: Porting Gorilla

Post by Thyrion »

lol nice (Your're the man! :) ). It works realy ... just one line of code is needed O.o
Already startet to convert the v1 namespaces XD.
  • VertexElement -> VertexElement2
  • RenderOperation-> VertexArrayObject
  • HardwareBufferManager-> VaoManager

Post Reply