Jump to content

BSLightingShaderProperty Basics


ImsumDave

Recommended Posts

Oh, excellent! Thank you for that link. I had ferreted out some of those numbers from examining Bethesda nifs for my tutorials on texture animation using NifSkope, but I knew I was missing a lot.

 

So far I have fairly well mastered the controllers for BSLightingShaderProperty and the one for NiAlphaProperty, but I can do more knowing the numbers for all of the variables, and the information will help me to get some of the other controllers figured out.

 

I had a pretty good handle on most of BSLightingShaderProperty values, but you certainly gave me some useful revelations here. For one thing, it seems my problems with controlling glossiness were due to believing that LOWER values were less glossy. Oops. :)

 

If I can get the same handle on BSEffectShaderProperty, I'll be sitting pretty.

Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...

Thank you a lot for this great explanation!

(and for the link to the NifSkope topic about BSLightingShaderProperty)

 

I would like to ask you one thing: may you add to your topic examples in pictures of Alpha flags usage ?

(Alpha Src, Alpha Dst ...) and how they influences a texture in game ?

Link to comment
Share on other sites

  • 1 month later...

I second that, the NiAlpha flags are quite confusing. I've tried different configurations, but I can't quite figure out exactly what they do, and most of them result in strange artifacts. Sticking with the defaults for now.

 

You also mentioned refractions, I'd very much appreciate a guide on that. Without refraction most transparent objects with any kind of depth look flat and unrealistic.

 

Fantastic work by the way, this information is hard to find but oh so essential. Thanks!

Edited by Saerileth
Link to comment
Share on other sites

  • 3 months later...

I'm a bit late here, but I plan to add information on alpha settings and dds texture formats soon. I'm not sure about refraction. If my memory is correct, I tested it a bit with little success. It might be shader specific. I'll look into that as I add more to the page. I think refraction is used for fire heat distortion effects, which would be a good place to start.

 

I can give a quick tip about alpha transparency. Alpha testing is on or off (fully opaque or fully transparent), while alpha blending blends based on source and destination blend mode settings.

Link to comment
Share on other sites

Hey, welcome back! About the refractions, I've been in contact with skysan, the author of Transparent and Refracting Icicle and Frost Atronach, among other similar mods. He's been able to make the effect work and showed me how, under the condition that I don't share the information. But it can be reverse-engineered easily from his meshes. It's a fickle thing though, I've used it to great effect with my Dragon Claw replacer but I prefer regular transparency on my gem replacers because refraction causes some really strange artifacts with them. It really depends on the mesh, on anything with sharp edges it tends to look weird, and it's pretty mich in-your-face all the time, it can't be toned down to anything subtle.

 

About the Alpha blending, what I'd really like to know is how it actually works and what each setting does, if that's possible. For example, what does "Src Color" mean? What's the difference between Src and Dst? Until now I just tested each combination and noted down a few favourites that I use depending on what effect I want to achieve, but mostly I'm working in the dark because I don't really know what I'm doing.

Edited by Saerileth
Link to comment
Share on other sites

I updated section 4 with a NiAlphaProperty settings subsection. I focused mainly on simple illustrations of what settings do instead of defining what the settings mean. I also added a link to a msdn page about color blending. Alpha blending is a form of color blending using an images alpha channel. Here is the link if you'd like to learn more about how color blending works. Basically, the blending works as follows.

 

(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/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

 

Ok, maybe not so basic. I'll add that to the OP, too.

 

Now to tackle refraction. I'll take a look at both skysan's and your mod assets and see what I can figure out. From what I know, I can tell you that the refraction works based on surface normals. In the case of a sharp, faceted edge, there is a very immediate hard change in surface normals. I'd guess that the refraction shader wasn't made to handle that situation. This seems more likely given that faceted edges are usually a no-no in games: they cause obvious ugly aliasing effects.

Link to comment
Share on other sites

Thanks a lot, that information is really helpful :) Yeah, it seems refraction doesn't handle sharp edges well at all. Unfortunately it's quite impossible to make realistically cut, sparkling gemstones without them, they need hard edges by definition or else the facets start blending into each other.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...