Jump to content

Photo

BSLightingShaderProperty Basics


  • Please log in to reply
33 replies to this topic

#1
ImsumDave

ImsumDave

    Fan

  • Supporter
  • PipPipPip
  • 495 posts

BSLightingShaderProperty Basics:

Environment/Reflection

Specular and Glossiness (Specular Power)

Glow/Emissive

Alpha/Transparency/Opacity

Parallax

MultiLayer Parallax

Refraction

Notes and Miscellaneous Information

 
 
 
 
Introductory Information

 

It is not necessary to build your own BSLightingShaderProperty from scratch. Things are made much easier by copying and pasting a BSLightingShaderProperty from elsewhere before modifying it for your needs.

 

Nifskope's BSLightingShaderProperty interactive help page
Check "Interactive Help" in Help drop down to view in Nifskope
 
Nifskope block hierarchy example
BYeMux9.png
 
Nifskope block details example
              “slot #” is the row # in BSShaderTextureSet under the expandable textures list
              “=>” means in block details of that block (select the block in order to view it's details)
 
Texture Slots !in this image "Alpha" means alpha image channel
nIHpIor.png



1. Environment/Reflection
 
Requirements
cube map aka environment map
BSLightingShaderProperty => Skyrim Shader Type ~ 1 or Environment Map should be set
BSLightingShaderProperty => Shader Flags 1 ~ SLSF1_Environment_Mapping must be enabled
BSLightingShaderProperty => Shader Flags 2 ~ SLSF2_Glow_Map must be disabled
 
Appearance Controller(s)
BSLightingShaderProperty => Environmental Map Scale
BSShaderTextureSet => environment/cube map (slot 5)
BSShaderTextureSet => environment/reflection mask (slot 6)
 
Environment Map Scale
            - 1 is normal intensity
            - less than 1 is lower intensity
            - greater than 1 is higher intensity
environment/reflection mask is a greyscale image
            - black is minimum intensity, environment/cube map has no effect in these areas
            - white is maximum intensity
            - intensity increases as shade approaches white
 
   
Environment Map Scale                                 Environment/cube map                              Environment/reflection mask  
RX74xjJ.png
 
 
 
2. Specular and Glossiness (Specular Power)
 
Requirements

BSLightingShaderProperty => Shader Flags 1 ~ SLSF1_Specular must be enabled
 
Appearance Controller(s)
BSLightingShaderProperty => Specular Strength
BSLightingShaderProperty => Specular Color
BSLightingShaderProperty => Glossiness
BSShaderTextureSet => normal map (RGB) + greyscale specular map (Alpha) (slot 2)
 

Glossiness is the width of the specular highlight
            - 10 is a wide specular highlight
            - 50 is a thinner specular highlight
            - 100 is an even thinner specular highlight

            - value ranges from 0 to 999

specular map is a greyscale image
            - black is minimum intensity, no specular highlight
            - white is maximum intensity
            - intensity increases as shade approaches white

Specular Strength
            - 1 is normal intensity
            - less than 1 is lower intensity
            - greater than 1 is higher intensity
Specular Color is the color of the specular highlight
 

Specular strength                                      Specular color                                            Specular map
ovqWo5F.png

Glossiness
UCRj5ih.png
 
 
 
3. Glow/Emissive
 
Requirements
BSLightingShaderProperty => Skyrim Shader Type ~ 2 or Glow Shader should be set
BSLightingShaderProperty => Shader Flags 2 ~ SLSF2_Glow_Map must be enabled
BSLightingShaderProperty => Shader Flags 1 ~ SLSF1_Environment_Mapping must be disabled
 
Appearance Controller(s)

BSLightingShaderProperty => Emissive Multiple
BSLightingShaderProperty => Emissive Color
BSShaderTextureSet => emissive/glow map (slot 3)
 
Emissive Multiple
            - glow intensity increases as emissive multiple increases
Color of glow is controlled by both the color(s) of the glow map texture and the emissive color
Emissive/glow map is a color image

            - black is minimum intensity (no glow)
            - white is maximum intensity (maximum glow)
            - intensity increases as shade approaches white
 
 
Emissive multiple                                        Emissive color                                            Emissive/glow map
vNOVwrY.png



4. Transparency/Alpha
 
Requirements
automatically enabled for outer layer if using MultiLayer Parallax shader, otherwise:
requires that a NiAlphaProperty be added to the NiTriShape (right-click NitriShape – Node>Attach Property>NiAlphaProperty)
 
Appearance Controller(s)
NiAlphaProperty => Flags (double-click to view settings)
BSLightingShaderProperty => Alpha
BSShaderTextureSet => diffuse map (RGB) + transparency/opacity map (Alpha) (slot 1)

NiTriShapeData => Vertex Colors (Alpha)
 

Alpha ranges from 0 to 1

            - 0 is fully transparent (invisible)
            - 1 is fully visible (opaque)

transparency map is a greyscale image in the alpha image channel of the diffuse
            - black is fully transparent (invisible) *dependent on flags set in NiAlphaProperty block details
            - white is fully visible (opaque) *dependent on flags set in NiAlphaProperty block details
            - transparency increases as shade approaches black *dependent on flags set in NiAlphaProperty block details

 
Alpha                                                       Transparency map
ZrT7mVO.png
 

 

4.1 Color Blending and NiAlphaProperty Settings

 

NiAlphaProperty Settings

 

QlE7LgX.png

 

 

Color Blending

 

Color Blending Equation

(Source * SourceBlendFactor) + (Destination * DestinationBlendFactor)

 

"Source" is the color of the model materials in that pixel before blending

 

"Destination" is the color of what is behind the model in that same pixel before blending

 

The two values are modified by the value of the blend factor in that same pixel, then they are added together.

 

Blend Factors aka Blend Modes

One - multiply by one (no modification)

Zero - multiply by zero

Src Color - multiply by "Source"

Inv Src Color - multiply by inverse "Source"

Dst Color - multiply by "Destination"

Inv Dst Color - multiply by inverse "Destination"

Src Alpha - multiply by value of the model's alpha channel (diffuse and vertex colors) present at that pixel

Inv Src Alpha - multiply by inverse value of the model's alpha channel (diffuse and vertex colors)present at that pixel

Dst Alpha - multiply by value of the background model's alpha channel (diffuse and vertex colors)present at that pixel

Inv Dst Alpha - multiply by inverse value of the background model's alpha channel (diffuse and vertex colors)present at that pixel

 

Additional Information on color blending 

 

 

 

5. Parallax
 
Requirements
ENB required to function properly
BSLightingShaderProperty => Skyrim Shader Type ~ 3 or Heightmap must be set
BSLightingShaderProperty => Shader Flags 1 ~ SLSF1_Parallax must be enabled
 
Appearance Controller(s)
BSShaderTextureSet => height/parallax map (slot 4)
 
height/parallax map is a greyscale image in RGB format
            - mid grey (RGB, 127, 127, 127) is zero depth and height
            - black is maximum depth
            - white is maximum height

 
 
 
6. MultiLayer Parallax
 
Requirements
BSLightingShaderProperty => Skyrim Shader Type ~ 11 or MultiLayer Parallax must be set
BSLightingShaderProperty => Shader Flags 2 ~ SLSF2_Multi_Layer_Parallax must be enabled
 
Appearance Controller(s)
BSShaderTextureSet => diffuse map (RGB) + transparency/opacity map (Alpha) (slot 1)
BSShaderTextureSet => subsurface color map (slot 3)
BSShaderTextureSet => inner layer diffuse (RGB) + inner layer depth (Alpha) (slot 7)
BSLightingShaderProperty => Parallax Inner Layer Thickness
BSLightingShaderProperty => Parallax Refraction Scale
BSLightingShaderProperty => Parallax Inner Layer Texture Scale
BSLightingShaderProperty => Parallax Envmap Strength
 
environment map and specular/glossiness have no effect on the inner layer
transparency/opacity map controls outer layer transparency

            - viewing angle affects transparency
                            - viewing the surface at a steeper angle increases opacity
            - black is almost completely transparent (see above)
            - white is opaque
subsurface color map 
            - used to fake subsurface scattering

inner layer diffuse is the diffuse texture of the inner layer (obviously)
inner layer depth is a greyscale image

          - controls the depth of the inner layer from the outer layer
          - black is minimum depth (inner layer distance from outer layer is 0)
          - white is maximum depth (inner layer distance from outer layer is max) 
Parallax Inner Layer Thickness
          - controls inner layer max depth
          - depth increases as value increases
Parallax Refraction Scale
         - deforms the inner layer based on outer layer normal map detail, viewing angle, and inner layer depth
         - refraction intensity increases as value increases
         - (maybe?) max is 1
Parallax Inner Layer Texture Scale
            - inner layer diffuse tiling
            - density of tiling increases as values increase (x and y)
            - x and y control the axis of tiling
Parallax Envmap Strength
           - outer layer environment map intensity increases as value increases

 

 

 

7. Refraction
 
Requirements
BSLightingShaderProperty => Shader Flags 1 ~ SLSF1_Refraction
 
Appearance Controller(s)
model surface normals

BSShaderTextureSet => normal map (RGB) + specular (Alpha) (slot 2)

BSLightingShaderProperty => Unknown Float 2 *name may be changed in newer versions of Nifskope (written June 30, 2014) 

Unknown Float 2 ranges from 0 to 1

            - refraction strength increases as value increases

            - 0 is no refraction (no distortion)
            - 1 is maximum refraction (most extreme distortion)

 

 

 

_. Notes and Miscellaneous Information 

 

Normal map not working?

 

Check that the normal map is saved as a DDS image

Check that normal map is in correct texture slot (slot 2)

Set NiTriShape > NiTriShapeData => Has Normals Value to yes (double-click)

Set NiTriShape > NiTriShapeData => BS Num UV Sets Value to 4097

Update tangent space: Toolbar – Spells > Batch > Update All Tangent Spaces

 

 

DDS image format as it pertains to Skyrim

 

MIP Mapping

Always generate MIP maps when saving a DDS image for use in Skyrim. Saving a DDS image without MIP maps has been known to cause lag on asset load (ex. pause when swapping weapons). Google MIP mapping if you'd like the details about what it is and what it does.

 

DXT compression (DXT1, DXT3, DXT5)

DXT1, DXT3, and DXT5 all use the same compression method for the RGB image channels. The difference between them comes from how the alpha image channel is compressed. DXT compression can (will) cause artifacts in the texture, especially in areas with gradients. The benefit of compressed textures is the smaller size on disk and in RAM.

 

DXT1 – no alpha

DXT3 – explicit alpha

DXT5 – interpolated alpha

 

Uncompressed (8.8.8.8 ARGB, 8.8.8 RGB)

Uncompressed dds images are quite large (space on disk and in RAM) compared to those saved with DXT compression. The benefit of uncompressed textures is the lack of compression artifacts. This can be important when artifacts are noticeable in-game.

 

**if textures are too large, this can cause lag on asset load, especially with slower computers

 

9i73dwu.gif

(ignore gif compression, small specks in RGB images)

 

 

Layering

 

Incompatibility between some effects can be worked around by layering meshes (NiTriShape). For example, for glow shader and environment map, one NiTriShape will have a BSLightingShaderProperty set up for environment mapping, while another will be set up for glow. The glow NiTriShape will use alpha transparency to hide all areas that do not have the glow effect. The glow map can be used for the transparency map in diffuse alpha image channel. This workaround can be used in many different ways, be creative.


Edited by ImsumDave, 11 November 2015 - 03:32 AM.


#2
ImsumDave

ImsumDave

    Fan

  • Supporter
  • PipPipPip
  • 495 posts

Saved for future updates



#3
Tamira

Tamira

    Faithful poster

  • Supporter
  • PipPipPipPip
  • 1,488 posts

Very useful informations for everyone! Many thanks for this! :)



