Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

[SKY] Greyscale to Palette Alpha/Color in BSEffectShaderProperty


abies
 Share

Recommended Posts

Hello - my first post here, so please be forgiving if I have missed some obvious link or explanation.

 

I'm trying to understand how BSEffectShaderProperty flags SLSF1_Greyscale_to_PaletteAlpha and SLSF1_Greyscale_to_PaletteColor work. I understand the general idea - Greyscale Texture is used as palette and it is being indexed on u,v based on some transformation of original pixels. What I'm trying to understand is how this works exactly.

 

From my tests so far, closest I was able to get is that for alpha, horizonal coordinate equals to Source texture alpha and vertical coordinate equals to falloff computed from falloff angles. It works almost ok (I use Dungeons\AzurasStar\AzuraEpicCrystal05.nif as my test object, with base mesh removed, so only two decal meshes with palettes are visible).

For PaletteColor I'm at loss. It looks a bit like greyscale average of source texture.rgb is used as vertical coordinate, but thats not fully accurate (could be issue of (r+g+b)/3 versus more accurate greyscale conversion) - and what with horizontal coordinate?

 

Does anybody know how exactly these things are used? In particular PaletteAlpha.

  • Upvote 1
Link to comment
Share on other sites

Managed to find out how it is done.

 

h - horizontal coordinate

v - vertical coordinate

 

for PaletteColor,

h = sourceTexture.g*emissiveMultiple

v = emissiveColor.r*emissiveMultiple

result.rgb = GreyscalePalette(h,v).rgb

 

for PaletteAlpha

h = sourceTexture.a

v = emissiveColor.a*falloff

result.a = GreyscalePalette(h,v).a

 

Not sure where vertex colors are coming in equation - will they modify h or v parameter -  cannot find example with vertex colors at the moment.

Edited by abies
Link to comment
Share on other sites

  • 7 years later...

[many years later...]

An example of a mesh with vertex colors is the daedric armor (e.g. daedriccuirass_1.nif). The main armor component uses the environment map shader to yield metal-like reflections. The glow component is handled by the BSEffectShaderProperty node on a separate piece of geometry. This glowing geometry has light emission, texture translation (i.e. V coordinate offset), and vertex transparency.

A) the texture used is VaporTile02.dds but its alpha / transparency is overridden via the Grayscale_To_PaletteAlpha (in shader flags 1), which signals using the grayscale image in GradDusguiseShader02.dds to remap / regenerate alpha values based on the formula described above by abies.

B) texture translation is handled by the BSEffectShaderPropertyFloatController (i.e. it changes the V coordinate of the UV mapping as a function of time)

C) in addition, the vertices themselves have alpha values, allowing the glow to have both sharp edges (close to the armor) and falloff regions (away from the armor). In the image attached, I set the alpha value of the three left-most vertices to various levels (labeled on the image). To view these changes in NifSkope 2.0dev7, one has to save changes, and reload from file (seems NifSkope cashes vertex alpha values and won't refresh them when changed).

So, point A turns the opaque texture into a translucent one, and point C allows the "glow" to dim / strengthen as the geometry requires it.

VertexAlpha-01.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...