Playing Videos Ingame

Dynamic Material Expressions let you pull off a bunch of neat things, and they’re responsible for the video calls in the Alyx campaign.

The VR Monitor shader has a lot of options you can experiment with. In the interest of not slapping a bunch of Valve’s assets on the forums, I’ve put together a couple simple textures you can plug into some of its parameters.

Textures

Filmgrain Control filmgrain_control
Jitter Control jitter_control
Scanlines scanline_control
Vignette


Vsync vsync_control

Whichever shader you use, all you need to do is edit the dynamic expression and type in any name for the attribute, colorAttr works.

You’ll need to apply this material, either to a model or you can make a mesh in hammer and convert it to a model and place it as a prop_dynamic

In Hammer, you’ll need an info_offscreen_movie_texture. Target any dynamic entity using your material (basically avoid any prop_static entities), and plug in the name of the render attribute. In this case: colorAttr

As far as I know this won’t be something to worry about in sbox but if you’re doing this in alyx you’ll want to make sure your WEBM files are in your addon under the GAME folder, not the content folder. In my case that’s Half-Life Alyx\game\hlvr_addons\test\panorama\videos

Set it to autoplay or set up a way to trigger it ingame and it should work fine.

Experimenting with other shaders and plugging the attribute into other channels can yield some neat results.

28 Likes

How long until someone puts the entire Shrek movie on screen

But seriously, great tutorial and a lot of potential out of it

4 Likes

i can already feel it that someone is doing that now just because of your comment

3 Likes

Great. Now I can put Toddroll in my maps.

1 Like

looks great :heart_eyes:

1 Like

Great tutorial, nice work comrade.

1 Like

hello i have followed your guide and i am having some issues getting the video to play on the screen, here is my current set up:

playbackerr - Copy

as you can see on playback it will play the video however you can only observe color changes within the video instead of the video itself

as for resolutions i have tested 520x520, 720x720, 1080x1080, 1024x1024 and 1980x1080

if you have a potential solution please let me know, thank you