True reflections under CSS: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Started translations.)
 
(Further translations/Rewording.)
Line 1: Line 1:
[[Image:exemple_vraie_reflet.jpg|thumb|right|300px|Real-time Reflections in CS:S]]
[[Image:exemple_vraie_reflet.jpg|thumb|right|300px|Real-time Reflections in CS:S]]


In Source, real-time reflections are only possible with the "water" shader. Les autres réflexions sont obtenues par Cubemaps, qui permettent des réflexions de basse qualité, suffisante pour des matériaux classiques, mais pas pour un miroir qui demande une haute résolution. Mais grâce à une astuce il est possible d'obtenir des réflexions en temps réel, cette technique consiste à superposer 2 matériaux, un shader normal transparent, couplé à un shader water disposant seulement de réflexions . Cette technique est idéale pour un sol, mais ne peut malheureusement pas s'appliquer à un mur, car le shader water ne fonctionne qu'à plat. Le shader water reflète tous sauf le joueur. {{DISPLAYTITLE:Vraie réflexions sous CSS}}
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.


Cette technique est inutile pour la version Orange Box, car elle dispose d'une entité pour les réflexions en temps réel, et elle peut s'appliquer à un mur :
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}}
'''Func_reflective_glass'''. Orange Box dispose aussi du shader '''LightmappedReflective'''.


== Pratique ==
== How it Works ==


[[Image:triple_material.jpg|thumb|right|300px|Les 3 matériaux.]]
[[Image:triple_material.jpg|thumb|right|300px|Les 3 matériaux.]]

Revision as of 11:35, 16 November 2021

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 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.

How it Works

Les 3 matériaux.

Il vous faut utiliser 3 couches de matériaux :

  • Un matériau normal, en alpha, en surface, là ou les joueurs marcheront. Optionnel.
  • 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

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.

Exemple :

LightmappedGeneric
{
         $alpha 0.6
         $basetexture ...
}

Remarque : Il est possible de ne pas se servir ce matériau, si par exemple vous voulez un sol en miroir.

Water

Water
{
          %compilewater 1
          $reflecttexture _rt_WaterReflection
          $reflectamount 0.1  // Plus la valeur est faible plus les vous aurez de reflections.
          $reflecttint "[1 1 1]"
          $normalmap ....  // Indiquer une texture de couleurs unie, comme une texture blanche.
          $fogenable 0
          $fogcolor "[1 1 1]"
          %compilepassbullets 1  
}

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.

Matériaux de Recouvrement

Entourez de bloc votre eau, afin qu'elle fonctionne correctement, le matériaux n'a pas d'importance.

Tutorial

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