Emission of light from texture on WebGL I have to build a texture of a cube that models the emission of light by the object. Any tips? I really don't know where to start.
Presumably you are using a lighting system already, let's say Lambert shading for simplicity..

So we have a texture which is going to be illuminated by some light source. The following psuedo/shader code will do lambert shading as normal..

diffuseIllum = lightColour * dot(normal, lightDir);
outputColour = textureColour.rgb * diffuseIllum;


But we want certain parts of our texture to emit colours instead of being illuminated by only our light source.

One method would be to use an extra channel in the input texture, say the Alpha channel, to control which pixels are emissive

diffuseIllum = lightColour * dot(normal, lightDir);
outputColor = mix(textureColour.rgb * diffuseIllum, textureColour.rgb, texture.a);


Unfortunately this won't work so well if you want say a dark red glow because the output pixel will either be the emissive colour (dark red) or the lit texture colour, which could be much brighter. In effect our emissive areas could end up darker than the surrounding illuminated areas.

We could add the emissive colour to the illuminated texture but that limits how much control over final colour we have.

e.g.

outputColour = textureColour.rgb * diffuseIllum + textureColour.rgb * textureColour.a;


A more correct method would involve using 2 textures, one for diffuse illumination and another for purely emissive. These would be added together in the pixel shader.

e.g. 

 outputColour = textureColour.rgb * diffuseIllum + emissiveTextureColour.rgb;