🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Daily Update #7 - Another plane of being

Published August 12, 2018
Advertisement

During the past days, lots of shaders were updated and other visual things did too.

Firstly, I've added lights effects when the crystals get shattered. There's also a burst of particle emanating from the broken crystal on impact.

Also, enemies now leave a ragdoll corpse behind when they die. I love some of the poses those ragdolls make.

On another note, I've toyed around with corpse removal and got captivated by the shrinking effect it created.

d1.gif.a7e1d2f602c2990df2fe3448f433aefd.gif

It can sometimes be off-putting, but I'm still captivated.

I've also added a nice VHS-like effect from layering two VHS shader together; namely "more AVdistortion" and "VHS pause effect".

I've already ported the former and it's already active and the latter was just a matter of porting GLSL shaders to HLSL. No biggie.

I did change the code a bit to make the white noises move through time. And there's nothing like trigonometry to help us with that


fixed4 frag (v2f i) : SV_Target
{
	fixed4 col = fixed4(0, 0, 0, 0);
	// get position to sample
	fixed2 samplePosition = i.vertex.xy / _ScreenParams.xy;
	float whiteNoise = 9999.0;
	
	// Jitter each line left and right
	samplePosition.x = samplePosition.x + (((rand(float2(_UnscaledTime, i.vertex.y))-0.5)/64.0) * _EffectStrength );
	// Jitter the whole picture up and down
	samplePosition.y = samplePosition.y + (((rand(float2(_UnscaledTime, _UnscaledTime))-0.5)/32.0) * _EffectStrength );
	// Slightly add color noise to each line
	col += (fixed4(-0.5, -0.5, -0.5 , -0.5)+fixed4(rand(float2(i.vertex.y,_UnscaledTime)),rand(float2(i.vertex.y,_UnscaledTime+1.0)),rand(float2(i.vertex.y,_UnscaledTime+2.0)),0))*0.1;

	// Either sample the texture, or just make the pixel white (to get the staticy-bit at the bottom)
	whiteNoise = rand(float2(floor(samplePosition.y*80.0),floor(samplePosition.x*50.0))+float2(_UnscaledTime,0));
	
	float t = sin(_UnscaledTime / 2);

	if (whiteNoise > 11.5-30.0*(samplePosition.y + t) || whiteNoise < 1.5-5.0*(samplePosition.y + t) ) {
		// Sample the texture.
		col = lerp(tex2D(_MainTex ,samplePosition) , col + tex2D(_MainTex ,samplePosition), _EffectStrength);
	} else {
		// Use white. (I'm adding here so the color noise still applies)
		col = lerp(tex2D(_MainTex ,samplePosition), fixed4(1, 1, 1,1), _EffectStrength);
	}

	return col;
}

It's nice to have HLSL code, but a video is better:

 

1 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement