View Issue Details

IDProjectCategoryView StatusLast Update
0005046The Dark ModFeature proposalpublic14.09.2019 17:26
ReporterVanishedOne Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status newResolutionopen 
Summary0005046: Controllable gloss for specular maps
Description"The solution to the "plastic problem" is the glossmap, which is a separate greyscale map which indicates the glossiness of each texel, to go alongside the specularmap which gives the colour and brightness of the reflection at that point. The logical place to store the glossmap would be in the alpha channel of the specular map image, which is currently unused (of course there would need to be a suitable default value which matched the existing behaviour, since none of the current specularmap images will have alpha channels). I experimented with this in the very early days when D3 was still closed source, but could not get it to work, either because my shader was wrong or the engine simply wasn't passing through the specularmap's alpha channel to the shader at all. Now that everything is open source, it ought to be fixable."
http://forums.thedarkmod.com/index.php?/topic/19474-tutorial-better-textures-for-your-materials-wip-part-2a-is-up/&tab=comments#comment-425017

If this approach were taken, the 'alpha' stage keyword could also be used as a multiplier for overall control of the gloss level even where there's no gloss map to vary it between texels (like Prey's 'specularexp').
Additional InformationApparently this is what currently happens (leastways, I assume the GLSL shaders replicate the ARB shaders' behaviour):

"The "enhanced" interaction shader derives the glossiness part from the color-values of the specularmap, which were normally just driving the specular strength... The non "enhanced" shader does not do this and uses a preset gloss value instead."
http://forums.thedarkmod.com/index.php?/topic/11893-ungoliants-mapping-questions/page/14/&tab=comments#comment-333485
TagsNo tags attached.

Activities

VanishedOne

VanishedOne

23.08.2019 17:26

reporter   ~0011825

Interesting comment at https://github.com/TTimo/doom3.gpl/blob/aaa855815ab484d5bd095f347163194ac569abcc/neo/renderer/draw_arb2.cpp#L182 -- I wonder whether Doom 3 did (or was intended to do) anything with the alpha channel.
Judith

Judith

13.09.2019 05:48

reporter   ~0011846

This request seems unnecessary. The engine requires RGB specular anyway, so using a known workflow similar to this one: https://3dtotal.com/tutorials/t/brief-consideration-about-materials-pedro-toledo-texturing-lighting you can make proper speculars for both dielectric and conductive materials, adjusting the "specular power" via the texture intensity. I've been using such approach for my environment and it works. We just don't have a proper tutorial for making good speculars like that, so this technique isn't known among authors.
VanishedOne

VanishedOne

13.09.2019 16:12

reporter   ~0011848

You can adjust specular colour, yes. That's mentioned in the linked thread: 'The specular maps worked alright in Doom 3 because the environment called for lots of shiny metallic surfaces. But in a more real world setting there are more dielectric surfaces than not. And since you can't adjust glossiness to tone down bright highlights you darken your specular to compensate and sacrifice color saturation.' http://forums.thedarkmod.com/index.php?/topic/19474-tutorial-better-textures-for-your-materials-wip-part-2a-is-up/&do=findComment&comment=422944

If you've found a means of working around whatever limitations you encountered when you wrote 'You can use speculars based on inverted diffuse maps to simulate dielectric surfaces, the only problem is that you don't have a separate parameter to adjust specular power' http://forums.thedarkmod.com/index.php?/topic/19474-tutorial-better-textures-for-your-materials-wip-part-2a-is-up/&do=findComment&comment=422958 then good!

Sometimes I'd like to adjust the gloss while leaving the spec. colour where it is: http://idtechforums.fuzzylogicinc.com/index.php?topic=122.msg885#msg885
Judith

Judith

14.09.2019 08:51

reporter   ~0011851

Btw., "the solution to the plastic problem" isn't gloss map, it's using a RGB specular map, either based on diffuse colors for metals, or inverted diffuse colors for dielectric. Then you need to decide which parts are more smooth/shiny that others, there are many ways to do that. And you don't need high color saturation for dielectric surfaces. Quite contrary, you need to tone it down, so the resulting specular is white – you can go overboard with saturation and make it colored with inverse diffuse approach, so you have to be careful here.

As for putting the the glossmap in the specular texture alpha map – this is a pretty bad idea, since specular maps already use some kind of exponent, so they match the light textures in the map. Is it 100% / white in alpha? I don't think so, since the purpose of that feature is to have freedom in adjusting the specular hotspot below or beyond the default. So that would require reworking all the specular textures alpha channel to match the current default value. If anything, it would be much better to just expose a parameter in the blend specularmap stage.

Also, think of real-world use cases of those specular power parameter examples presented in the thread: these are mostly applicable to stuff like car paint, plastic, or Christmas glass balls. Not too many of these surface types in TDM world. The workaround for not having a direct control over a how big the specular hotspot is, is rather simple – using different (smaller) falloff textures in your lights. But even that is rarely needed in practice.
VanishedOne

VanishedOne

14.09.2019 14:44

reporter   ~0011854

Specular maps that have been compressed using the http://wiki.thedarkmod.com/index.php?title=DDS_creation#Guidelines_for_DDS_Textures guidelines don't have an alpha channel. It's possible of course that specular maps not compressed with the guidelines exist in the wild, and so requiring an explicit parameter in material shaders to turn gloss control on might be good.

Designing lighting schemes around gloss, especially in a game in which lighting plays a central gameplay role, isn't a simple workaround as I understand the term.
VanishedOne

VanishedOne

14.09.2019 17:26

reporter   ~0011857

Hmm, curious: textures/particles/ripple_1 (which uses the translucent/diffusemap _black combination) actually stipulates alpha 0 in the specular stage.

Issue History

Date Modified Username Field Change
18.08.2019 15:18 VanishedOne New Issue
18.08.2019 19:08 VanishedOne Description Updated
23.08.2019 17:26 VanishedOne Note Added: 0011825
13.09.2019 05:48 Judith Note Added: 0011846
13.09.2019 16:12 VanishedOne Note Added: 0011848
14.09.2019 08:51 Judith Note Added: 0011851
14.09.2019 14:44 VanishedOne Note Added: 0011854
14.09.2019 17:26 VanishedOne Note Added: 0011857