This article's documentation is for anything that uses the Source engine. Click here for more information.

LightmappedReflective: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 1: Line 1:
{{This is a|s0|since=Source 2007|name=LightmappedReflective}}{{confirm}} This shader renders real-time reflection and refractions similar to [[Water (shader)]].
{{This is a|s0|since=Source 2007|name=LightmappedReflective}}{{confirm}} 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. Counter-Strike:Global Offensive additionally requires $translucent.}}
{{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. {{csgo|4}} additionally requires [[$translucent]].}}
{{Important|This shader <b><i>must</i></b> be used on a brush tied to a {{ent|func_reflective_glass}}, or the real time reflections will fail to work and it will be rendered as a plain brush.}}
{{Important|This shader <b><i>must</i></b> be used on a brush tied to a {{ent|func_reflective_glass}}, or the real time reflections will fail to work and it will be rendered as a plain brush.}}
{{Bug|In {{Bms|4}} this shader was missed in the deferred renderer update. To achieve the same effect, use [[3D Skybox]] with [[logic_measure_movement]] to simulate reflection or use the {{shader Name|Water}} [[shader]].}}
{{Bug|In {{Bms|4}} this shader was missed in the deferred renderer update. To achieve the same effect, use [[3D Skybox]] with [[logic_measure_movement]] to simulate reflection or use the {{shader Name|Water}} [[shader]].}}
Line 31: Line 31:


{{bug|Adding proxies to a lightmappedreflective causes the texture to not be drawn. (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?)}}
{{bug|Adding proxies to a lightmappedreflective causes the texture to not be drawn. (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?)}}
{{bug|If there is a portal in the reflection in Portal 2 and Portal 2 branch games, it will cause the game to crash. Almost works in The Beginner Guide under the same conditions. This is fixed in {{p2ce}}}}
{{bug|If there is a portal in the reflection in {{portal2|4}} and {{portal2|3.1}} branch games, it will cause the game to crash. Almost works in The Beginner Guide under the same conditions. This is fixed in {{p2ce|4}}}}
{{warning|Although this is functional in Portal 1, the reflection does not update when viewed through portals and portals will only update in the reflection if both of them are visible to you and to the func_reflective glass. Also, if the portals are rotated differently and viewed through the func_reflective_glass, the portals will display incorrectly. This second bug has carried over into {{p2}} and {{p2ce}}}}
{{warning|Although this is functional in {{portal|4}}, the reflection does not update when viewed through portals and portals will only update in the reflection if both of them are visible to you and to the func_reflective glass. Also, if the portals are rotated differently and viewed through the func_reflective_glass, the portals will display incorrectly. This second bug has carried over into {{p2|3.1}} and {{p2ce|3.1}}}}


== Shader parameters ==
== Shader parameters ==
Line 67: Line 67:
{{MatParam|$fresnelpower|float|Controls fresnel effect of reflections.}}
{{MatParam|$fresnelpower|float|Controls fresnel effect of reflections.}}
{{MatParam|$translucent|boolean|Will make the surface both reflective and transparent dependent on the angle and distance of view.
{{MatParam|$translucent|boolean|Will make the surface both reflective and transparent dependent on the angle and distance of view.
: {{warning| Must be set to "1" in Counter-Strike:Global Offensive, or the entity shifts its origin to [0 0 0].
: {{warning| Must be set to "1" in {{csgo|3.1}}, or the entity shifts its origin to [0 0 0].
::{{note|Fixed in {{Strata|3.1}}}}}}}}
:: {{note|Fixed in {{Strata|4}}}}}}}}

Revision as of 17:58, 23 November 2023

LightmappedReflective is a s0 available in all Source Source games since Source 2007 Source 2007.[confirm] This shader renders real-time reflection and refractions similar to Water (shader).

Warning.pngWarning:All parameters listed in the example (except $bumpframe, %tooltexture and $surfaceprop) must be included when used, or func_reflective_glass may not work properly. Counter-Strike: Global Offensive Counter-Strike: Global Offensive additionally requires $translucent.
Icon-Important.pngImportant:This shader must be used on a brush tied to a func_reflective_glass, or the real time reflections will fail to work and it will be rendered as a plain brush.
Icon-Bug.pngBug:In Black Mesa Black Mesa this shader was missed in the deferred renderer update. To achieve the same effect, use 3D Skybox with logic_measure_movement to simulate reflection or use the Shader-ball.png Water shader.  [todo tested in ?]

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"
}
Icon-Bug.pngBug:Adding proxies to a lightmappedreflective causes the texture to not be drawn. (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 tested in ?]
Icon-Bug.pngBug:If there is a portal in the reflection in Portal 2 Portal 2 and Portal 2 branch games, it will cause the game to crash. Almost works in The Beginner Guide under the same conditions. This is fixed in Portal 2: Community Edition Portal 2: Community Edition  [todo tested in ?]
Warning.pngWarning:Although this is functional in Portal Portal, the reflection does not update when viewed through portals and portals will only update in the reflection if both of them are visible to you and to the func_reflective glass. Also, if the portals are rotated differently and viewed through the func_reflective_glass, the portals will display incorrectly. This second bug has carried over into Portal 2 and Portal 2: Community Edition

Shader parameters

Textures

Warning.pngWarning:$bumpmap is NOT supported! $normalmap must be used!

$basetexture $normalmap $bumpframe $bumptransform

Reflection

$reflecttexture $reflectamount $reflecttint $reflectance $envmapmask $minreflectivity $maxreflectivity

Refraction

$refracttexture $refractamount $refracttint

Other

$surfaceprop %tooltexture $fresnelpower $translucent