[2.1] how to approximate Unity / UnrealEngine shading options

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
KammutierSpule
Gnoblar
Posts: 13
Joined: Tue Oct 10, 2017 12:22 pm
x 1

[2.1] how to approximate Unity / UnrealEngine shading options

Post by KammutierSpule »

For the Specular workflow,
what is the workflow configuration (datablock->setWorkflow) that will better approximate Unity? and for Unreal?
or what other options should I take in account?

EDIT:

Here is an example, I was expecting the same result but this is what I am getting.
Image

It looks the the Ogre shading is more elongated and Unity is more round.

Here are my settings:
A plane, a point light. All same size and distance on Ogre/Unity. No attenuation on lights.
Diffuse 1, Specular 1, Roughness is a horizontal map from 0 to 1.

Settings on the Ogre shaders are:
datablock->setWorkflow( Ogre::HlmsPbsDatablock::SpecularAsFresnelWorkflow );
datablock->setBrdf( Ogre::PbsBrdf::Default );

I tried different variants but all look a different from Unity.

The only difference I am aware is that (my?) Ogre is not doing proper sRGB correction and Unity is.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.1] how to approximate Unity / UnrealEngine shading options

Post by dark_sylinc »

A 1:1 mapping will be hard to obtain.
KammutierSpule wrote:The only difference I am aware is that (my?) Ogre is not doing proper sRGB correction and Unity is.
Since you're having what is likely a HW or driver bug with your Intel HD 2500, I suggest you use SW Mesa for comparison. Use the environment variable LIBGL_ALWAYS_SOFTWARE to compare:

Code: Select all

export LIBGL_ALWAYS_SOFTWARE=1
./run_my_sample
KammutierSpule wrote:Here are my settings:
A plane, a point light. All same size and distance on Ogre/Unity. No attenuation on lights.
Diffuse 1, Specular 1, Roughness is a horizontal map from 0 to 1.

Settings on the Ogre shaders are:
datablock->setWorkflow( Ogre::HlmsPbsDatablock::SpecularAsFresnelWorkflow );
datablock->setBrdf( Ogre::PbsBrdf::Default );

I tried different variants but all look a different from Unity.

The only difference I am aware is that (my?) Ogre is not doing proper sRGB correction and Unity is.
Without having everything needed to reproduce the results in both engines, it's impossible for us to help you. There could be a billion tiny differences. It could be something as silly as aspect ratio issues (make sure your camera is set to auto aspect ratio and resolution of both Unity and Ogre match).
In fact, I don't even understand what am I looking at in the pictures.
Btw we divide diffuse by PI, Unity does not, so that is likely one reason for disparity between the two.
KammutierSpule
Gnoblar
Posts: 13
Joined: Tue Oct 10, 2017 12:22 pm
x 1

Re: [2.1] how to approximate Unity / UnrealEngine shading options

Post by KammutierSpule »

dark_sylinc wrote:A 1:1 mapping will be hard to obtain.
KammutierSpule wrote:The only difference I am aware is that (my?) Ogre is not doing proper sRGB correction and Unity is.
Since you're having what is likely a HW or driver bug with your Intel HD 2500, I suggest you use SW Mesa for comparison. Use the environment variable LIBGL_ALWAYS_SOFTWARE to compare:

Code: Select all

export LIBGL_ALWAYS_SOFTWARE=1
./run_my_sample
This was useful, since now I can really see that it was not working in sRGB.

Regarding the test, I was just trying to setup:
- quad at 0,0,0
- camera center at origin looking down
- light center at origin at some height.
- No reflection probes, no environment on Unity or any kind of global illumination.
All other settings with same or similar configuration (positions, scales, intensities).

Could you suggest a datablock configuration (workflow, etc.. ) that I could reproduce to close match on two sides?
KammutierSpule
Gnoblar
Posts: 13
Joined: Tue Oct 10, 2017 12:22 pm
x 1

Re: [2.1] how to approximate Unity / UnrealEngine shading options

Post by KammutierSpule »

I managed to make changes on Ogre shader so it will close match Unity results that I was expecting.
Image

Image

Please have a look on the github where I added some more details on this issue:
https://github.com/OGRECave/ogre/issues/545
Post Reply