Difference between revisions of "LightmappedReflective"

From Valve Developer Community
Jump to: navigation, search
(Added detailed shader information, mostly copied from water but also includes new material.)
m (Hello Tewan How Are You)
Line 1: Line 1:
 +
{{stub}}
 +
 
'''<code>LightmappedReflective</code>''' is the shader used by [[func_reflective_glass]]. This shader renders real-time reflection and refractions similar to [[Water (shader)]].
 
'''<code>LightmappedReflective</code>''' is the shader used by [[func_reflective_glass]]. This shader renders real-time reflection and refractions similar to [[Water (shader)]].
: {{warning|All parameters listed in the example (except [[$bumpframe]], [[%tooltexture]] and [[$surfaceprop]]) must be included when used, or [[func_reflective_glass]] may not work properly.}}
 
  
 
[[Category:Shaders]]
 
[[Category:Shaders]]
Line 29: Line 30:
  
 
{{bug|Adding proxies to a lightmappedreflective causes the texture to not be drawn.}}
 
{{bug|Adding proxies to a lightmappedreflective causes the texture to not be drawn.}}
{{bug|Does not appear to work in Portal 2}}
+
{{bug|Does not appear to work in [[Portal 2]] {{portal2}}}}
 +
{{bug|Only works in [[Counter-Strike: Global Offensive | CS:GO]] {{csgo}} if the texture is <code>$transparent</code>, which can cause depth sorting issues with particles such as smoke from smoke grenades.}}
 
{{todo|Could this be because it includes some default proxy in order for it to work, and once there is a user-defined proxy, those "behind the scenes" proxies are no longer there?}}
 
{{todo|Could this be because it includes some default proxy in order for it to work, and once there is a user-defined proxy, those "behind the scenes" proxies are no longer there?}}
 
== Shader parameters ==
 
 
=== Textures ===
 
 
{{MatParam|$basetexture|texture|Albedo texture, optional.}}
 
{{MatParam|[[normalmap|$normalmap]]|texture|[[bump map]], per-pixel warping of the reflection}}
 
{{MatParam|$bumpframe|int|Frame to start the animated du/dv map and bump map on, respectively. Somewhat confusingly, <code>$bumpframe</code> affects <code>$''normal''map</code>, which should be pointing to a [[bump map]].}}
 
{{MatParam|$bumptransform|matrix|Transforms the bump map texture.
 
{{VMT UVtransform}}}}
 
 
=== Reflection ===
 
 
{{MatParam|$reflecttexture|texture|Texture to use for reflection. For real-time reflections, use <code>[[_rt_WaterReflection]]</code>.}}
 
{{MatParam|$reflectamount|float|Amount of warp for the reflection. Higher values produce more warping.}}
 
{{MatParam|$reflecttint|RGB matrix|Color tint for the real-time reflection.}}
 
{{MatParam|$reflectance|float|Controls opacity of reflection. Similar to [[$alpha]]}}
 
{{MatParam|$envmapmask|texture|Per-pixel opacity of reflection}}
 
{{MatParam|$minreflectivity|float|{{todo|What is this?}}}}
 
{{MatParam|$maxreflectivity|float|{{todo|What is this?}}}}
 
 
===Refraction===
 
 
{{MatParam|$refracttexture|texture|Texture to use for refraction. For real-time refractions, use <code>[[_rt_WaterRefraction]]</code>.}}
 
{{MatParam|$refractamount|float|Amount of warp for the refraction. Higher values produce more warping.}}
 
{{MatParam|$refracttint|RGB matrix|Color of the refraction.
 
: {{warning|It is recommended that you set this to white or something close to white so that edge transitions work properly on DX9.}}}}
 
 
=== Other ===
 
 
{{MatParam|$surfaceprop|name|See [[$surfaceprop]].}}
 
{{MatParam|%tooltexture|texture|Defines the texture Hammer will display in the material browser.}}
 
{{MatParam|$fresnelpower|float|Controls fresnel effect of reflections.}}
 
{{MatParam|$translucent|boolean|No effect, but must be included or entity will not work properly.}}
 

Revision as of 19:26, 24 July 2019

LightmappedReflective is the shader used by func_reflective_glass. This shader renders real-time reflection and refractions similar to Water (shader).

Example

The example shown here is materials/glass/reflectiveglass001.vmt

"lightmappedreflective"
{
	"%tooltexture" "dev/flat_normal"
	"$refracttexture" "_rt_WaterRefraction"
	"$refractamount" "0"
	"$refracttint" "[.5 .5 .6]"

	"$reflecttexture" "_rt_WaterReflection"
	"$reflectamount" "0"
	"$reflecttint" "[1 1 1]"

	"$fresnelpower" "0"
	"$minreflectivity" "0.8"
	"$maxreflectivity" "1.0"
	
	"$normalmap" "dev/flat_normal"

	"$surfaceprop" "glass"
	"$bumpframe" "0"
}
Bug.png Bug: Adding proxies to a lightmappedreflective causes the texture to not be drawn.
Bug.png Bug: Does not appear to work in Portal 2 Portal 2
Bug.png Bug: Only works in CS:GO Counter-Strike: Global Offensive if the texture is $transparent, which can cause depth sorting issues with particles such as smoke from smoke grenades.

To do: Could this be because it includes some default proxy in order for it to work, and once there is a user-defined proxy, those "behind the scenes" proxies are no longer there?