This article relates to the game "Counter-Strike: Source". Click here for more information.
This article's documentation is for anything that uses the Source engine. Click here for more information.

True reflections under CSS: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Further translations/Rewording.)
No edit summary
 
(16 intermediate revisions by 8 users not shown)
Line 1: Line 1:
[[Image:exemple_vraie_reflet.jpg|thumb|right|300px|Real-time Reflections in CS:S]]
{{LanguageBar}}
{{Source topicon}} {{CSS topicon}}
[[Category:Level Design]]


Using the Source engine, the only way to get real-time reflections is to use the "water" shader (typically used for water textures). Typically, reflections are made possible by [[Cubemaps]], which are low-quality and pre-calculated but sufficient for most materials. Cubemaps are not useful for a mirror which requires a real-time reflection. There is a trick, however, that makes it possible to use real-time reflections in a custom material. this technique consists in superimposing (overlaying) 2 shaders: A normal transparent shader and a water shader (for reflections only). This technique is ideal for a floor, but unfortunately cannot be applied to a wall due to an engine limitation with the water shader. The water shader reflects everything in the world except for the player.
[[File:exemple_vraie_reflet.jpg|thumb|right|300px|Real-time Reflections in CS:S]]


This technique is mainly useless for the Orange Box version of CS:S because it has an entity for real-time reflections which can be applied to a wall: [[Func_reflective_glass]]. Orange Box also has the '''LightmappedReflective''' shader. {{DISPLAYTITLE:Real-time Reflections in CS:S}}
Using the Source engine, the only way to get real-time reflections is to use the "water" shader (typically used for water textures). Typically, reflections are made possible by [[cubemaps]], which are low-quality and pre-calculated but sufficient for most materials. Cubemaps are not useful for a mirror which requires a real-time reflection. There is a trick, however, that makes it possible to use real-time reflections in a custom material. this technique consists in superimposing (overlaying) 2 shaders: A normal transparent shader and a water shader (for reflections only). This technique is ideal for a floor, but unfortunately cannot be applied to a wall due to an engine limitation with the water shader. The water shader reflects everything in the world except for the player.


== How it Works ==
This technique is mostly useless since {{src07|4}}, because it has an entity for real-time reflections which can be applied to a wall: {{ent|func_reflective_glass}}, which uses the '''[[LightmappedReflective]]''' shader. However, this technique is still useful on {{bms|1}} as "LightmappedReflective" no longer works after the game uses deferred renderer in later updates.


[[Image:triple_material.jpg|thumb|right|300px|Les 3 matériaux.]]
{{Bug|Looking at the reflections while having {{code|[[func_precipitation]]}} on the map will cause the rain, snow or ash effect to be rotated.|hidetested=1}}


Il vous faut utiliser 3 couches de matériaux :
==How it Works==
[[File:triple_material.jpg|thumb|right|300px|The three materials:]]


* Un matériau normal, en alpha, en surface, là ou les joueurs marcheront. Optionnel.
You need to use 3 layers of materials:
* Un matériau avec le shader Water, qui n'affichera que les réflexions en temps réel.
* un matériau divers de recouvrement de l'eau, sinon elle ne fonctionnera pas correctement.


=== Matériaux de surface ===
* Normal material (in alpha) on the surface where players will walk. Optional.
* A material with the Water shader which will show reflections in real time.
* Something to overlay the water material (without this, it will not work properly).


Créer un Bloc d'une unité d'épaisseur et appliquez lui le matériau avec alpha. Il est important de laisser un espace, même de quelques dixièmes d'unités entre ce matériau et l'eau, ou l'alpha ne fonctionnera pas et vous aurez une sorte d'effet flou.
===Material for the Surface===
Create a brush that is 1 hammer unit thick and apply the material to it with alpha. It is important to leave a gap of any width between this material and the water, or the alpha will not work and you will have a kind of blurry effect.


Exemple :
Example :


  LightmappedGeneric
  LightmappedGeneric
Line 27: Line 31:
  }
  }


Remarque : Il est possible de ne pas se servir ce matériau, si par exemple vous voulez un sol en miroir.
===Water===
 
