New RT lens textures/shaders

This commit is contained in:
May Lian 2024-01-05 14:38:52 -03:00
parent 85ce70f810
commit 5c2d9feecb
6 changed files with 70 additions and 40 deletions

View File

@ -109,41 +109,38 @@ matproxy.Add({
end
})
local envmaptint = "$envmaptint"
local envmap = "$envmap"
local lastPos = Vector()
local lastValue = 0
local lerp = Lerp
matproxy.Add( {
name = "Arc9EnvMapTint",
init = function(self, mat, values)
local color = {1, 1, 1}
name = "Arc9EnvMapTint",
init = function(self, mat, values)
local color = {1, 1, 1}
if (values.color != nil) then
color = string.Explode(" ", string.Replace(string.Replace(values.color, "[", ""), "]", ""))
end
if (values.color != nil) then
color = string.Explode(" ", string.Replace(string.Replace(values.color, "[", ""), "]", ""))
end
self.min = values.min || 0
self.max = values.max || 1
self.color = Vector(color[1], color[2], color[3])
mat:SetTexture(envmap, values.envmap || "arc9/shared/envmaps/specularity_50")
end,
self.min = values.min || 0
self.max = values.max || 1
self.color = Vector(color[1], color[2], color[3])
mat:SetTexture("$envmap", values.envmap || "arc9/shared/envmaps/specularity_50")
end,
bind = function(self, mat, ent)
if (!IsValid(ent)) then return end
bind = function(self, mat, ent)
if (!IsValid(ent)) then return end
if (!lastPos:IsEqualTol(ent:GetPos(), 1)) then
local c = render.GetLightColor(ent:GetPos())
lastValue = (c.x * 0.2126) + (c.y * 0.7152) + (c.z * 0.0722)
lastValue = math.min(lastValue * 2, 1)
lastPos = ent:GetPos()
end
if (!lastPos:IsEqualTol(ent:GetPos(), 1)) then
local c = render.GetLightColor(ent:GetPos())
lastValue = (c.x * 0.2126) + (c.y * 0.7152) + (c.z * 0.0722)
lastValue = math.min(lastValue * 2, 1)
lastPos = ent:GetPos()
end
ent.m_Arc9EnvMapTint = Lerp(10 * FrameTime(), ent.m_Arc9EnvMapTint || 0, lastValue)
mat:SetVector(envmaptint, self.color * Lerp(ent.m_Arc9EnvMapTint, self.min, self.max))
end
ent.m_Arc9EnvMapTint = lerp(10 * RealFrameTime(), ent.m_Arc9EnvMapTint || 0, lastValue)
mat:SetVector("$envmaptint", self.color * lerp(ent.m_Arc9EnvMapTint, self.min, self.max))
end
})
----- Add this to your VMT to fix garbage/shitty reflection

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,22 +1,33 @@
"VertexlitGeneric"
{
"$basetexture" "effects/arc9/glass"
"$bumpmap" "effects/arc9/glass_nm"
"$translucent" 1
"$phong" 1
"$phongboost" "2"
"$phongexponent" 0
"$basetexture" "effects/arc9/lens_d"
"$bumpmap" "effects/arc9/lens_n"
"$phongexponenttexture" "effects/arc9/lens_s"
"$color2" "[0 0 0]"
"$translucent" "1"
"$phong" "1"
"$phongboost" "1"
"$phongexponent" "10"
"$phongfresnelranges" "[1 1 1]"
"$envmap" "env_cubemap"
"$envmapfresnel" "-200.0"
"$phongfresnelranges" "[0.01 0.35 3.0]"
"$normalmapalphaenvmapmask" "1"
"$envmapfresnel" "0"
//"$alpha" "0"
// "$envmaptint" "[2 2 2]"
//"$envmaptint" "[2 2 2]"
"$rimlight" "1"
"$rimmask" "1"
"$rimlightboost" "1"
"$rimlightexponent" "100"
"Proxies"
{
"arc9_scope_alpha"
{
"resultVar" "$envmaptint"
}
"arc9_scope_alpha"
{
"resultVar" "$envmaptint"
}
}
}

View File

@ -0,0 +1,22 @@
"VertexlitGeneric"
{
"$basetexture" "effects/arc9/glass"
"$bumpmap" "effects/arc9/glass_nm"
"$translucent" 1
"$phong" 1
"$phongboost" "2"
"$phongexponent" 0
"$envmap" "env_cubemap"
"$envmapfresnel" "-200.0"
"$phongfresnelranges" "[0.01 0.35 3.0]"
//"$alpha" "0"
// "$envmaptint" "[2 2 2]"
"Proxies"
{
"arc9_scope_alpha"
{
"resultVar" "$envmaptint"
}
}
}