Ritualistic Forums

Ritualistic Forums (http://www.ritualistic.com/forums/index.php)
-   SiN Episodes Editing (http://www.ritualistic.com/forums/forumdisplay.php?f=23)
-   -   Water shaders for se1_highrise03, se1_finale01 (http://www.ritualistic.com/forums/showthread.php?t=18708)

Pa3PyX 11-02-2006 05:30 PM

Water shaders for se1_highrise03, se1_finale01
 
Suggestion to the developers (maybe for the next patch) -- the city vista reflections in the final maps look better (concerning contrast transitions close to the horizon) if we use the Water shader rather than LightmappedGeneric (UnlitGeneric would have been best for the purpose but unfortunately it doesn't seem to support animated bumpmaps). With Water shader, the trick is to make it not draw refraction but envmap reflection only. This can be done in DX80 version of the shader, but not in DX81 and DX90 versions (at least, not that I could figure out how). So the trick is to use the DX80 shader for all DX levels. For 95, 90, 81, and 80, DX80 shader will be used. For 70, we fall back to LightmappedGeneric_DX6 -- we do not support bumpmaps in DX6, but we still do support envmaps, so we still look OK. Below are the new .vmt's. I've also scaled the bumpmap twice so the bumpmap tiling doesn't cut the eye as much. The existing materials are probably good enough as they are for most people, this is just some more eyecandy.

File: highrise/highrise_water_cheap.vmt
Code:

"Water_DX80" {
        "%tooltexture" "dev/water2_normal"

        "$envmap" "environment maps/hr_ref"
        "$forcecheap" "1" // DX8/9 only
        "$reflecttint" "[1 1 1]" // DX8/9 only
        "$color" "[0 0 0]" // DX6 only (falls back to LightmappedGeneric)

        // DX8 kludge: $bumpframe / $bumptransform actually apply to $normalmap
        "$normalmap" "dev/water2_normal" // DX8/9 only
        // Stretch the bumpmap so periodicity is not as apparent
        "$bumpinvscale" "0.5" // Proxy var only
        "$bumptranslate" "[0 0]" // Proxy var only
        // So proxies don't swear in DX6
        "$bumpframe" "0"
        "$bumptransform" "center 0.5 0.5 scale 1 1 rotate 0 translate 0 0"

        "$surfaceprop" "water"
        "$bottommaterial" "dev/dev_waterbeneath2"

        // It doesn't matter what we set this to as we do not draw refraction here
        // and ignore WaterLOD ($envmap all over the place), but we get a warning if
        // we leave this undefined
        "$fogcolor" "{26 24 24}" // DX8/9 only

        "Proxies" {
                "AnimatedTexture" {
                        "animatedtexturevar" "$normalmap"
                        "animatedtextureframenumvar" "$bumpframe"
                        "animatedtextureframerate" "10"
                }

                "TextureScroll" {
                        "texturescrollrate" "0.025"
                        "texturescrollangle" "180"
                        "texturescrollvar" "$bumptranslate"
                }

                "TextureTransform" {
                        "scalevar" "$bumpinvscale"
                        "translatevar" "$bumptranslate"
                        "resultvar" "$bumptransform"
                }
        }
}

File: highrise/finale_water_cheap.vmt (the only difference is a different envmap and a different bumpmap scroll angle)
Code:

"Water_DX80" {
        "%tooltexture" "dev/water2_normal"

        "$envmap" "environment maps/fin"
        "$forcecheap" "1" // DX8/9 only
        "$reflecttint" "[1 1 1]" // DX8/9 only
        "$color" "[0 0 0]" // DX6 only (falls back to LightmappedGeneric)

        // DX8 kludge: $bumpframe / $bumptransform actually apply to $normalmap
        "$normalmap" "dev/water2_normal" // DX8/9 only
        // Stretch the bumpmap so periodicity is not as apparent
        "$bumpinvscale" "0.5" // Proxy var only
        "$bumptranslate" "[0 0]" // Proxy var only
        // So proxies don't swear in DX6
        "$bumpframe" "0"
        "$bumptransform" "center 0.5 0.5 scale 1 1 rotate 0 translate 0 0"

        "$surfaceprop" "water"
        "$bottommaterial" "dev/dev_waterbeneath2"

        // It doesn't matter what we set this to as we do not draw refraction here
        // and ignore WaterLOD ($envmap all over the place), but we get a warning if
        // we leave this undefined
        "$fogcolor" "{26 24 24}" // DX8/9 only

        "Proxies" {
                "AnimatedTexture" {
                        "animatedtexturevar" "$normalmap"
                        "animatedtextureframenumvar" "$bumpframe"
                        "animatedtextureframerate" "10"
                }

                "TextureScroll" {
                        "texturescrollrate" "0.025"
                        "texturescrollvar" "$bumptranslate"
                }

                "TextureTransform" {
                        "scalevar" "$bumpinvscale"
                        "translatevar" "$bumptranslate"
                        "resultvar" "$bumptransform"
                }
        }
}

Also, as far as I understand the fallback material definitions for DX6 are invalid the way these materials were originally defined:
Code:

"LightmappedGeneric"
{
        "Water_DX60"
        {
                "$fallbackmaterial" "nature/water_dx70"
        }
...
}

LightmappedGeneric will not use Water_DX60 under any circumstances, so that doesn't do anything. If you needed a separate material for DX6, it would have had to be defined as:
Code:

"LightmappedGeneric"
{
        "LightmappedGeneric_DX6"
        {
                "$fallbackmaterial" "nature/water_dx70"
        }
...
}

It would also have been cool to use realtime reflection there (with $forcereflectentities), but unfortunately that doesn't work right in a skybox.


All times are GMT -5. The time now is 02:08 PM.

Powered by vBulletin® Version 3.6.3
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.