=== Water ===
 
  Water
  Water
  {
  {
           %compilewater 1
           %compilewater 1
           $reflecttexture _rt_WaterReflection
           $reflecttexture _rt_WaterReflection
           $reflectamount 0.1  // Plus la valeur est faible plus les vous aurez de reflections.
           $reflectamount 0.1  // The lower the value, the more reflections you will have.
           $reflecttint "[1 1 1]"
           $reflecttint "[1 1 1]"
           $normalmap ....  // Indiquer une texture de couleurs unie, comme une texture blanche.
           $normalmap ....  // Indicate a texture of solid colors, such as a solid white texture.
           $fogenable 0
           $fogenable 0
           $fogcolor "[1 1 1]"
           $fogcolor "[1 1 1]"
Line 43: Line 44:
  }
  }


Le paramètre de compilation '''"%compilepassbullets" 1''' permet de rendre le matériaux insensible aux effets extérieurs, les balles et les joueurs qui marcheront sur ce matériaux n'auront pas d'effet sur lui. Ce paramètre est indispensable pour CSS, car les balles traversent les Blocs, chaque fois que vous tirerez sur le sol vous aurez un  SPLASH, ce qui n'est pas réaliste. Vous pouvez aussi grâce à ce paramètre de compilation courir sur cette surface, comme sur un miroir.
The parameter '''"%compilepassbullets" 1''' will make the material unresponsive to external effects, balls and players who step on it will have no effect on it. This setting is essential for CSS, because the balls go through the Blocks, every time you shoot on the ground you will have a SPLASH, which is not realistic. You can also, thanks to this compilation parameter, run on this surface, as on a mirror.
 
=== Matériaux de Recouvrement ===
 
Entourez de bloc votre eau, afin qu'elle fonctionne correctement, le matériaux n'a pas d'importance.


== Tutorial ==
===Covering the Material===
It's pretty important to cover this material, but it doesn't matter how you do it.


==Tutorial==
http://www.interlopers.net/tutorials/19882
http://www.interlopers.net/tutorials/19882


[[Category:WIP]]
==Translation Notes==
I'm going to follow this tutorial to learn how it works, and then rewrite the page in a way that English readers can understand.

Latest revision as of 23:46, 9 September 2024

English (en)Français (fr)Translate (Translate)

Real-time Reflections in CS:S

Using the Source engine, the only way to get real-time reflections is to use the "water" shader (typically used for water textures). Typically, reflections are made possible by cubemaps, which are low-quality and pre-calculated but sufficient for most materials. Cubemaps are not useful for a mirror which requires a real-time reflection. There is a trick, however, that makes it possible to use real-time reflections in a custom material. this technique consists in superimposing (overlaying) 2 shaders: A normal transparent shader and a water shader (for reflections only). This technique is ideal for a floor, but unfortunately cannot be applied to a wall due to an engine limitation with the water shader. The water shader reflects everything in the world except for the player.

This technique is mostly useless since Source 2007 Source 2007, because it has an entity for real-time reflections which can be applied to a wall: func_reflective_glass, which uses the LightmappedReflective shader. However, this technique is still useful on Black Mesa as "LightmappedReflective" no longer works after the game uses deferred renderer in later updates.

Icon-Bug.pngBug:Looking at the reflections while having func_precipitation on the map will cause the rain, snow or ash effect to be rotated.

How it Works

The three materials:

You need to use 3 layers of materials:

  • Normal material (in alpha) on the surface where players will walk. Optional.
  • A material with the Water shader which will show reflections in real time.
  • Something to overlay the water material (without this, it will not work properly).

Material for the Surface

Create a brush that is 1 hammer unit thick and apply the material to it with alpha. It is important to leave a gap of any width between this material and the water, or the alpha will not work and you will have a kind of blurry effect.

Example :

LightmappedGeneric
{
         $alpha 0.6
         $basetexture ...
}

Water

Water
{
          %compilewater 1
          $reflecttexture _rt_WaterReflection
          $reflectamount 0.1  // The lower the value, the more reflections you will have.
          $reflecttint "[1 1 1]"
          $normalmap ....  // Indicate a texture of solid colors, such as a solid white texture.
          $fogenable 0
          $fogcolor "[1 1 1]"
          %compilepassbullets 1  
}

The parameter "%compilepassbullets" 1 will make the material unresponsive to external effects, balls and players who step on it will have no effect on it. This setting is essential for CSS, because the balls go through the Blocks, every time you shoot on the ground you will have a SPLASH, which is not realistic. You can also, thanks to this compilation parameter, run on this surface, as on a mirror.

Covering the Material

It's pretty important to cover this material, but it doesn't matter how you do it.

Tutorial

http://www.interlopers.net/tutorials/19882

Translation Notes

I'm going to follow this tutorial to learn how it works, and then rewrite the page in a way that English readers can understand.