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

SolidEnergy: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Added Garry's Mod as a supported game; moved CS:GO to same text entry. How can I get this parenthetical into the same sentence as "Portal 2" with the pixel shader template being the way it is?)
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 2: Line 2:
{{update}}
{{update}}


{{this is a|pixel shader|name=SolidEnergy|since=Portal 2|}} {{csgo|also|addtext={{gmod}}}} It is used for the fizzler, excursion funnel, light bridge, and laser field materials.
{{this is a|pixel shader|name=SolidEnergy|since=Portal 2|}} {{also|{{gmod}}}} It is used for the fizzler, excursion funnel, light bridge, and laser field materials.


{{todo|Properly document this!}}
{{todo|Properly document this!}}
Line 19: Line 19:
== Fresnel behavior ==
== Fresnel behavior ==


{{MatParam|$TANGENTTOPACITYRANGES|vector4|Enables view-based opacity falloff based on tangent t direction, great for cylinders, includes last term for scaling backface opacity.}}
{{MatParamDef|$TANGENTTOPACITYRANGES|vector4|Enables view-based opacity falloff based on tangent t direction, great for cylinders, includes last term for scaling backface opacity.}}
{{MatParam|$TANGENTSOPACITYRANGES|vector4|Enables view-based opacity falloff based on tangent s direction, great for cylinders, includes last term for scaling backface opacity.}}
{{MatParamDef|$TANGENTSOPACITYRANGES|vector4|Enables view-based opacity falloff based on tangent s direction, great for cylinders, includes last term for scaling backface opacity.}}
{{MatParam|$FRESNELOPACITYRANGES|vector4|Enables fresnel-based opacity falloff, includes last term for scaling backface opacity.}}
{{MatParamDef|$FRESNELOPACITYRANGES|vector4|Enables fresnel-based opacity falloff, includes last term for scaling backface opacity.}}
{{MatParam|$NEEDSTANGENTT|bool|Set when tangenttopacityranges is defined.}}
{{MatParamDef|$NEEDSTANGENTT|bool|Set when tangenttopacityranges is defined.}}
{{MatParam|$NEEDSTANGENTS|bool|Set when tangentsopacityranges is defined.}}
{{MatParamDef|$NEEDSTANGENTS|bool|Set when tangentsopacityranges is defined.}}
{{Note|When $NEEDSTANGENTT and $NEEDSTANGENTS are both true, $NEEDSTANGENTS is always set to false.}}
{{Note|When $NEEDSTANGENTT and $NEEDSTANGENTS are both true, $NEEDSTANGENTS is always set to false.}}
{{MatParam|$NEEDSNORMALS|bool|Set when fresnelopacityranges is defined.}}
{{MatParamDef|$NEEDSNORMALS|bool|Set when fresnelopacityranges is defined.}}




