Page 1 of 3

Odd/Incorrect Lighting on Meshes

Posted: 28 Feb 2019, 17:07
by Mistahtokyo
Hello, I came across this issue while testing some atlased textures, but came to realize the problem seemed inherent to OpenMW. There are visible lighting differences between adjacent meshes whether they're atlased or not. The vanilla Morrowind rendering engine and textures do have seams, but not nearly as visible. The lighting is much more even across the meshes too. Is this an OpenMW issue? Asset issue? Something else entirely? Below are some comparison shots.

Vanilla Screenshot:
Image

OpenMW Screenshot:
Image

Notice how, on OpenMW, the left mesh (top right corner area) is brighter than the adjacent mesh, resulting in the seam popping out considerably.

Re: Odd/Incorrect Lighting on Meshes

Posted: 28 Feb 2019, 17:50
by AnyOldName3
Huh.

Just to make comparisons easier, can you try and get a pair of screenshots from the exact same angle?

My first guess would be that maybe OpenMW and the vanilla engine are using different approaches to determine which lights get used for which objects, and in OpenMW, the two wall pieces are assigned different lights. I know Skyrim only applies up to four lights per object, and OpenMW does eight, so it's possible that vanilla Morrowind is only doing four and that's where the discrepancy comes from, but with either system, a light significant enough to make that big a difference should be used.

I guess some good questions to ask are:
  • Are you forcing shaders?
  • What other shader settings do you have (such as clamp lighting)?
  • What OpenMW version are you using?
  • Are you definitely using the same meshes in both cases?

Re: Odd/Incorrect Lighting on Meshes

Posted: 28 Feb 2019, 17:58
by Capostrophic
I'll answer the questions myself.

1. Using either fixed function or shader pipelines doesn't make a difference.
2. Lighting clamping doesn't make a difference either, and this happens on both per-pixel and per-vertex lighting.
3. master. At least I do.
4. This happens with the vanilla meshes.

Re: Odd/Incorrect Lighting on Meshes

Posted: 28 Feb 2019, 18:02
by Mistahtokyo
This happens regardless of angle. Only files loaded were Morrowind and the expansions. Nothing else. I enabled and disabled shadows. Enabled and disabled the "force per pixel lighting" and "clamp" options. Still having the issue.

Re: Odd/Incorrect Lighting on Meshes

Posted: 28 Feb 2019, 18:09
by AnyOldName3
What happens if /resources/shaders/lighting.glsl is edited so at the top it says #define MAX_LIGHTS 4 instead of 8 (and also force shaders in enabled - this obviously won't make a difference without shaders being in use)? If it's due to light selection, the issue should be gone with MAX_LIGHTS as 1, and there should be a value where it looks the same as vanilla Morrowind.

Re: Odd/Incorrect Lighting on Meshes

Posted: 28 Feb 2019, 18:14
by Capostrophic
Changing the light source limit doesn't make a difference even if the sun is the only light source present.

Re: Odd/Incorrect Lighting on Meshes

Posted: 28 Feb 2019, 18:19
by Mistahtokyo
Both comparisons were taking using clear weather with no nearby lights. Any ideas as to what could be causing the difference? Just a fundamental difference in how Morrowind and OpenMW calculate lighting?

Re: Odd/Incorrect Lighting on Meshes

Posted: 28 Feb 2019, 18:38
by AnyOldName3
When fixed-function mode is used, OpenMW and Morrowind are supposed to have identical lighting (as, IIRC, vanilla Morrowind uses DX8's fixed-function lighting, which should be identical to OpenGL's, but this is hard to google). When clamp lighting is on, our shaders and fixed-function mode are supposed to have identical lighting. I'm not really sure what's going on to make them different.

Re: Odd/Incorrect Lighting on Meshes

Posted: 28 Feb 2019, 22:16
by wareya
Are the normals on these models normalized to a length of 1.0?

Re: Odd/Incorrect Lighting on Meshes

Posted: 01 Mar 2019, 02:06
by Mistahtokyo
Both examples used unedited vanilla textures so I do not know how normal maps could be the issue.