Facepunch / garrysmod-requests

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

vmt shader improvements #1527

Open AutismoPiggo opened 4 years ago

AutismoPiggo commented 4 years ago

-add colored specular support without the need of stacking the meshes -add phongalbedotintboost (csgo exclusive) -make halflambert be disabled with $phong 1 ($phongdisablehalflambert) -add $diffuseexp (l4d2 exclusive) -fix the transparency issues with $translucent 1 -fix $detailtint not working with $bumpmap -fix $basemapalphaphongmask 1 disabling the normal map -fix $envmap glowing in dark areas -maybe add some other cool stuff too, like $detailnormal

Kinyom commented 4 years ago

+1 for $detailnormal. And wait, $envmap isn't supposed to glow like nobody's business when it's in a dark area?! I always assumed that was a normal feature you just had to disable by tinting the specular waaaaay down.

Kinyom commented 4 years ago

Okay, little note, I'm not sure if the glowing envmaps thing is possible; it seems that it occurs from shitty cubemap placement, where bright cubemaps showing an outside area are used indoors in a dark area. gm_construct seems to be the worst offender here.

One-Trick-Viper commented 4 years ago

it is most definitely possible, people have already written material proxies that automatically tints the envmap depending on the brightness of where the entity is placed.

so yes, it's very possible.

Kinyom commented 4 years ago

Oh, that's great. Say, do you have a link to one of those?

One-Trick-Viper commented 4 years ago

afaik, phunbase is the only base with a real-time tinting material proxy, i think the folks at TFA base were working on something similar but i'm not sure if it was ever finished.

you can find the proxy code in: lua/autorun/phunbase_envmap_proxy.lua

and you can find a VMT example including the proxy in: materials/phunbase/envmaps/envmap_example.vmt

here's a video demonstrating said proxy.

Kinyom commented 4 years ago

afaik, phunbase is the only base with a real-time tinting material proxy, i think the folks at TFA base were working on something similar but i'm not sure if it was ever finished.

you can find the proxy code in: lua/autorun/phunbase_envmap_proxy.lua

and you can find a VMT example including the proxy in: materials/phunbase/envmaps/envmap_example.vmt

here's a video demonstrating said proxy.

Little addition; I actually had an idea for how this could be done with map cubemaps - just collecting each one on map start by reading the .bsp file, storing the light color of their position, then using a proxy to tint them in realtime based on render position. I’ve managed to read all the cubemaps and their positions and lighting from .bsps, so all I’d need to do is write a proxy for it. May upload the code to github sometime.