[Solved] Computer graphics: how to draw this effect using computer programs?


You have two lines there. What you want to do is to pick the closer line for each pixel, and calculate the distance to it. This will be your intensity at a given point. Furthermore do a fade to black as you approach the bottom of the image (use your pixel’s y position to do this)

your lines seem to be at exactly at 25% and 75% on the x axis, therefore a pseudode looks like this:

for each pixel p: //p.x and p.y is normalized to the 0-1 range!
  intensity = ( 0.25 - min( abs(p.x-0.25) , abs(p.x-0.75) ) ) / 0.25; //intensity is normalized to 0-1 range
  intensity *= intensity; //distance squared
  intensity *= (1.0 - p.y); //Top of image is 0, bottom is 1
  display_intensity();
end

Depending on how you want to use this, you can create a texture on the CPU, or use a shader and calculate it in GLSL on the GPU.

2

solved Computer graphics: how to draw this effect using computer programs?