Talk:Refract

From Valve Developer Community
Jump to navigation Jump to search
English (en)Deutsch (de)

Brushes

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)

Yes, the texture used for refraction is definitely a regular normal map. However I don't understand how refraction or normal maps work well enough to know what the blue channel would do. --Tiny Desk Engineer (Talk Page) 18:15, 24 June 2022 (PDT)
Looking at the shader source code it seems to just be a scalar from 0 to 1 for the refract amount. Grande1900 (talk) 11:38, 22 August 2023 (PDT)

Reflection

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

decals

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)

glasswindow_refract01 using missing texture for normals instead of normal map

I ported the material glass\glasswindow_refract01.vmt from Portal to Team Fortress 2, but for some reason, despite glass\glass_normal.vtf also being included in the tf\materials\glass folder, it uses the black and purple checkerboard texture for normals instead of the normal map that's set to be used by the material. --Tiny Desk Engineer (Talk Page) 18:13, 24 June 2022 (PDT)

Nevermind, apparently I managed to miss the fact that glass_normal.vtf was completely missing. --Tiny Desk Engineer (Talk Page) 06:23, 28 June 2022 (PDT)