Bug 3795 - Proposed Detailtextures-Enabled Shaders
Status: NEW
Alias: None
Product: Tremulous
Classification: Unclassified
Component: Video
Version: unspecified
Hardware: PC Linux
: P3 enhancement
Assignee: Tim Angus
QA Contact: Tremulous Bugs
URL:
Depends on:
Blocks:
 
Reported: 2008-10-07 17:16 EDT by Evan Goers
Modified: 2008-11-04 15:08:40 EST
0 users

See Also:


Attachments
Proposed shader changes (3.54 KB, application/x-gzip)
2008-10-07 17:17 EDT, Evan Goers

Description Evan Goers 2008-10-07 17:16:59 EDT
I am requesting a modification to the shaders to enable detail texture support for added effects. These can be completely disabled with r_detailtextures 0. None of my modifications affect gameplay, due to its subtle nature.

Here is the jist of most of the shaders:

shaderpath
{
    { // this block is the default shader for entities without explicit shaders
        map texturemappath
        rgbGen lightingDiffuse
    }
    { // enable specular lighting
        map $whiteimage
        blendFunc GL_DST_COLOR GL_SRC_ALPHA
        detail
        alphaGen lightingSpecular
    }
    { // this part is for metal and alien flesh
        map environmentmappath(such as models/buildables/mgturret/ref_map.jpg)
        blendFunc GL_DST_COLOR GL_SRC_ALPHA
        detail
        tcGen environment
    }
}

This modification enables specular lighting on all the players and structures, as well as an environment map on the metallic or slimy shaders(such as aliens and human structures/armor).

Yes, this is the ShinyTrem mod(check the forums), minus the map shader modifications. I am hoping to get this into SVN as it has the ability to be completely disabled if the player sees fit.

Some of the structures don't seem to work with these modifications, such as the armory. The Armory and Hovel both look like they do in 1.1.0 with and without this modification, as if the new shaders don't even work. It might have to do with the way the models reference the shaders.

Some surfaces look absolutely stunning with this(try looking at the Medistation!), and I think Tremulous would benefit from it.
Comment 1 Evan Goers 2008-10-07 17:17:54 EDT
Created attachment 1884 [details]
Proposed shader changes
Comment 2 Evan Goers 2008-11-01 01:14:38 EDT
Revised example shader(to fix vertex lighting mode)

shaderpath
{
    { // this block is the default shader for entities without explicit shaders
        map texturemappath
        rgbGen lightingDiffuse
    }
    { // enable specular lighting
        map $whiteimage
        rgbGen lightingDiffuse
        blendFunc GL_DST_COLOR GL_SRC_ALPHA
        detail
        alphaGen lightingSpecular
    }
    { // this part is for metal and alien flesh
        map environmentmappath(such as models/buildables/mgturret/ref_map.jpg)
        blendFunc GL_DST_COLOR GL_ONE
        detail
        tcGen environment
    }
}


Problem is now, in order to fix the shader from becoming completely white in r_vertexLight mode, a second rgbGen lightingDiffuse is needed, in order to keep the second stage(the specular stage) as a detail texture. This obviously darkens the resulting surfaces.
Comment 3 Evan Goers 2008-11-04 15:08:40 EST
I have solved the problem by having the second stage use the texture of the first stage again. I don't know how much this impacts performance, but it can't be much.

shaderpath
{
    { // this block is the default shader for entities without explicit shaders
        map texturemappath
        rgbGen lightingDiffuse
    }
    { // enable specular lighting
        map texturemappath //again
        blendFunc GL_DST_COLOR GL_ONE
        detail
        alphaGen lightingSpecular
    }
    { // this part is for metal and alien flesh
        map environmentmappath(such as models/buildables/mgturret/ref_map.jpg)
        blendFunc GL_DST_COLOR GL_ONE
        detail
        tcGen environment
    }
}