![]() Pretty much all the complicated stuff happens in here. ![]() You can use these two in tandem to make the shockwave fade out, but it's not necessary. The last two parameters are uProgress, which propagates the wave, and uOpacity, which determines the strength of the distortion. ![]() ![]() Keep this in mind when tweaking the values. Size is a bit of a misnomer, as it is a scalar for the dot field, meaning that as the size increases, the ripples actually become tighter, not wider. There are five parameters you can use to modify the shockwave, three of which have been mapped to uColor (you can not implement your own parameters into shader files, so I had to use existing ones): the amount of ripples (uColor.x), the size of each ripple (uColor.y) and the shockwave propagation speed (uColor.z). These ripples are used to distort the screen sampler coordinates to give the impression of a shockwave. ![]() }Essentially this code generates a radial map from a specific point (the source of the shockwave), and then feeds that map into a sine function to generate ripples. Float4 Shockwave(float4 position : SV_POSITION, float2 coords : TEXCOORD0) : COLOR0įloat2 targetCoords = (uTargetPosition - uScreenPosition) / uScreenResolution įloat2 centreCoords = (coords - targetCoords) * (uScreenResolution / uScreenResolution.y) įloat dotField = dot(centreCoords, centreCoords) įloat ripple = dotField * uColor.y * PI - uProgress * uColor.z įloat2 sampleCoords = coords + ((ripple * uOpacity / uScreenResolution) * centreCoords) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |