env_screenoverlay fade in and out.

Another exquisite problem of mine.
I want env_screenoverlay to slap my texture on player’s screen, but instead of doing it in an instant, I’d like it to fade in and out.
Here are the methods which I tried out and which did not work at all, because I either made an error or for some other reason.

Method 1


"UnlitGeneric" (Also tried: Decal, Sprite, LightmappedGeneric)
{
	"$basetexture" "gm_evil_wizard/you_died_overlay"
	"$translucent" 1
	"$vertexalpha" 1 (makes the texture flicker when used as screen overlay, when texture's placed on brush it's fine)
	"$alpha" 1 (whether it's here or not is irrelevant because sine proxy does not change this value)** Values only from 0 to 1.

	Proxies
	{
		Sine
		{
			sineperiod	4 (fiddled with values here)
			sinemin	0 (fiddled with values here)
			sinemax	1 (fiddled with values here)
			resultVar	$alpha
		}
	}
}


Method 2


"UnlitGeneric"
{
	"$basetexture" "gm_evil_wizard/you_died_overlay"
	"$translucent" 1
	"$vertexalpha" 1
	"$alpha" 1

	Proxies
	{
		MaterialModify (left empty, just as the dev site says)
		{
		}
	}
}


MaterialModify - Used in conjunction with the material_modify_control (https://developer.valvesoftware.com/wiki/Material_modify_control) entity to configure arbitrary parameters from map I/O. Only works when the material is applied to an entity. MaterialModify takes no parameters.

Tried alpha without $, tried the texture with and without .vmt.
Yes, flags on trigger_push are checked (clients).

I looked far and wide for any tutorials that would help me resolve the problem, alas nothing I found was helpful.
If you know how to make the overlay texture fade in and out smoothly, I’d greatly appreciate sharing your vast knowledge.
:downs:

Make seperate screen overlay materials with alpha from 0 to 1 and then simply change env_screenoverlay’s texture with your trigger setup.

[editline]6th April 2016[/editline]

I mean this is a pretty hacky way but it should work.

The issue is that overlay texture itself is 1024x1024, if I wanted smooth transition I’d have to make 100 vmts or 255 vtfs (300 mb+) ? Furthermore, env_screenoverlay can only support up to 10 textures. My mind is racing through all things I’ve done and I keep thinking of other hacky ways to do it but after so many hours spent on the issue I am losing hope.

First of all you dont really need more than 10 textures to trick the human eye (unless its a really long fade, but then you can use several env_screenoverlay entities.)

And second, you don’t need a new .vtt for every alpha value. You need 1 .vtf and and handle the modified alpha in as many .vmt’s as you need.

I want to create an overlay of Dark Souls’ famous “YOU DIED”, so it needs to fade in in a second, stay for 2-3 seconds and fade out in another second, so whole thing will take 4-5 seconds. But your solution provides some window of opportunity, it needs lots of files though.

[editline]6th April 2016[/editline]

Well, apparently $alpha does not work well together with env_screenoverlay, meaning that whether I set it to 0 or 1, it’s always there with same opaqueness.

So many edits. Anyway, my friend managed to fix the texture, it works wen it’s applied on brushes, however, for env_screenoverlay, the only way my overlay could fade in and out is if I make the texture animated. That would increase the size immensely so it’s not really an option.
Therefore I came up with a hacky workaround, I will use camera and put a brush (or make it a particle effect) in front of its fov, so when the player gets pushed and gets into a trigger block, it will activate the camera and the overlay/particle to show up.

Post your screen overlay textures .vmf, I might be able to help.

Also you don’t need the camera for the setup you mentioned, you could parent the particle directly to the players view using https://developer.valvesoftware.com/wiki/Logic_measure_movement with the eye position type.

adding onto this, I think there’s a way to sort materials in Source such that they’re always on top-- https://developer.valvesoftware.com/wiki/$ignorez

point viewcontrol is not safe in multiplayer (if you used that).
It might not disable for everyone, and they might keep their view stuck for the rest of the map.
It’s a perm entity and the player is also one, so weird things could happen

Here are the files if you want to fiddle with them, I added some notes in .vmt file describing what I tried but it’s not all 100% checked: https://dl.dropboxusercontent.com/u/56809999/gm_evil_wizard.rar
I’ll check the logic_measure_movement, I hope that the particle will move together with player’s view and turning around. Thanks for this idea.

I think that my map will be for SP only, although it’s less fun to play, I am bad at coming up with multiplayer puzzles and it’s all hard to implement so point_viewcontrol is an option. However, I also have some fancy G-mod code that creates a camera and synchs it to a model of my choice, all tested and working. Should errors occur, I’ll use code, but thanks for your comcern :slight_smile:

I considered using aforementioned workaround with cameras seeing as the topic died having no other ideas.