Line 34: Line 34:
{{tip|A <code>[[List Of Material Proxies#Entity integration|MaterialModify]]</code> proxy can instead be used to control the effects manually, for custom fizzlers.}}
{{tip|A <code>[[List Of Material Proxies#Entity integration|MaterialModify]]</code> proxy can instead be used to control the effects manually, for custom fizzlers.}}


{{MatParam|$powerup|float|Sets the progress through the power-up animation, with 0 being fully off and 1 being fully on.}}
{{bug|tested={{P2}}|[[trigger_portal_cleanser]]s will affect brushes that have the same material:
{{MatParam|$FLOW_VORTEX1|bool|Whether or not the first vortex is active.}}
* If multiple <code>trigger_portal_cleansers</code> have a different enabled state, the brush material will flicker on and off depending on the player's angle, but will otherwise copy their state.
{{MatParam|$FLOW_VORTEX_POS1|vector|World coordinates of the entity creating the first vortex.}}
* If the brush is within a specific range {{todo}} of a <code>trigger_portal_cleanser</code> the brush's material will detect objects within that range as if the brush was itself a <code>trigger_portal_cleanser</code>.
{{MatParam|$FLOW_VORTEX2|bool|Whether or not the second vortex is active.}}
}}
{{MatParam|$FLOW_VORTEX_POS2|vector|World coordinates of the entity creating the second vortex.}}
 
{{MatParamDef|$powerup|float|Sets the progress through the power-up animation, with 0 being fully off and 1 being fully on.}}
{{MatParamDef|$FLOW_VORTEX1|bool|Whether or not the first vortex is active.}}
{{MatParamDef|$FLOW_VORTEX_POS1|vector|World coordinates of the entity creating the first vortex.}}
{{MatParamDef|$FLOW_VORTEX2|bool|Whether or not the second vortex is active.}}
{{MatParamDef|$FLOW_VORTEX_POS2|vector|World coordinates of the entity creating the second vortex.}}


== Detail ==
== Detail ==
Line 44: Line 49:
This method must be used if the material is to be used on a model, as meshes will not render if a flowmap is applied.
This method must be used if the material is to be used on a model, as meshes will not render if a flowmap is applied.


{{MatParam|$detail1|texture|Detail texture 1}}
{{MatParamDef|$detail1|texture|Detail texture 1}}
{{MatParam|$detail2|texture|Detail texture 2}}
{{MatParamDef|$detail2|texture|Detail texture 2}}
etc
etc


Line 55: Line 60:




{{MatParam|$flowbounds|texture|Flowbounds texture}}
{{MatParamDef|$flowbounds|texture|Flowbounds texture}}
{{MatParam|$flow_color|RGB matrix|Color tint of the flowmap}}
{{MatParamDef|$flow_color|RGB matrix|Color tint of the flowmap}}


== Refract {{p2ce|only}} ==
== Refract {{p2ce|only}} ==
These parameters control the refraction effects added in {{p2ce|nt=1|3.1}}.
These parameters control the refraction effects added in {{p2ce|nt=1|3.1}}.
{{Bug|Any transparent textures or sprite effects will not render through this texture. Any {{ent|func_brush}} with alpha effects applied to it will render on top of this texture.}}
{{Bug|Any transparent textures or sprite effects will not render through this texture. Any {{ent|func_brush}} with alpha effects applied to it will render on top of this texture.}}
{{MatParam|$refract|bool|Enables refraction effects}}
{{MatParamDef|$refract|bool|Enables refraction effects}}
{{MatParam|$refractscale|float|Scale of the refraction}}
{{MatParamDef|$refractscale|float|Scale of the refraction}}
{{MatParam|$refracteffectscale|float|Scale of the refraction effect}}
{{MatParamDef|$refracteffectscale|float|Scale of the refraction effect}}


== Type 1 (Flowmap) Example ==
== Type 1 (Flowmap) Example ==

Latest revision as of 11:46, 23 August 2025

Stub

This article or section is a stub. You can help by expanding it.

Broom icon.png
This article or section needs to be updated to include current information regarding the subject.
Remember to check for any notes left by the tagger at this article's talk page.

SolidEnergy is a Pixel shader available in all Source Source games since Portal 2 Portal 2. (also in Garry's Mod) It is used for the fizzler, excursion funnel, light bridge, and laser field materials.

Todo: Properly document this!
Todo: Add images

Supported effects

Todo: What other effects does this shader support?

Fresnel behavior

Enables view-based opacity falloff based on tangent t direction, great for cylinders, includes last term for scaling backface opacity.
Enables view-based opacity falloff based on tangent s direction, great for cylinders, includes last term for scaling backface opacity.
Enables fresnel-based opacity falloff, includes last term for scaling backface opacity.
Set when tangenttopacityranges is defined.
Set when tangentsopacityranges is defined.
Note.pngNote:When $NEEDSTANGENTT and $NEEDSTANGENTS are both true, $NEEDSTANGENTS is always set to false.
Set when fresnelopacityranges is defined.


Powerup and vortex parameters

These material parameters are used to control the power-up animation, and up to two vortexes which normally appear when objects are nearby. They are generally set by the FizzlerVortex proxy.

Tip.pngTip:A MaterialModify proxy can instead be used to control the effects manually, for custom fizzlers.
Icon-Bug.pngBug:trigger_portal_cleansers will affect brushes that have the same material:
  • If multiple trigger_portal_cleansers have a different enabled state, the brush material will flicker on and off depending on the player's angle, but will otherwise copy their state.
  • If the brush is within a specific range [Todo] of a trigger_portal_cleanser the brush's material will detect objects within that range as if the brush was itself a trigger_portal_cleanser.
  (tested in: Portal 2)
Sets the progress through the power-up animation, with 0 being fully off and 1 being fully on.
Whether or not the first vortex is active.
World coordinates of the entity creating the first vortex.
Whether or not the second vortex is active.
World coordinates of the entity creating the second vortex.

Detail

When using a basetexture, the shader also renders 2 optional detail textures, which are blended with the basetexture. Both of these detail textures use the same syntax of variant parameters as $detail, with "$detail1" or "$detail2" replacing the "$detail" prefix. (eg: $detail1scale 1) This method must be used if the material is to be used on a model, as meshes will not render if a flowmap is applied.

Detail texture 1
Detail texture 2

etc

Flowbounds

If a flowmap is used, the material uses an additional texture comprised of three greyscale masks on each of the color channels.

  • Red controls the flow speed
  • Green controls the tint amount from $flow_color
  • Blue controls the additive intensity, such as the ripples of a Fizzler


Flowbounds texture
Color tint of the flowmap

Refract (only in Portal 2: Community Edition)

These parameters control the refraction effects added in P2:CE.

Icon-Bug.pngBug:Any transparent textures or sprite effects will not render through this texture. Any func_brush with alpha effects applied to it will render on top of this texture.  [todo tested in ?]
Enables refraction effects
Scale of the refraction
Scale of the refraction effect

Type 1 (Flowmap) Example

The example shown below is materials/effects/fizzler.vmt from Portal 2.

SolidEnergy
{
	$basetexture "effects/fizzler_ripples_dim"
	$flowmap "effects/fizzler_flow"
	$flowbounds "effects/fizzler_bounds"
	$FLOW_NOISE_TEXTURE "effects/fizzler_noise"
	$FLOW_UVSCROLLDISTANCE "0.25"
	$FLOW_TIMEINTERVALINSECONDS "1.2"
	$FLOW_NOISE_SCALE 0.003
	$FLOW_LERPEXP 1.5
	$FLOW_WORLDUVSCALE 0.008
	$FLOW_NORMALUVSCALE 0.008
	$FLOW_COLOR "[0.025 0.08 0.1]"
	$FLOW_VORTEX_COLOR "[0.64 2.058 2.56]"
	$surfaceprop glass
	"%keywords" Portal2
	$translucent 1
	$additive 1
	$FLOW_VORTEX_SIZE 35

	"360?$outputintensity" 2.8
	"SonyPS3?$outputintensity" .7
	"srgb_pc?$outputintensity" 2.3
	"!srgb_pc?$outputintensity" 1.7

	Proxies
	{
		FizzlerVortex
		{
		}
	}
}

Type 2 (Basetexture and Detail) Example

The example shown below is materials/effects/projected_wall.vmt from Portal 2.

SolidEnergy
{
      $basetexture "effects/projected_wall"
      $detail1 "effects/projected_wall_draw"
      $detail1scale 1
      $DETAIL1BLENDMODE 1
      $detail2 "effects/projected_wall_noise"
      $detail2scale 1
      $detail2blendmode 0
      $translucent 1
      $additive 1
      $vertexalpha 0
      $vertexcolor 0
      $nocull 1 
      $surfaceprop glass
      "%keywords" Portal2
      $detailscroll1 "[0 0]"
      $detailscroll2 "[0 0]"
      $detail2componentscale "[1 1]"
      $basescroll "[0 0]"
      $basescale "[1 1]"
      "!srgb?$outputintensity" .75
      Proxies
      {
             Sine 
             {
             sinemin 0
             sinemax 0.94
             sineperiod 5
             timeoffset 3
             resultVar "$detailscroll1[0]"
             }
             LinearRamp 
             {
             rate -3
             initialValue 0
             resultVar "$detailscroll1[1]"
             }
             LinearRamp 
             {
             rate 0.18
             initialValue 0
             resultVar "$detailscroll2[1]"
             }
             Sine 
             {
             sinemin 0.99
             sinemax 1.01
             sineperiod 0.125
             timeoffset 0
             resultVar "$detail2componentscale[0]"
             }
             Sine 
             {
             sinemin 0.995
             sinemax 1.005
             sineperiod 0.1
             timeoffset 0.05
             resultVar "$basescale[0]"
             }
             LinearRamp 
             {
             rate 0.15
             initialValue 0
             resultVar "$basescroll[1]"
             }
             TextureTransform
             {
             translateVar $detailscroll1
             resultVar $detail1texturetransform
             }
             TextureTransform
             {
             translateVar $detailscroll2
             scaleVar $detail2componentscale
             resultVar $detail2texturetransform
             }
             TextureTransform
             {
             translateVar $basescroll
             scaleVar $basescale
             resultVar $basetexturetransform
             }
      }
}