Author Topic: Examples of "specular" or "shininess" doing anything?  (Read 847 times)

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
Examples of "specular" or "shininess" doing anything?
« on: March 27, 2016, 04:31:49 pm »


               

Does anyone have an example of either of these doing anything in any context- such as trimesh, danglymesh, animesh, etc.?  All I'm looking for is a basic example, like where you set shininess to 1 and it does something different than if set to 26, or if the specular color shows up somewhere.  I wrote them off a long time ago but I do occasionally see them in models now and then.  I think the last time was on one or both of the non-official DLA gemstone golems.


 


I did some tests yesterday and it didn't seem like either of the settings were even getting fed into OpenGL.  The only thing I saw was specular, but that was coming in from lights and it didn't seem to be something that you could control but was, in fact, a duplication of the light's Diffuse settings.  But that was it.


 


Anything?


 


Thanks!


 


 


 


 



               
               

               
            

Legacy_Asymmetric

  • Sr. Member
  • ****
  • Posts: 289
  • Karma: +0/-0
Examples of "specular" or "shininess" doing anything?
« Reply #1 on: April 01, 2016, 06:09:24 pm »


               

Afaik shininess doesn't do anything. I tried different values when testing neverblender, but nothing changed ingame.


 


For specular ... no idea actually. Blender has a specular value for materials and mdl has it too, so I just imported/exported it. I always assumed it works, but never actually tested it.



               
               

               
            

Legacy_Tchos

  • Sr. Member
  • ****
  • Posts: 454
  • Karma: +0/-0
Examples of "specular" or "shininess" doing anything?
« Reply #2 on: April 01, 2016, 09:05:58 pm »


               

I can only tell you how it works in NWN2.  I don't know if NWN1 supports it.  Shininess, also called glossiness, is an aspect of specularity, and refers to how narrowly sharp or how widely diffuse the specular highlight is.  I usually use 20.  Specular strength determines the strength of the specular highlight, but even if it's at 100% strength it will depend on the texture's specular map (assuming NWN1 has specular maps).  If you have an all-black specular map, which some programs might add by default if you save as a 32-bit TGA and don't already have one, then it won't even matter, because black = 0% specular strength.  Ideally, you'd want a map with a mix of light and dark areas, not just a uniform black, white, or grey.



               
               

               
            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
Examples of "specular" or "shininess" doing anything?
« Reply #3 on: April 01, 2016, 09:32:01 pm »


               

Okay, found a little bit more info.  From looking at the code in IDA Debugger, shininess doesn't mimic how other model commands are processed.  When NWN is reading in an ASCII model and hits a command like ambient or rotatetexture, it will call a subroutine to filter the rest of the line of text to gather the data it's expecting.  So if it's ambient, it's going to call a subroutine which checks for three floats worth of data.  For rotatetexture, it'll call a subroutine which scans for boolean data like "0", "1", "true" or "false".  Shininess is the only command that doesn't call a subroutine and, instead, looks like this.  I.....dunno.  I mean, I'm not sure if that's a coder "short circuiting" it to make it inoperable or maybe just building in the search function into the string search for the command.


 


FWIW, the way shininess is done is the same in nwmain.exe, processmodels.exe (the leaked internal Bioware compiler) but, interestingly, not in the standalone NWN model viewer.


 


Tchos: A week or two ago I came across some guy's basic custom content guide for NWN2 and everything was much more clearly laid out.  I know the alpha channel can be used to reflect an environment map or transparency but in a situation where you have an RGBA and R, G, and B are black but the alpha has a grayscale in it (and you have no environment map), the alpha will pick up light.  Like this.  I think that's how the model was set up, anyway.  Out of curiosity, does that look like what you'd think of when you think of a specular map?  See, it's like so much crap is rolled into the same thing with the way NWN does lighting that it can be kind of difficult to pick something apart and say "Am I looking at something new or just something old but displayed in an unusual way?"



               
               

               
            

Legacy_Tchos

  • Sr. Member
  • ****
  • Posts: 454
  • Karma: +0/-0
Examples of "specular" or "shininess" doing anything?
« Reply #4 on: April 02, 2016, 02:40:31 am »


               


Tchos: A week or two ago I came across some guy's basic custom content guide for NWN2 and everything was much more clearly laid out.  I know the alpha channel can be used to reflect an environment map or transparency but in a situation where you have an RGBA and R, G, and B are black but the alpha has a grayscale in it (and you have no environment map), the alpha will pick up light.  Like this.  I think that's how the model was set up, anyway.  Out of curiosity, does that look like what you'd think of when you think of a specular map?




 


Yes, that's exactly it.  I often test my specular maps by making the diffuse map entirely black (the RGB you mention), and shining a light around the object.  Even a completely black object will show its details under a light if the specular settings are set correctly and the specular maps are made correctly (assuming you don't intend to make an object with an entirely matte finish that absorbs all light thrown at it).  To be clear to others, the picture you showed was not a specular map in itself, but a rendering of an object with a specular map applied.  Judging from how diffuse the specularity is, I would estimate it has a very low shininess -- around 5-10, perhaps.


 


As you probably know, alpha channels in texture maps can be used for many different purposes, and there isn't necessarily a standard between different games as to which map is used for what.  For instance, in NWN2, the alpha channel of the diffuse map is used for transparency, the alpha channel of the normal map is used for specular strength, and the alpha channel of the tint map is used for tint strength.