# How is the elongated light beam/tentacle effect achieved?

This topic is 1322 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Question's simple, how (what techniques or combination of techniques) are the elongated beams of light (pointed out by red arrows) in the screenshot from DOTA 2 achieved? The fire light (green arrow) is obvious, that's just a bunch of particles, but what about those dynamic (they twist and turn) beams of lights.

##### Share on other sites

I would assume they're just a tesselated textured strip of triangles animated with some sort of sin() or cos() function in the vertex shader.

##### Share on other sites

[spoiler]

With proper UVs, taking the distance from all centers and you get a long drawn out "tentacle," as seen in the image.

Something like

float dist = min(1.0, distance(vec2(0.5), uv));

const vec3 DARK = vec3(0.0, 0.1, 0.25);

const vec3 LIGHT = vec3(0.0, 0.3, 0.5);

color.rgb = mix(DARK, LIGHT, dist);

color.a = sqrt(dist);

I can also tell that it isn't Z-sorted, not that it matters much.

[/spoiler]

Nevermind, as he said, it's probably just textured. It makes sense now that I think about it.

Edited by Kaptein

##### Share on other sites
Most of the time it's much simpler than we imagine.
I think it's static geometry with an animated texture (procedural or pre-rendered as a looping sequence of frames) that is moved with the texture matrix so that it slides along the geometry.
The vertices at the end of the geometry strips have zero alpha, so the effect disappears into the air.

You should check Simon's blog on visual effects for games. It's fascinating: http://simonschreibt.de/game-art-tricks/

If you're bent on finding exactly what makes that particular effect, there are API-hook applications that can capture a single frame's worth of geometry and texture in a game, though the use of these might be less than reputable (i.e. keep it to yourself):
- http://apitrace.github.io

##### Share on other sites

Most of the time it's much simpler than we imagine.
I think it's static geometry with an animated texture (procedural or pre-rendered as a looping sequence of frames) that is moved with the texture matrix so that it slides along the geometry.
The vertices at the end of the geometry strips have zero alpha, so the effect disappears into the air.

So that's essentially an animated spritesheet on a quad? That seems plausible, but also potentially expensive to render. Some of those animations are pretty detailed and long.

In any case, I am going to give this a shot.

##### Share on other sites
If you can't afford the memory cost of an animated texture, a simple trick that you can start with is having two texture units applied to that geometry strip, each texture unit being translated at a different speed and direction. The actual image used can be the same for both units, a smooth, wavy grayscale pattern.

In the fragment shader you sample both units and colour the fragment based on the mix of them, with an expression that results in that visual and colour. The result is a rich, dynamic effect.
Based on this: http://www.gamedev.net/topic/614608-specular-highlights-on-water/#entry4881841