Talk:List Of Material Proxies

From Valve Developer Community
Jump to: navigation, 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)