Skip to content

Commit

Permalink
Fix to blender contrast being inverted in Starfield material data
Browse files Browse the repository at this point in the history
  • Loading branch information
fo76utils committed Jun 21, 2024
1 parent 03865fc commit d19e1c0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Added new spell (Batch/Copy and Rename all Meshes) by 1OfAKindMods to copy and rename all .mesh files used by a Starfield model. Note that the spell expects a loose NIF file, if the model is from an archive, the renamed mesh files are written under the NifSkope installation directory.
* The right click menu on header strings that end with .bgsm, .bgem or .mat has a new option to browse materials. Updating the view (Alt+U) may be needed for material path changes to take effect.
* Added limited support for rendering translucent Starfield materials.
* Fixed the contrast parameter of Starfield blenders that is inverted in the material data.
* The default height scale for Starfield parallax occlusion mapping is now 0.0 in the render settings, as height textures do not actually work in the game.

#### NifSkope-2.0.dev9-20240616
Expand Down
2 changes: 1 addition & 1 deletion lib/libfo76utils
2 changes: 1 addition & 1 deletion res/shaders/stf_default.frag
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ void main()
if ( lm.blenders[i - 1].blendMode == 2 ) {
float blendPosition = lm.blenders[i - 1].floatParams[2];
float blendContrast = lm.blenders[i - 1].floatParams[3];
blendContrast = max( (1.0 - blendContrast) * min(blendPosition, 1.0 - blendPosition), 0.001 );
blendContrast = max( blendContrast * min(blendPosition, 1.0 - blendPosition), 0.001 );
blendPosition = ( blendPosition - 0.5 ) * 3.17;
blendPosition = ( blendPosition * blendPosition + 1.0 ) * blendPosition + 0.5;
float maskMin = blendPosition - blendContrast;
Expand Down
2 changes: 1 addition & 1 deletion src/model/nifextfiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void NifModel::loadSFBlender( NifItem * parent, const void * o )
setValue<float>( parent, "Height Blend Threshold", floatParams[0] );
setValue<float>( parent, "Height Blend Factor", floatParams[1] );
setValue<float>( parent, "Position", floatParams[2] );
setValue<float>( parent, "Contrast", floatParams[3] );
setValue<float>( parent, "Contrast", 1.0f - floatParams[3] );
setValue<float>( parent, "Mask Intensity", floatParams[4] );
setValue<bool>( parent, "Blend Color", boolParams[0] );
setValue<bool>( parent, "Blend Metalness", boolParams[1] );
Expand Down

0 comments on commit d19e1c0

Please sign in to comment.