#4
Celegon

Celegon

    Regular

  • Members
  • PipPip
  • 66 posts

Seconded.

You should add a link to this thread in your sign. I'm sure it will help a lot of prospective modders in the future.



#5
EnaiSiaion

EnaiSiaion

    Endorsement Geisha

  • Premium Member
  • 28,111 posts

Awesome. :)



#6
Terra Nova

Terra Nova

    Old hand

  • Account closed
  • PipPipPip
  • 610 posts

Thanks for the info, very informative.



#7
ImsumDave

ImsumDave

    Fan

  • Supporter
  • PipPipPip
  • 495 posts

No problem. I made this quite a while ago. I posted it with an incorrect name. This information can be quite hard to find and even harder to figure out for a beginner. I made this as a quick reference. There is quite a bit of information missing. I only included what I know to be correct (ignoring the height map slot). I might add refraction, normal mapping, and parallax mapping information in the future.



#8
Celegon

Celegon

    Regular

  • Members
  • PipPip
  • 66 posts

This should be sticked somewhere, as it would be a shame to "lose" this in the ever extending tread list of this forum.



#9
BrettM

BrettM

    Old hand

  • Premium Member
  • 525 posts

Fantastic! Ummm ... you wouldn't happen to have the same kind of rundown for the BSEffectsShaderProperty, would you?  Or any information on the shader property controllers? :D

 

Truly, this tutorial deserves to be spread widely.



#10
ImsumDave

ImsumDave

    Fan

  • Supporter
  • PipPipPip
  • 495 posts

No, I haven't used BSEffectShaderProperty at all up to this point. As for shader property controllers, I was playing around with them a bit in the past. I was trying to make a pulsing glow effect. In fact, the head in my Longclaw mod uses that exact effect. You could take a look at that if you need an example. I can't really explain any of it off the top of my head atm. It's been quite a while since I played around with them. This niftools thread has some useful info.






Page loaded in: 0.821 seconds