Skip to content

Add in incomplete BSShader[PP/No]LightingProperty work before it rots away

Alexei Kotov requested to merge Capostrophic/openmw:nifnifnifnifnif into master

This is some basic texturing support work for Fallout 3 and New Vegas. It is about as far as I got to in December before, uh, real life things(tm) took over.

It's a basic implementation of the properties mentioned in the name of the PR and it covers a part of the texturing pipeline introduced in these games (currently it's just diffuse, glow and normal mapping and the per-pixel lighting and no lighting properties). Specific shaders are forced for the nodes that depend on the updated texturing. Two new user values were added so that shader visitor can support that; shader visitor also now only operates with pairs of fragment and vertex shader with the same prefix.

These changes might be debatable; AON3 said he couldn't find anything especially outrageous when I first asked him to gloss over this a while ago but I'm not confident in them.

The new shaders being closer to Bethesda shader pipeline are slightly different from the base objects_fragment shader. Per-pixel lighting shader has per-pixel lighting enabled exclusively and uses Bethesda normal map setup (DirectX normal format and specularity alpha channel) and they don't do emission the same way. They also have a lot of Morrowind and OpenMW things removed (though it's likely a form of parallax mapping will make it in later).

"Default" shader (nv_default prefix) is the (not 100% or even 25% accurate) equivalent of the per-pixel lighting shader used in Fallout 3/New Vegas for most things. It corresponds to BSShaderPPLightingProperty.

"No lighting" shader (nv_nolighting prefix) doesn't apply lighting but it applies falloff (angle-dependent transparency). It's used for things like Pip-Boy glow. It corresponds to BSShaderNoLightingProperty.

There is half a dozen of other shader properties corresponding to unhandled shader types but I ran out of time before I could write them. I don't think properties are actually expected to pick a shader that doesn't correspond to their name (which is partially why currently uniform handling is a mess).

Additionally, emissiveMult implementation was fixed, as emission color can change independently from the multiplier due to material color controllers.

The shaders used to work mostly okay before all the paper doll and alpha testing shenanigans but while I adjusted the newly added shaders to the changes I'm not confident that it still keeps working.

There's also the problem of shader prefix names. nv totally stands for Nouveau as in New and not New Vegas. I'm open to suggestions.

Oblivion doesn't get any fancy shader with proper support for Bethesda normal map setup yet. Mesh tangents also go unused (they're generated automatically by an OSG utility).

Merge request reports