Page 1 of 1

I don't know, is it a bug or feature request...

Posted: 03 May 2018, 18:41
by Ignis
but I've just noticed, that normal maps doesn't work for detail maps. It's strange, because they should. At least they work for them in another engines. For example, in Unreal Engine https://docs.unrealengine.com/en-us/Eng ... lTexturing. It' would be nice to add detail specular too)

My testing mesh and screen:
Image
https://drive.google.com/open?id=1qE6Ol ... 53kUttYNRQ

Re: I don't know, is it a bug or feature request...

Posted: 03 May 2018, 20:32
by AnyOldName3
A detail map as far as Morrowind is concerned is just a texture with some dark bits and the dark bits make the object darker by multiplying the base colour by the texture value (exactly the same as the dark map). In fact, the only difference between how dark maps and detail maps are processed is that the detail map's texture coordinate is doubled, so in most cases, it would be easier to just double the size of the diffuse map and add any extra detail to that as it produces exactly the same result.

Maybe down the line we'll add support for a more useful type of detail map and allow it to modulate the normals and affect the specular properties of the material, but for now, we're stuck only supporting what Morrowind supports. We're also limited to eight texture slots per object, including shadow maps, as long as we need to support old OpenGL versions. Hopefully, post-1.0, we'll have a big overhaul of how materials and shading are handled, and suddenly, everything anyone could ever want will be supported.

Re: I don't know, is it a bug or feature request...

Posted: 04 May 2018, 06:32
by Ignis
AnyOldName3 wrote: 03 May 2018, 20:32 A detail map as far as Morrowind is concerned is just a texture with some dark bits and the dark bits make the object darker by multiplying the base colour by the texture value (exactly the same as the dark map).
Even now things are not so sad: it definitely support not only value but and colour too.
AnyOldName3 wrote: 03 May 2018, 20:32 We're also limited to eight texture slots per object, including shadow maps, as long as we need to support old OpenGL versions. Hopefully, post-1.0, we'll have a big overhaul of how materials and shading are handled, and suddenly, everything anyone could ever want will be supported.
And now really sad news. Even without shadow and envinronment maps you need eleven slots per material:
1) diffuse/base
2) dark
3) detail
4) gloss
5) glow
6) bump
7) normal ( yes, vanilla engine allows us to have both of them. Don't try it, honestly, but there are separate slots for them in the nif shader.)
8) decal 0
9) decal 1
10) decal 2
11) decal 3 (though I didn't see more then 2 decals even on meshes from mods)

So, actually, you have to move to newer version of OpenGL before 1.0. Only to emulate vanilla shader behavior))))))))

P.S. I forgot to mention detail gloss and glow too!

Re: I don't know, is it a bug or feature request...

Posted: 04 May 2018, 08:36
by unelsson
The topic should be changed to something related to bump maps, specular maps or normal maps.

Re: I don't know, is it a bug or feature request...

Posted: 04 May 2018, 13:17
by AnyOldName3
1) diffuse/base
2) dark
3) detail
4) gloss
5) glow
6) bump
7) normal ( yes, vanilla engine allows us to have both of them. Don't try it, honestly, but there are separate slots for them in the nif shader.)
8) decal 0
9) decal 1
10) decal 2
11) decal 3 (though I didn't see more then 2 decals even on meshes from mods)
2/3: I'm not sure any meshes use both the dark and detail map as the maths involved is nearly identical, so they produce the same effect.

6/7: The vanilla engine doesn't actually support either of these. MGE changes how the environment map is interpreted so if you put a normal or bump map in its slot, it'll look sort-of right. NifSkope uses the MGE convention rather than the vanilla Morrowind one, so the environment map slot is doubled up and given a different name. If you load a Nif using the MGE convention into OpenMW, it'll likely look metallic and shiny.

8-11: I think OpenMW probably bakes decals into a single texture as the shader only has a single texture slot for decals.

The OpenMW texture layout is as follows. It's not super-critical to the discussion here, but textures are assigned to the lowest numbered available slot, so if there's no diffuse map, for example, the dark map will go in slot 0 instead.

a: Diffuse. If present, sets the base colour for the pixel and its transparency. Otherwise, it starts as white.
b: Dark. Applied after the Detail map. Multiplied into the base colour.
c: Detail. Applied before the Dark map. Multiplied into the base colour, but zoomed in 2x.
d: Decal. Mixed into the base colour based on the value of its alpha channel.
e: Emissive. Added to the pixel brightness after lighting calculations.
f: Normal. Modulates surface normals to make lighting and environment reflection look better. Alpha channel is the height used for parallax, if enabled.
g: Environment. Added on to the pixel brightness after lighting calculations based on which bit of this texture is reflected.
h: Specular. Colour affects specular colour. Alpha affects shininess used for Phong highlights.
(If you're using the shadow branch, as many slots as you specify shadow maps in your settings get used, too.)

In OpenMW, as the non-MGE Morrowind Nif format doesn't have a normal map slot, these are specified outside of the Nif file.

Re: I don't know, is it a bug or feature request...

Posted: 08 Sep 2019, 11:11
by Sagacity
AnyOldName3 wrote: 04 May 2018, 13:17 f: Normal. Modulates surface normals to make lighting and environment reflection look better. Alpha channel is the height used for parallax, if enabled.
Any reason not to just use the Normal Maps blue channel for the parallax height information? Normal maps can be assumed to have their height channel set at 0.5 or 127. Further, it'd allow the the alpha channel to store other relevant information, perhaps something like porousness or metalness.

Re: I don't know, is it a bug or feature request...

Posted: 08 Sep 2019, 20:30
by AnyOldName3
If we switch to a PBR pipeline, we'll look into better packing of material data. We do things the way we do because it's much easier for everyone to work on if you don't start overcomplicating things.