[SOLVED][Ogre 2.0] how to set pass material scheme?

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
Post Reply
al2950
OGRE Expert User
OGRE Expert User
Posts: 1200
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 76

[SOLVED][Ogre 2.0] how to set pass material scheme?

Post by al2950 » Thu Oct 16, 2014 12:34 am

Hi

Unless I have missed something, there does not seem to be a way to set the material scheme for a scene_pass in the new compositor system. At least not from the scripts. I guess it could be done by getting the pass camera and then the viewport is uses to set the material scheme. I assume this is just missing functionality or am I meant to be going about it in a different way!?

I am currently just playing around with the new compositor system and trying to do a simple g-buffer.

**EDIT** Added Jira issue;
https://ogre3d.atlassian.net/browse/OGRE-442
Last edited by al2950 on Mon Feb 02, 2015 1:27 pm, edited 1 time in total.
0 x

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

Re: [Ogre 2.0] how to set pass material scheme?

Post by dark_sylinc » Sat Oct 18, 2014 6:11 am

You're correct, there is no way to define the material scheme.

I didn't think much about it because:
  • I wasn't very experienced with material_scheme settings.
  • I couldn't assess the performance impact. material_schemes seem to interact with the LOD calculations in weird ways; because each technique could have its own LOD list, changing schemes invalidates the LOD cache. Assuming same LOD levels for all techniques fixes the problem though.
  • There are other more obscure interactions I couldn't evaluate well, but material schemes were subject to bugs throughout Ogre 1.x; i.e. what the user should expect if a material doesn't define the scheme, or when multiple scene managers are present, etc.
  • The way it's architected material schemes have the tendency of forcing pass evaluation at the last possible moment (render time), thus horrible for performance. Didn't research whether this is quickly fixable or needs deeper refactor.
  • When the Hlms is deployed material schemes are nearly obsolete (though could still be relevant when using low level materials)
In other words I don't say it's impossible nor hard. I just didn't devote time to think about it; and didn't think it was worth much effort considering it will have less usefulness with the Hlms coming.

It might not be too hard to add the material scheme entry to the pass scene def (and setting it in the instance's execution*) and try if it "just works" for you. Feel free to try and create a pull request if it works. I'm mostly clueless when it comes to material schemes.

*Remember to reset the Viewport's material scheme after rendering, since the viewport may be shared by many passes to the same RTT.

Edit: Now I saw the the Jira ticket, in which you said you already implemented it. Can you point me to your repo? So I take a look :)
0 x

al2950
OGRE Expert User
OGRE Expert User
Posts: 1200
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 76

Re: [Ogre 2.0] how to set pass material scheme?

Post by al2950 » Mon Oct 20, 2014 11:00 pm

Sorry for the late reply, got a bit carried away in the depths of the Ogre render queue implementation!

Ive committed my changes to my fork here
https://bitbucket.org/al2950/ogre-2.0-u ... 11b90f59ef

It works fine. However I am confused as to how you would, for example, render all your objects using a depth buffer material instead of a standard lighting material without the use of material schemes? Unless the new render queue and HLMS work considerably different to how I might think they are going to work!
0 x

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

Re: [Ogre 2.0] how to set pass material scheme?

Post by dark_sylinc » Mon Oct 20, 2014 11:28 pm

If it works ok for you, you can submit a PR (pull request). You implemented it the same way I was thinking to.
0 x

Post Reply