Horde3D http://horde3d.org/forums/ |
|
Spec/Gloss mapping in horde http://horde3d.org/forums/viewtopic.php?f=1&t=1708 |
Page 1 of 1 |
Author: | zoombapup [ 23.08.2012, 16:15 ] |
Post subject: | Spec/Gloss mapping in horde |
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. |
Author: | DarkAngel [ 24.08.2012, 06:10 ] |
Post subject: | Re: Spec/Gloss mapping in horde |
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. |
Author: | Roland [ 24.08.2012, 08:35 ] |
Post subject: | Re: Spec/Gloss mapping in horde |
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: On specular in general, with nice pictures: Everything is Shiny Everything has Fresnel |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |