Talk:List of material proxies

From Valve Developer Community
Jump to navigation Jump to search

How to do a water who change color fog, with use a button in game? Thx. --Anarkia777 18:10, 27 July 2010 (UTC)

Use a material_modify_control. --TomEdwards 20:13, 27 July 2010 (UTC)

Does the LampBeam proxy really exist? I get: "Error: Material "effects/ray02" : proxy "LampBeam" not found!" when trying to use it. A solution if you're looking to hide flat geometry light effects is making the material fade when the player gets near:

//Variables

"$param" 0.3

"$playerdistance" 0.0

"$alpha_unclamped" 0.0

//Fade when player gets near

"Proxies" {

"PlayerProximity"
{
"resultVar" "$playerdistance"
}
"Subtract"
{
"srcVar1" "$playerdistance"
"srcVar2" "$param"
"resultVar" "$alpha_unclamped"
}
"Clamp"
{
"min" 0.0
"max" 1.0
"srcVar1" "$alpha_unclamped"
"resultVar" "$alpha"
}

}

--Fewes 14:44, 16 September 2010 (UTC)

Frac Proxy

I tried to make an animated material oscillating between the first and last frame in a linear fashion. The Frac proxy, which I had to use for this, does however not return the fractional part of the input number, but the integer part. It always returns an integer. I subtracted it's returnVal from the initial value and got the wanted result (float value between 0 and 1). Can someone confirm this and edit the page?

The finished material:

UnlitGeneric
{
    $basetexture "path_to/mytexture"

    $one 1
    $two 2
    $half 0.5
    $scalar 7.99
    $sl_counter 0
    $sl_oscillator 0
    $sl_floor 0
    $sl_frac 0
    $sl_rampup 0
    $sl_rampdowntmp 0
    $sl_rampdown 0

    Proxies
    {
        LinearRamp
        {
            rate 0.1
            initialvalue 0
            resultvar $sl_counter
        }

// Frac is actually a floor function!
        Frac
        {
            srcVar1 $sl_counter
            resultVar $sl_floor
        }
        Subtract
        {
            srcVar1 $sl_counter
            srcVar2 $sl_floor
            resultVar $sl_frac
        }
// sl_frac is now increasing from 0 to 1 and then set back to 0, as expected from a frac function

// will now make it oscillating between 0 and 1 
        Multiply
        {
            srcVar1 $sl_frac
            srcVar2 $two
            resultVar $sl_rampup
        }
        Subtract
        {
            srcVar1 $one
            srcVar2 $sl_frac
            resultVar $sl_rampdowntmp
        }
        Multiply
        {
            srcVar1 $sl_rampdowntmp
            srcVar2 $two
            resultVar $sl_rampdown
        }
        LessOrEqual
        {
            lessequalvar $sl_rampup
            greatervar $sl_rampdown
            srcVar1 $sl_frac
            srcVar2 $half
            resultVar $sl_oscillator
        }
        
// Done! And now scale it to 0 - 7.99 range, as our vtf has 8 frames

        Multiply
        {
            srcVar1 $sl_oscillator
            srcVar2 $scalar
            resultVar $frame
        }
    }
}

-MBit 16:09, 8 September 2011 (PDT)

PlayerHealth, PlayerDamageTime, and PlayerHealTime never existed.

(Confirmed through scanning the binaries and both the 2008 and Jungle Inferno code leak.) Should I remove the stated proxies above? They are never created in game. - Amicdict (talk) 09:45, 15 August 2021 (PDT)

Texturescrollrate is not units per second

And it probably never was. It appears to be how many textures per second, respective to the size of the current texture. A value of 1 means it takes 1 second for the texture to fully scroll one time, so a 512x512 texture would move exactly 512 pixels and be in the original place again. --Sirhephaestus (talk) 07:56, 27 August 2023 (PDT)

I changed the description for the SniperRifleCharge proxy.

It does not seem to return a value between 0 and 1. The only vmts that use it I found found start with materials/hud/sniperscope_* and use it to directly set "$basetexturetransform". Other items also seem to affect the value returned by the proxy. Here is an example vmt

"UnlitTwoTexture" { "$basetexture" "HUD/sniperscope_numbers" "$texture2" "HUD/sniperscope_numbers3" "$translucent" "1" "$additive" "1" "$ignorez" "1" "$nofog" "1"

"Proxies" { "SniperRifleCharge" { "resultVar" "$basetexturetransform" } } }

Case matters!

Do not try using lowercase for material proxy names as they will break. Copy the exact names from this page. May only be applicable to Source 2013 Multiplayer. --Sirhephaestus (talk) 19:31, 2 November 2024 (PDT)