# Difference between revisions of "Talk:Material proxies"

NvC DmN CH (talk | contribs) m (whoops, $two = 0 lol. sry for spamming edits) |
|||

(13 intermediate revisions by 7 users not shown) | |||

Line 12: | Line 12: | ||

I'm doing "resultVar" "$color[0] but it's always returning not found. What am I missing? | I'm doing "resultVar" "$color[0] but it's always returning not found. What am I missing? | ||

− | My proxy: | + | <nowiki>My proxy: |

"Proxies" | "Proxies" | ||

{ | { | ||

Line 18: | Line 18: | ||

{ | { | ||

"textureScrollVarR" "$color[0]" | "textureScrollVarR" "$color[0]" | ||

− | ... | + | ...</nowiki> |

Then in code: | Then in code: | ||

− | + | <nowiki> char const* nameR = data->GetString( "textureScrollVarR" );</nowiki> | |

then... | then... | ||

− | + | <nowiki> m_pTextureScrollVarR = material->FindVar( nameR, &foundR, false );</nowiki> | |

foundR always returns false. | foundR always returns false. | ||

--[[User:Mflux|Mflux]] 04:00, 12 October 2009 (UTC) | --[[User:Mflux|Mflux]] 04:00, 12 October 2009 (UTC) | ||

+ | |||

+ | == Spray == | ||

+ | It's possible to use Proxies with Sprays in game? --[[User:Mehiller|Mehiller]] 10:30, 3 April 2011 (UTC) | ||

+ | :I don't know (many apologies), but I would consider this question on a game-to-game basis. For example, L4D Series might have restrictions on sprays that other Valve games don't have.--[[User:ThaiGrocer|ThaiGrocer]] 19:25, 2 April 2011 (UTC) | ||

+ | |||

+ | ---- | ||

+ | |||

+ | "Deleted" --[[User:Mehiller|Mehiller]] 18:10, 3 April 2011 (UTC) | ||

+ | |||

+ | ::You can't modify the vmt of sprays, afaik a default vmt per player is used and its basetexture param is modified to point to your custom spray. --[[User:Biohazard 90|Biohazard]] 10:51, 3 April 2011 (UTC) | ||

+ | :::Hmmm... Ok. Of course! That why "temp" folder in "materials" have only .vtf! This folder haven't any .vmt files. --[[User:Mehiller|Mehiller]] 18:10, 3 April 2011 (UTC) | ||

+ | |||

+ | == No square roots? == | ||

+ | There is no way to compute a square root as of now. No proxy like this exists. This is very limiting and annoying because it would have been easy to implement. Classic valve. --[[User:NvC DmN CH|NvC DmN CH]] ([[User talk:NvC DmN CH|talk]]) 16:24, 27 May 2019 (UTC) | ||

+ | ::Actually I worked around this limitation by implementing my own sqrt: | ||

+ | ::<source lang=php> | ||

+ | //SQUARE ROOT | ||

+ | $two "2.0" | ||

+ | |||

+ | $temp "0" | ||

+ | $temp2 "0" | ||

+ | $temp3 "0" | ||

+ | |||

+ | //$x=input | ||

+ | $x "0" | ||

+ | $x_sqrt "0" | ||

+ | |||

+ | |||

+ | |||

+ | |||

+ | |||

+ | |||

+ | //APPROXIMATION -------------------------------------- | ||

+ | //prod | ||

+ | Divide | ||

+ | { | ||

+ | srcVar1 $x | ||

+ | srcVar2 $two | ||

+ | resultVar $temp | ||

+ | } | ||

+ | |||

+ | //approx p1 | ||

+ | Divide | ||

+ | { | ||

+ | srcVar1 $x | ||

+ | srcVar2 $temp | ||

+ | resultVar $temp2 | ||

+ | } | ||

+ | |||

+ | //approx p2 | ||

+ | Add | ||

+ | { | ||

+ | srcVar1 $temp | ||

+ | srcVar2 $temp2 | ||

+ | resultVar $temp3 | ||

+ | } | ||

+ | |||

+ | //approx p3 | ||

+ | Divide | ||

+ | { | ||

+ | srcVar1 $temp3 | ||

+ | srcVar2 $two | ||

+ | resultVar $temp | ||

+ | } | ||

+ | |||

+ | //temp swap | ||

+ | Equals | ||

+ | { | ||

+ | srcVar1 $temp | ||

+ | resultVar $temp3 | ||

+ | } | ||

+ | |||

+ | |||

+ | |||

+ | |||

+ | //AVERAGING -------------------------------------- | ||

+ | //AVERAGE 1 | ||

+ | //p1 | ||

+ | Divide | ||

+ | { | ||

+ | srcVar1 $x | ||

+ | srcVar2 $temp3 | ||

+ | resultVar $temp | ||

+ | } | ||

+ | |||

+ | //p2 | ||

+ | Add | ||

+ | { | ||

+ | srcVar1 $temp3 | ||

+ | srcVar2 $temp | ||

+ | resultVar $temp2 | ||

+ | } | ||

+ | |||

+ | //p3 | ||

+ | Divide | ||

+ | { | ||

+ | srcVar1 $temp2 | ||

+ | srcVar2 $two | ||

+ | resultVar $temp3 | ||

+ | } | ||

+ | |||

+ | //AVERAGE 2 | ||

+ | //p1 | ||

+ | Divide | ||

+ | { | ||

+ | srcVar1 $x | ||

+ | srcVar2 $temp3 | ||

+ | resultVar $temp | ||

+ | } | ||

+ | |||

+ | //p2 | ||

+ | Add | ||

+ | { | ||

+ | srcVar1 $temp3 | ||

+ | srcVar2 $temp | ||

+ | resultVar $temp2 | ||

+ | } | ||

+ | |||

+ | //p3 | ||

+ | Divide | ||

+ | { | ||

+ | srcVar1 $temp2 | ||

+ | srcVar2 $two | ||

+ | resultVar $temp3 | ||

+ | } | ||

+ | |||

+ | //AVERAGE 3 | ||

+ | //p1 | ||

+ | Divide | ||

+ | { | ||

+ | srcVar1 $x | ||

+ | srcVar2 $temp3 | ||

+ | resultVar $temp | ||

+ | } | ||

+ | |||

+ | //p2 | ||

+ | Add | ||

+ | { | ||

+ | srcVar1 $temp3 | ||

+ | srcVar2 $temp | ||

+ | resultVar $temp2 | ||

+ | } | ||

+ | |||

+ | //p3 | ||

+ | Divide | ||

+ | { | ||

+ | srcVar1 $temp2 | ||

+ | srcVar2 $two | ||

+ | resultVar $temp3 | ||

+ | } | ||

+ | |||

+ | //AVERAGE 4 | ||

+ | //p1 | ||

+ | Divide | ||

+ | { | ||

+ | srcVar1 $x | ||

+ | srcVar2 $temp3 | ||

+ | resultVar $temp | ||

+ | } | ||

+ | |||

+ | //p2 | ||

+ | Add | ||

+ | { | ||

+ | srcVar1 $temp3 | ||

+ | srcVar2 $temp | ||

+ | resultVar $temp2 | ||

+ | } | ||

+ | |||

+ | //p3 | ||

+ | Divide | ||

+ | { | ||

+ | srcVar1 $temp2 | ||

+ | srcVar2 $two | ||

+ | resultVar $temp3 | ||

+ | } | ||

+ | |||

+ | //AVERAGE 5 | ||

+ | //p1 | ||

+ | Divide | ||

+ | { | ||

+ | srcVar1 $x | ||

+ | srcVar2 $temp3 | ||

+ | resultVar $temp | ||

+ | } | ||

+ | |||

+ | //p2 | ||

+ | Add | ||

+ | { | ||

+ | srcVar1 $temp3 | ||

+ | srcVar2 $temp | ||

+ | resultVar $temp2 | ||

+ | } | ||

+ | |||

+ | //p3 | ||

+ | Divide | ||

+ | { | ||

+ | srcVar1 $temp2 | ||

+ | srcVar2 $two | ||

+ | resultVar $temp3 | ||

+ | } | ||

+ | |||

+ | //AVERAGE 6 | ||

+ | //p1 | ||

+ | Divide | ||

+ | { | ||

+ | srcVar1 $x | ||

+ | srcVar2 $temp3 | ||

+ | resultVar $temp | ||

+ | } | ||

+ | |||

+ | //p2 | ||

+ | Add | ||

+ | { | ||

+ | srcVar1 $temp3 | ||

+ | srcVar2 $temp | ||

+ | resultVar $temp2 | ||

+ | } | ||

+ | |||

+ | //p3 | ||

+ | Divide | ||

+ | { | ||

+ | srcVar1 $temp2 | ||

+ | srcVar2 $two | ||

+ | resultVar $temp3 | ||

+ | } | ||

+ | |||

+ | //AVERAGE 7 | ||

+ | //p1 | ||

+ | Divide | ||

+ | { | ||

+ | srcVar1 $x | ||

+ | srcVar2 $temp3 | ||

+ | resultVar $temp | ||

+ | } | ||

+ | |||

+ | //p2 | ||

+ | Add | ||

+ | { | ||

+ | srcVar1 $temp3 | ||

+ | srcVar2 $temp | ||

+ | resultVar $temp2 | ||

+ | } | ||

+ | |||

+ | //p3 | ||

+ | Divide | ||

+ | { | ||

+ | srcVar1 $temp2 | ||

+ | srcVar2 $two | ||

+ | resultVar $temp3 | ||

+ | } | ||

+ | |||

+ | //AVERAGE 8 | ||

+ | //p1 | ||

+ | Divide | ||

+ | { | ||

+ | srcVar1 $x | ||

+ | srcVar2 $temp3 | ||

+ | resultVar $temp | ||

+ | } | ||

+ | |||

+ | //p2 | ||

+ | Add | ||

+ | { | ||

+ | srcVar1 $temp3 | ||

+ | srcVar2 $temp | ||

+ | resultVar $temp2 | ||

+ | } | ||

+ | |||

+ | //p3 | ||

+ | Divide | ||

+ | { | ||

+ | srcVar1 $temp2 | ||

+ | srcVar2 $two | ||

+ | resultVar $temp3 | ||

+ | } | ||

+ | |||

+ | |||

+ | //EVAULATE -------------------------------------- | ||

+ | Equals | ||

+ | { | ||

+ | srcVar1 $temp3 | ||

+ | resultVar $x_sqrt | ||

+ | } | ||

+ | //$x_sqrt is now square root of $x | ||

+ | </source> | ||

+ | ::Very long but it works! 8 averages is just about enough for normal numbers (up until about +-10000), after that the precision gradually gets lost and you need more averages (just copy paste more). --[[User:NvC DmN CH|NvC DmN CH]] ([[User talk:NvC DmN CH|talk]]) 20:19, 1 June 2019 (UTC) |

## Latest revision as of 20:23, 1 June 2019

Maybe I'm missing something here but how is that the proxies that require an entity talk to it. I want to animate a texture between 3 frames so how is it the entities repsonsibility to tell it to do that and how does it tell it to do that? A couple of working examples wouldn't go amis for this page. --Angry Beaver 16:52, 11 Aug 2006 (PDT)

Where can I find info about these dods parameters and do they work in sourcesdk base? $lightwarptexture $blendmodulatetexture --Bluestrike 10:02, 7 Dec 2006 (PST)

"The following proxies are defined in the client DLL for use in any Source game." Are those ALL the proxies, or is the list incomplete? I've found proxies in the gcf that I don't know if it's in the dll. Apart from those already added, I've also found "DepthWrite" (which is also a shader). --Andreasen 11:23, 28 Jan 2008 (PST)

---

I'm doing "resultVar" "$color[0] but it's always returning not found. What am I missing?

My proxy: "Proxies" { "TracerScroll" { "textureScrollVarR" "$color[0]" ...

Then in code: char const* nameR = data->GetString( "textureScrollVarR" ); then... m_pTextureScrollVarR = material->FindVar( nameR, &foundR, false );

foundR always returns false.

--Mflux 04:00, 12 October 2009 (UTC)

## Spray

It's possible to use Proxies with Sprays in game? --Mehiller 10:30, 3 April 2011 (UTC)

- I don't know (many apologies), but I would consider this question on a game-to-game basis. For example, L4D Series might have restrictions on sprays that other Valve games don't have.--ThaiGrocer 19:25, 2 April 2011 (UTC)

"Deleted" --Mehiller 18:10, 3 April 2011 (UTC)

- You can't modify the vmt of sprays, afaik a default vmt per player is used and its basetexture param is modified to point to your custom spray. --Biohazard 10:51, 3 April 2011 (UTC)
- Hmmm... Ok. Of course! That why "temp" folder in "materials" have only .vtf! This folder haven't any .vmt files. --Mehiller 18:10, 3 April 2011 (UTC)

- You can't modify the vmt of sprays, afaik a default vmt per player is used and its basetexture param is modified to point to your custom spray. --Biohazard 10:51, 3 April 2011 (UTC)

## No square roots?

There is no way to compute a square root as of now. No proxy like this exists. This is very limiting and annoying because it would have been easy to implement. Classic valve. --NvC DmN CH (talk) 16:24, 27 May 2019 (UTC)

- Actually I worked around this limitation by implementing my own sqrt:
//SQUARE ROOT $two "2.0" $temp "0" $temp2 "0" $temp3 "0" //$x=input $x "0" $x_sqrt "0" //APPROXIMATION -------------------------------------- //prod Divide { srcVar1 $x srcVar2 $two resultVar $temp } //approx p1 Divide { srcVar1 $x srcVar2 $temp resultVar $temp2 } //approx p2 Add { srcVar1 $temp srcVar2 $temp2 resultVar $temp3 } //approx p3 Divide { srcVar1 $temp3 srcVar2 $two resultVar $temp } //temp swap Equals { srcVar1 $temp resultVar $temp3 } //AVERAGING -------------------------------------- //AVERAGE 1 //p1 Divide { srcVar1 $x srcVar2 $temp3 resultVar $temp } //p2 Add { srcVar1 $temp3 srcVar2 $temp resultVar $temp2 } //p3 Divide { srcVar1 $temp2 srcVar2 $two resultVar $temp3 } //AVERAGE 2 //p1 Divide { srcVar1 $x srcVar2 $temp3 resultVar $temp } //p2 Add { srcVar1 $temp3 srcVar2 $temp resultVar $temp2 } //p3 Divide { srcVar1 $temp2 srcVar2 $two resultVar $temp3 } //AVERAGE 3 //p1 Divide { srcVar1 $x srcVar2 $temp3 resultVar $temp } //p2 Add { srcVar1 $temp3 srcVar2 $temp resultVar $temp2 } //p3 Divide { srcVar1 $temp2 srcVar2 $two resultVar $temp3 } //AVERAGE 4 //p1 Divide { srcVar1 $x srcVar2 $temp3 resultVar $temp } //p2 Add { srcVar1 $temp3 srcVar2 $temp resultVar $temp2 } //p3 Divide { srcVar1 $temp2 srcVar2 $two resultVar $temp3 } //AVERAGE 5 //p1 Divide { srcVar1 $x srcVar2 $temp3 resultVar $temp } //p2 Add { srcVar1 $temp3 srcVar2 $temp resultVar $temp2 } //p3 Divide { srcVar1 $temp2 srcVar2 $two resultVar $temp3 } //AVERAGE 6 //p1 Divide { srcVar1 $x srcVar2 $temp3 resultVar $temp } //p2 Add { srcVar1 $temp3 srcVar2 $temp resultVar $temp2 } //p3 Divide { srcVar1 $temp2 srcVar2 $two resultVar $temp3 } //AVERAGE 7 //p1 Divide { srcVar1 $x srcVar2 $temp3 resultVar $temp } //p2 Add { srcVar1 $temp3 srcVar2 $temp resultVar $temp2 } //p3 Divide { srcVar1 $temp2 srcVar2 $two resultVar $temp3 } //AVERAGE 8 //p1 Divide { srcVar1 $x srcVar2 $temp3 resultVar $temp } //p2 Add { srcVar1 $temp3 srcVar2 $temp resultVar $temp2 } //p3 Divide { srcVar1 $temp2 srcVar2 $two resultVar $temp3 } //EVAULATE -------------------------------------- Equals { srcVar1 $temp3 resultVar $x_sqrt } //$x_sqrt is now square root of $x

- Very long but it works! 8 averages is just about enough for normal numbers (up until about +-10000), after that the precision gradually gets lost and you need more averages (just copy paste more). --NvC DmN CH (talk) 20:19, 1 June 2019 (UTC)