How is this glowing with colors radiating outward 2D effect accomplished?

I'm currently totally at a loss as to how this effect is done: http://www.youtube.com/watch?v=zp8MHUNp7Cg

The glowing on the ship and the changing color. I want to do this effect in XNA 4.0 any hints and tips?

It looks like simple vertex colouring where the colour index is function of the distance to the centre of the ship, plus time.

This can be implemented using a texture storing a palette. It could also be done proceduraly if the desired colour gradients are simple enough.

If using a palette, the vertex shader would be something like this:

uniform float4 in_ShipCenter; /* Centre of the ship */
uniform float in_Time;        /* Elapsed time */
/* ... */

void main(float4 in_Position : POSITION,
uniform sampler1D in_Palette,
/* ... */
out float4 out_Color : COLOR)
{
/* ... */
float distance = length((in_Position - in_ShipCenter).xyz);
float time = in_Time;

/* Simple distance/time combination */
vec2 colorIndex = vec2(distance + time, 0.5);

/* Other possible effects:
* vec2 colorIndex = vec2(A * distance + B * time, 0.5);
* vec2 colorIndex = vec2(distance, time);
* vec2 colorIndex = vec2(distance + A * time, time + B * distance); */

/* Query the colour in the two-dimensional texture palette. */
out_Color = tex2D(in_Palette, colorIndex);
}


Edit: account for the fact that XNA doesn't support 1D palettes. If you still want to access the pixels of a 2D palette as if it was a 1D palette, see this question.

• It might also be a Manhattan Distance. – user712092 Nov 10 '11 at 0:09
• The colour waves look very circular to me. A Manhattan distance would create square waves. – sam hocevar Nov 10 '11 at 1:54
• Problem: you can't use a Texture1D in XNA; but otherwise a very good answer. – Jonathan Dickinson Dec 1 '11 at 12:47
• You're right, I wrote my answer thinking GL+GLSL in my head and just assumed it would be the same in XNA... Then in the meantime I learned that tex1D didn't exist on XNA. I'll fix that, thanks! – sam hocevar Dec 1 '11 at 15:46