Manual PBR setup in Ogre

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.
Post Reply
sasmaster
Gnoblar
Posts: 9
Joined: Sun Jun 27, 2021 4:09 pm

Manual PBR setup in Ogre

Post by sasmaster »

Hi All. I need a professional advice regarding Ogre's PBR API (if it exists)

I have a project where I must use Ogre to implement a demo scene with PB materials.
I have albedo, metallic, roughness and AO maps. The mesh comes from .obj file.
Additionally, I have environment map (equirectangular) which must be used for IBL setup.

I have never used Ogre before and my first attempt was with Ogre 1.2 .After I setup lights, figured out how to load
external modes via assimp I finally hit the wall while trying to setup a PBR material. I haven't found any property on the Material interface which
would allow a PBR related props setup. On the other hand,I have checked the PBR.h sample program, which loads GLTF model. So my quess the GLTF provides the implementation of the PBR material which is just parsed by the Ogre.It also comes in Ogre's native mesh format which in my cases is unacceptable. I have to load .obj directly.
So my question is this: does Ogre 1.x provide a way for manual PBR setup without the need to bring in my own shaders and writing ton of custom code just to get it running? If it doesn't, then does Ogre 2.x allows that? I have read here a post from someone else asking a pretty similar question and the answer was " it is not a good idea to tweak textures manually " etc..
Ideally ,I want to be able to setup a PBR scene similarly to how THREEJS allows it to do (in fact, their API super simple and easy to use).

Thanks in advance.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1993
Joined: Sun Mar 30, 2014 2:51 pm
x 1073
Contact:

Re: Manual PBR setup in Ogre

Post by paroj »

see this material samples for how to use PBR materials with Ogre1:
https://github.com/OGRECave/ogre/blob/m ... t.material

You have the choice between glTF2 reference shaders (all rendersystems), Filament reference shaders (GL3+ only) or the RTSS approximation (all rendersystems).

For the first two options, you have to copy the sample shaders into your project. If you want to create the materials programmatically, you can use Material::clone and modify the clone accordingly.

The Assimp plugin currently does not support importing PBR materials. (it maps everything to the FFP equivalent)
sasmaster
Gnoblar
Posts: 9
Joined: Sun Jun 27, 2021 4:09 pm

Re: Manual PBR setup in Ogre

Post by sasmaster »

Hi Thanks for that info.
I am not sure what you mean by "you can use Material::clone and modify the clone accordingly."

I am currently doing this:

Code: Select all


        MaterialPtr mat = MaterialManager::getSingleton().getByName("glTF2/PBR");

        auto params = mat->getTechnique(0) ->getPass(0)->getFragmentProgramParameters();

        auto albedoTexUnit = mat->getTechnique(0)->getPass(0)->getTextureUnitState("Albedo");

Is this what you mean.
Second question is regarding environment cubemaps. I see in the glTF2/PBR shaders regular 6 faced cubemaps are used which are made from 6 different images. Does Ogre support equirectangular images to generate a cubemap?

Last questions is regarding shaders and materials (files) location. Where this content should be located in a standalone project,which is not based on Ogre's Cmake generated solution? I am a bit confused atm, how my Ogre based app ,which is totally different project knows where Media folder is located as I never copied it into the project. How does it pull it from the Ogre's source directory? Some sort of system path variable?
Thanks!
Post Reply