Specular different after Ogre update

Problems building or running the engine, queries about how to use features etc.
Post Reply
rmzvoid
Gnoblar
Posts: 11
Joined: Fri Aug 21, 2020 11:14 am

Specular different after Ogre update

Post by rmzvoid »

Ogre Version: 1.12.12
Operating System: Win10 x64
Render System: Direct3D 11

Hi all

I just updated ogre from 1.10.12 to 1.12.12 and have different pictures.


Image

On the left side 1.12.12 on the right 1.10.12. As you can see specular is wider on the left.
How I can achieve same results as in 1.10.12?

After update I got errors about ffp and advice to use custom shaders or RTSS. I used RTSS, thus for each material I
used ShaderGenerator::createShaderBasedTechnique().
paroj
OGRE Team Member
OGRE Team Member
Posts: 1993
Joined: Sun Mar 30, 2014 2:51 pm
x 1073
Contact:

Re: Specular different after Ogre update

Post by paroj »

you were using D3D9 with 1.10 I guess?

try switching to FFP lighting as described here:
https://ogrecave.github.io/ogre/api/lat ... custom_api
rmzvoid
Gnoblar
Posts: 11
Joined: Fri Aug 21, 2020 11:14 am

Re: Specular different after Ogre update

Post by rmzvoid »

paroj wrote: Mon May 31, 2021 12:05 pm you were using D3D9 with 1.10 I guess?

try switching to FFP lighting as described here:
https://ogrecave.github.io/ogre/api/lat ... custom_api
No, I used D3D11 in 1.10 too.
I tried switching to FFP but now get exception somewhere in Ogre.
FFP not a direct reason, we used RTSS perpixel on 1.10 too.
Maybe Ogre shader libs and/or c++ code changed in part of lightning.
rmzvoid
Gnoblar
Posts: 11
Joined: Fri Aug 21, 2020 11:14 am

Re: Specular different after Ogre update

Post by rmzvoid »

I don't know is this a bug in SGXLib_PerPixelLighting.glsl in SGX_Light_Directional_DiffuseSpecular method.

Light direction (vNegLightDirView parameter) not normalized. So user must pass normalised direction of light.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1993
Joined: Sun Mar 30, 2014 2:51 pm
x 1073
Contact:

Re: Specular different after Ogre update

Post by paroj »

yes that parameter should be normalised. The light direction is unit length, but it is transformed by the view matrix, that can introduce scaling.

Does adding a "normalise" call fix the rendering for you?
rmzvoid
Gnoblar
Posts: 11
Joined: Fri Aug 21, 2020 11:14 am

Re: Specular different after Ogre update

Post by rmzvoid »

paroj wrote: Mon May 31, 2021 3:53 pm yes that parameter should be normalised. The light direction is unit length, but it is transformed by the view matrix, that can introduce scaling.

Does adding a "normalise" call fix the rendering for you?
Light direction not transforming in vertex shader (I see that from dumped shader generated by RTSS). And yes, passing normalised direction helped me.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1993
Joined: Sun Mar 30, 2014 2:51 pm
x 1073
Contact:

Re: Specular different after Ogre update

Post by paroj »

the light direction is transformed on CPU.

This should be the proper fix:
https://github.com/OGRECave/ogre/pull/2055/files
rmzvoid
Gnoblar
Posts: 11
Joined: Fri Aug 21, 2020 11:14 am

Re: Specular different after Ogre update

Post by rmzvoid »

paroj wrote: Mon May 31, 2021 5:51 pm the light direction is transformed on CPU.

This should be the proper fix:
https://github.com/OGRECave/ogre/pull/2055/files
Nice commit, but I didn't see where light dir normalized in it. And question, why light direction transformed? Blinn-phong shading acts in world space as far as know, not in view space.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1993
Joined: Sun Mar 30, 2014 2:51 pm
x 1073
Contact:

Re: Specular different after Ogre update

Post by paroj »

the direction is normalised inside ACT_LIGHT_DIRECTION_VIEW_SPACE.

Doing lighting in view space avoid precision issues, if both camera and light are far from origin.
rmzvoid
Gnoblar
Posts: 11
Joined: Fri Aug 21, 2020 11:14 am

Re: Specular different after Ogre update

Post by rmzvoid »

paroj wrote: Mon May 31, 2021 9:04 pm the direction is normalised inside ACT_LIGHT_DIRECTION_VIEW_SPACE.

Doing lighting in view space avoid precision issues, if both camera and light are far from origin.
Ok, thanks
Post Reply