Simple guide for real-time reflections in csgo V2

A Tutorial for Counter-Strike: Global Offensive

Updates

TutorialParentSubmitterStats
  • Overhaul rewrote the whole text and added some details I left out originally
  • Addition New method which fully takes advantage of the features available - is admittedly much more similar to Uraxz's description
V2 19d
  • Addition it's not a very good video but it gets the point across
added video 25d
So, in the original-original draft of this thing I went into much more detail about the actual functions of each of the parameters, but then for the original-release I decided I really didn't understand them well enough yet, and mostly just left that stuff out. I'm adding a lot of that back in, here.
My current understanding is that the best method involves splitting the original texture into two parts, where one consists of none more than $basetexture, $bumpmap, and $detail (and any subparameters that apply directly to those parameters)
The second part consists of a Lightmappedreflective texture with a clone of the original $basetexture, painted-over in all black. In theory you'd only need an equally-sized black texture but I would argue this is the most foolproof way to go about it.

A couple of noteworthy observations ahead of the rest;
- $basetexture alpha mask does not appear to have any effect on Lightmappedreflective materials
- $alpha, $alphatest do not appear to have any effect on Lightmappedreflective materials
- reflections can only add brightness to a given surface, not subtract it

Description of all relevant parameters;
- $basetexture: The reason I recommend using a masked version of your original basetexture is that it makes alligning the two layers easier, and using a different-resolution black texture will cause your bumpmap to be scaled incorrectly.
- $normalmap: Bumpmap used by Lightmappedreflective to warp both its reflection (and refraction(?)).
- $envmapmask: Per-pixel opacity of reflection
- $translucent: Value appears to have very slight effect on opacity of basetexture. If missing or set to value other than 1 during compilation will break the Reflectiveglass entity.
- $refracttexture (_rt_WaterRefraction): Engine texture used to warp refraction. If missing, material turns opaque.
- $refractamount: Value dictates amount of warping that will be applied to everything [obscured] behind the entity, using $refracttexture. Accepts any value, don't set to anything but 0 for this purpose.
- $refracttint: Colour intensity of everything [obscured] behind the entity, [0 0 0] is black, [1 1 1] is normal. Accepts values of 0 and above.
- $reflecttexture (_rt_WaterReflection): Engine texture used to warp reflection. If missing, entity will not provide reflection.
- $reflectamount: value dictates amount of warping that will be applied to everything reflected by the entity, using $reflecttexture. Accepts any value. Unlike $refractamount, does not appear to boost use of bumpmap.
- $reflecttint: Colour intensity of everything reflected by the entity, [0 0 0] is black, [1 1 1] is normal. Accepts values of 0 and above.
- $fresnelpower: No observed effect.
- $minreflectivity / $maxreflectivity: No observed effect.
- $reflectance: Opacity of reflection. Pair low values with high $reflecttint values and vice-versa for best effect.

An example of a floor using this method:
///"tiles_b_dark-RefBase"
 Lightmappedgeneric
{
 $basetexture      "tk_custom/legacy-vtf/tiles_b_dark" /// edit of tile/hr_t/tiles_b
 $bumpmap            "tile/hr_t/tiles_b_normals"
 $surfaceprop        "Tile"
 $detail             "detail/detailconcrete001a"
  $detailscale       "[5 5 5]"
  $detailblendfactor ".9"
 $color              "[1 .9 .9]"
}

/// "tiles_b_dark-RefTop"
 Lightmappedreflective
{
 $basetexture                   "tk_custom/legacy-vtf/tiles_b_dark-black2" /// black-masked version of actual basetexture
 $normalmap                     "tile/hr_t/tiles_b_normals"
 $envmapmask                    "tk_custom/legacy-vtf/tiles_b_envmask" /// alpha mask of tile/hr_t/tiles_b_normals
 $translucent                   "1"
 $refracttexture                "_rt_WaterRefraction"
  $refractamount                "0"
  $refracttint                  "[1 1 1]"
 $reflecttexture                "_rt_WaterReflection"
  $reflectamount                "1"
  $reflecttint                  "[1 1 1]"
 $fresnelpower                  "1"
 $minreflectivity               "1.0"
 $maxreflectivity               "1.0"
 $reflectance                   ".025"
 $surfaceprop                   "no_decal"
}

Of course my previous method is still usable, with the upside of being much easier to use with surfaces made up of multiple textures, or blended textures. Downside being the reflections are less complex.

 Lightmappedreflective
{
 $normalmap                     "dev/flat_normal"
 $translucent                   "1" 
 $refracttexture                "_rt_WaterRefraction" 
  $refractamount                "0" 
  $refracttint                  "[1 1 1]" 
 $reflecttexture                "_rt_WaterReflection" 
  $reflectamount                "0" 
  $reflecttint                  "[.25 .25 .25]" 
 $fresnelpower                  "1" 
 $minreflectivity               "1.0" 
 $maxreflectivity               "1.0" 
 $reflectance                   "0.5"
 $surfaceprop                   "tile"
 %tooltexture                   "dev/flat_normal"
}

