Facepunch / garrysmod-requests

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

Add option to edit EP1 Core shader normals computation origin instead of it being a hardcoded value #1428

Closed Gmod4phun closed 6 months ago

Gmod4phun commented 5 years ago

As seen here the position is hardcoded in-engine at (2688, 12139, 5170).

I am not sure if it is possible to make it changeable, but if it is, it would be nice to probably use the position of the entity so that it works on any position, and with multiple of the entities spawned.

Kefta commented 5 years ago

The diameter is also hardcoded: https://github.com/VSES/SourceEngine2007/blob/43a5c90a5ada1e69ca044595383be67f40b33c61/src_main/materialsystem/stdshaders/core_ps2x.fxc#L129-L130 https://github.com/VSES/SourceEngine2007/blob/43a5c90a5ada1e69ca044595383be67f40b33c61/src_main/materialsystem/stdshaders/core_vs11.fxc#L138-L140

stepa2 commented 4 years ago

In Black Mesa, the following vmt exists:

"Core"
{
    "$normalmap" "Models/props_lambda/superportal/superportal_normal"
    "$dudvmap"  "Models/props_lambda/superportal/superportal_dudv"
    "$corecolortexture" "Models/props_lambda/superportal/eg_superportal_warpcolor"
    "$flowmap" "models/props_lambda/superportal/superportal_flow"
    "$model" 1
    "$envmap" "env_cubemap"

// YOU CAN **** WITH THESE.
    "$REFRACTAmOUNT" "0.25"
    "$FLOWMAPSCROLLRATE" "[.0475 .133]"
    "$refracttint" "[0.5 1 0.3]"
    "$envmaptint" "[0.8 0.6 0.6]"
// SET THIS TO THE DIAMETER OF YOUR MODEL
    "$DIAMETER" "100"
    "$DMin" 600
    "$DMax" 700
// LEAVE THIS ALONE, EntityOrigin IS SET BY THE PROXY
    "$entityorigin" "{2688 12139 5170}"//needed for proxy

// BUT DON'T **** WITH THESE BRO.
    "$FLOWMAPTEXCOORDOFFSET" "1.0"
    "$TempMin" 0.21
    "$TempMax" 0.22

    "core_dx70"
    {
        "$fallbackmaterial" "models/props_lambda/superportal/superportal_dx70"
    }

    "core_dx80"
    {
        "$normalmap" "dev/water_normal"
        "$dudvmap"  "dev/water_dudv"
        "$bumptransform" "center .5 .5 scale 5 5 rotate 0 translate 0 0"
        "$envmapcontrast" "1.0"
    }

    "Proxies"
    {
        "EntityOrigin"
        {
            // assign $entityorigin
        }
        "Sine"
        {
            "resultVar" "$DIAMETER"
            "sineperiod" 4
            "sinemin" "$DMin"
            "sinemax" "$DMax"
        }
        "Sine"
        {
            "resultVar" "$FLOWMAPTEXCOORDOFFSET"
            "sineperiod" 4
            "sinemin" "$TempMin"
            "sinemax" "$TempMax"
        }
        "AnimatedTexture"
        {
            "animatedtexturevar" "$normalmap" 
            "animatedtextureframenumvar" "$bumpframe"
            "animatedtextureframerate" 29.00
        }
    }
}

The differences in shader parameters are:

You can use this interface to implement the request (it could also allow to use BM models without changes)

robotboy655 commented 6 months ago

Done. I have decided to borrow the naming mentioned above for the variables.

$EntityOrigin [ 0 0 0 ]
$Diameter 430

etc

Gmod4phun commented 6 months ago

After 5 years in development, hopefully it will be worth the wait :)