Jump to content
  • Advertisement

Unity Daily Update #7 - Another plane of being

jb-dev

1053 views

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:

 




0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!