Both methods involve building a flat floor out of displacements, and using the "Raise to" option of the geometry painting tool to set the whole thing to -0.15, the smallest less-than-0 value that will not be rounded up to 0 and subsequently cause z-fighting. In all honesty I'm not sure if the compiler doesn't just round it down to -0.5 but hey who cares.
Next step is obviously to place the func_reflectiveglass at the same level as the floor (was). Disable shadows, receiving shadows, etc on the entity. You can make the func_reflectiveglass out of multiple blocks, just so long the reflective faces are all on the same 2-dimensional plane.
As far as I know, multiple seperate func_reflectiveglass entities may be within the same visleaf, just long - once again - they're all on the same plane.
Supposedly ragdolls and func_reflectiveglass don't have collision to oneanother, so if you care a lot about ragdolls not clipping -0.15 HU into the ground you can disable solidity and place a clip brush to act as the actual floor.
Sign up to access this!
  • NvC_DmN_CH avatar
    NvC_DmN_CH username pic Joined 5y ago
    Ripe Supporter
    There
    Apocalyptic Flag Affiliation: Apocalyptic
    3,382 points Ranked 1556th
    44 medals 4 legendary 9 rare
    • Returned 5000 times Medal icon
    • 15+ Entries! GameBanana’s Christmas Giveaway 2017 Medal icon
    • 1st Place - The Heatwave Skinning Contest Medal icon
    • Became a Ripe Supporter Medal icon
    • Submitted 20 Gamefiles Medal icon
    • 3rd Place - The
    NvC_DmN_CH avatar
    NvC_DmN_CH
    Apocalyptic Flag
    Affiliation
    Apocalyptic
    17d 14d
    Thunderkeil

    $fresnelpower actually is controlling the fresnel effect of reflections. That means its less reflective when you look at it directly (dot product with the camera vector and the normal of the surface) and more reflective when you look at it from lower angles (far away when you stand on a big surface).

    So this power should control how sharp should the gradient from non-reflectivity to full reflectivity be.

    Also, using this method, we are restricted to using only one vertical level of this type surface in the PVS at any given time, right (like with regular water)?.
    DmN means DiaMoNd avatar
    Mantra
    DmN means DiaMoNd
    URL to post:
  • Thunderkeil avatar
    Thunderkeil Joined 5y ago
    Offline
    6,670 points Ranked 742nd
    27 medals 3 legendary 5 rare
    • 15+ Entries! GameBanana’s Christmas Giveaway 2016 Medal icon
    • Returned 5000 times Medal icon
    • 15+ Entries! GameBanana’s Christmas Giveaway 2017 Medal icon
    • GameBanana’s Christmas Giveaway 2015 Day Three Winner! Medal icon
    • 8-14 Entries! GameBanana’s Christmas Giveaway 2015 Medal icon
    • Returned 1000 times Medal icon
    22d 19d
    I've ran some more tests and am finding there are definitely some more elements I should have covered in this, will probably be updating Friday.

    [edit]
    Text updated, may get a video to go along with the new text later
    URL to post:
  • NvC_DmN_CH avatar
    NvC_DmN_CH username pic Joined 5y ago
    Ripe Supporter
    There
    Apocalyptic Flag Affiliation: Apocalyptic
    3,382 points Ranked 1556th
    44 medals 4 legendary 9 rare
    • Returned 5000 times Medal icon
    • 15+ Entries! GameBanana’s Christmas Giveaway 2017 Medal icon
    • 1st Place - The Heatwave Skinning Contest Medal icon
    • Became a Ripe Supporter Medal icon
    • Submitted 20 Gamefiles Medal icon
    • 3rd Place - The
    NvC_DmN_CH avatar
    NvC_DmN_CH
    Apocalyptic Flag
    Affiliation
    Apocalyptic
    26d
    Good
    • Thanks x 1
    DmN means DiaMoNd avatar
    Mantra
    DmN means DiaMoNd
    URL to post:

Embed

Share banner
Image URL
HTML embed code
BB embed code
Markdown embed code

Credits

Key Authors
Thunderkeil
Thunderkeil Joined 5y ago
Offline
6,670 points Ranked 742nd
27 medals 3 legendary 5 rare
  • 15+ Entries! GameBanana’s Christmas Giveaway 2016 Medal icon
  • Returned 5000 times Medal icon
  • 15+ Entries! GameBanana’s Christmas Giveaway 2017 Medal icon
  • GameBanana’s Christmas Giveaway 2015 Day Three Winner! Medal icon
  • 8-14 Entries! GameBanana’s Christmas Giveaway 2015 Medal icon
  • Returned 1000 times Medal icon
tutorial..er?

Submitter

Thunderkeil avatar
Thunderkeil Joined 5y ago
Offline
6,670 points Ranked 742nd
27 medals 3 legendary 5 rare
  • 15+ Entries! GameBanana’s Christmas Giveaway 2016 Medal icon
  • Returned 5000 times Medal icon
  • 15+ Entries! GameBanana’s Christmas Giveaway 2017 Medal icon
  • GameBanana’s Christmas Giveaway 2015 Day Three Winner! Medal icon
  • 8-14 Entries! GameBanana’s Christmas Giveaway 2015 Medal icon
  • Returned 1000 times Medal icon

Thunderkeil
Creator
  • Paypal Donate
Sign up to access this!
Sign up to access this!
Sign up to access this!

Game

Sign up to access this!

Category

Details

Difficulty Level
Beginner

Attributes

Share

  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • Share on Google+
  • Today's Pick Dec 21 2018
  • 519 Views
  • 5 Posts
  • 27dSubmitted
  • 19dModified
  • 19dUpdated

Scores

  • Not yet rated
Sign up to access this!

WiPs by Submitter

More Mapping Tutorials

bcp.crwdcntrl.net tracking pixel