Facepunch / garrysmod-requests

Feature requests for Garry's Mod
83 stars 24 forks source link

A less hardcoded version of the VolumeClouds shader #2387

Open Vuthakral opened 1 month ago

Vuthakral commented 1 month ago

Details

This is the VolumeClouds shader present in Source. It provides a very cool and unique fake parallax effect by (presumably) multiplying the three $basetexture layers together.

https://github.com/Facepunch/garrysmod-requests/assets/4466200/d231d0d3-fe43-481f-950f-0d6af0197909

and a more obvious example of the "fake parallax" it can do:

https://github.com/Facepunch/garrysmod-requests/assets/4466200/78788a34-f9db-4e2e-94ff-2ef031a1645b

It unfortunately has a hardcoded rotation and does not accept any $basetexturetransform inputs on any of the three basetextures. This shader would be extremely cool to use if it (or a custom derivative) were to not have a hardcoded rotation and could take input, allowing mappers to create advanced cloud masks, developers to use it for hologram effects, and probably even more cool things others may come up with.

Here is my VMT setup from the video above:

VolumeClouds
{
    $basetexture    "shadertest\cloud"
    $basetexture2   "shadertest\cloud"
    $basetexture3   "shadertest\cloud"

    $refractamount  1 // This is said to be supported on the wiki but doesn't seem to do anything?

    Proxies
    {
        CurrentTime
        {
            resultVar   $Time
        }
    }
}
robotboy655 commented 1 month ago

$refractamount is a parameter the shader defines, but it is never used in the pixel shader itself.

I have added $BaseTextureSpeed, $BaseTexture2Speed, $BaseTexture3Speed to control the speed of the rotation, but I couldn't figure out a way to add the texture transform params to this shader.