Horde3D

Next-Generation Graphics Engine
It is currently 28.03.2024, 11:06

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: 23.08.2012, 16:15 
Offline

Joined: 16.05.2009, 12:43
Posts: 207
I was wondering if anyone else had fiddled around with this? easy enough to feed the specular mask into the calcPhongSpotlight function from a texture. But for some reason it doesn't seem to help specular wise.

Anyone added proper spec maps into horde? Feels like a modern shader engine needs them (most models come with normal and spec/gloss maps). Incidentally, not exactly sure what "gloss" is supposed to mean in this case. Do they mean specular exponent = gloss? I'm not too bothered about specular colour so much, I guess that would be nice. But specular masking sure would be nice to get working properly.


Top
 Profile  
Reply with quote  
PostPosted: 24.08.2012, 06:10 
Offline

Joined: 08.11.2006, 03:10
Posts: 384
Location: Australia
Different engines use the word "gloss" to mean different things, so I personally avoid it.

Specular mask / specular colour == this property is tied to the physical property of Index of Refraction (it's the F0ยบ value, which is equal to ((IOR-1)^2)/((IOR+1)^2)). This is based on the type of material, e.g. matte paint, glossy paint, skin, glass, wood, metal, all have very different IOR values, and thus have different spec-mask values. This basically determines the ratio of incident light that is reflected vs refracted (where reflected light == specular light, and refracted light == diffuse light).

Most dielectric materials (non-metals) don't need RGB specular masks -- their IOR values are typically the same when measured under the Red, Green and Blue visible wavelengths, so their spec mask should be grey. Also, dielectrics aren't very shiny, with diamond being the "most specular" with a mask value of about 18%. A typical mask value for real-world materials is about 4%.

On the other hand, metals often do have very different IOR values when measured under different visual wavelengths, so they usually do need coloured spec-masks. Also note that metals usually have 0% albedo, which means their albedo/diffuse texture should be black in a physically based renderer (however, you need a lot of light-sources, and bounced-lighting in your scene before this starts to look real, so games often cheat with this detail). They are also very shiny, e.g. silver's mask is about 96%.

Specular power == this is a measure of surface roughness. It's an approximation used in place of infinite-resolution normal maps. If at a microscopic level, your object would have a flat normal map, then you want a high specular power. If it's bumpy at a microscopic level, you want a low specular power.


Top
 Profile  
Reply with quote  
PostPosted: 24.08.2012, 08:35 
Offline

Joined: 23.07.2009, 21:03
Posts: 51
Location: Germany
zoombapup wrote:
I was wondering if anyone else had fiddled around with this? easy enough to feed the specular mask into the calcPhongSpotlight function from a texture. But for some reason it doesn't seem to help specular wise.


I used a specular map for the head of my character with "okayish" results.

code in [[FS_LIGHTING]]
Code:
#ifdef _F06_SpecularMapping
   uniform sampler2D specularMap;
#endif
.
.
.
#ifdef _F06_SpecularMapping
   vec3 specMap = texture2D( specularMap, newCoords.st ).rgb;
   float specExponent = specMap.r;
   float specularMask = specMap.g;
   gl_FragColor.rgb =
      calcPhongSpotLight( newPos, normalize( normal ), albedo.rgb, specularMask, specExponent * 255, -vsPos.z, 0.3 );
#else
   gl_FragColor.rgb =
      calcPhongSpotLight( newPos, normalize( normal ), albedo.rgb, specParams.x, specParams.y, -vsPos.z, 0.3 );
#endif      


huuuuuge map:
https://hcm-lab.de/public/Horde3D/trunk ... r_head.jpg

result:

Image


On specular in general, with nice pictures:
Everything is Shiny
Everything has Fresnel


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 37 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group