From Valve Developer Community
Jump to: navigation, search


I'm pretty sure refraction on brushes wasn't possible in the original game. (It was a problem that was possible to fix as a modder; the render target wasn't being updated before the refracting brush models were rendered.) Perhaps they fixed it in the Orange Box version.

Refraction Map

Does the texture you use for refraction work in the same way as a normal map, where RGB equals XYZ?

And if so, what difference does the blue channel (Z axis) make?

--P4INKiller 01:43, 29 December 2009 (UTC)


Reflection with cubemap works on this shaders, on CSS Orange box. --Anarkia777 23:22, 15 July 2010 (UTC)


has anyone an idea how to properly use this shader for decals? it works but not correctly, because you can see through the material where it's on --Pfannkuchen 22:23, 1 August 2010 (UTC)

You can't. --Omnicoder 22:54, 1 August 2010 (UTC)
alright, would be nice though, if the decal wouldn't be too close to the surface... I already tried to move the decal a bit away from the surface(via code) but it didn't work --Pfannkuchen 12:08, 2 August 2010 (UTC)

Portal 2

Portal 2 seems to use new parameters (I can't get them working in P1, though i'd love to.) for the glass lights. Its basically an optical illusion to render an alpha channel in 3D and only refract the material underneath. (things like $localrefract).

Portal 2's glass light texture Refract { $model 1 $refractamount ".025" $bluramount 1 $REFRACTTINT "[.81 .89 1.0]" $scale "[1 1]" $normalmap "glass/refract_light_normal" $surfaceprop glass $localrefract 1 $localrefractdepth "0.05" $basetexture "glass/refract_light_color" $envmap "env_cubemap" hdr { $envmap "env_cubemap" } $envmapcontrast 1 $envmapsaturation .2 $envmaptint "[.2 .2 .2 ]" $normalmapalphaenvmapmask 1 $envmaplightscale .6 "<dx90" { $fallbackmaterial "glass/refract01_dx8" } }

Doh, forgot to sign it. --SpAMCAN 05:08, 29 May 2012 (PDT)

Convex Props

Whilst rendering a refract shader on a prop, any pixel of that same prop that would be seen through that material will not be rendered. Other shader types with translucency do not suffer this problem.

This is likely related to the way source handles rendering and writing to buffers. It's likely that the refract calculation is determined before writing color data from the current prop to buffer, thus causing color data BEHIND the prop to be used for refraction instead.

There is no solution to this except redesigning props to avoid this scenario, or not using Refract. Fortunately, this should be a rare scenario to come across. --DormantLemon 13:47, 10 March 2016 (UTC)