Software for doing Phosphor Persistence rendering/simulation - Page 1
Forum section: electronics / projects

author: eV1Te
author_rank: Regular Contributor
timestamp: July 02, 2013, 02:43:11 pm
content: Don't you just love the look of a signal on an analog scope? Even the good digital ones with variable persistence has significant aliasing or pixelation, which doesn't look pretty but gives you the information you want...I decided to write my own program that renders any data/audio file into an animation that simulates the persistence and glow of phosphor (although you can use any color you like). I got the idea from a blog by a girl who sent in some things to Mailbag Monday a few weeks back, the idea is the same, but I do it with different algorithms and some additional anti-aliasing etc.My inspiration:http://www.windytan.com/2013/03/rendering-pcm-with-simulated-phosphor.htmlI uploaded a video to YouTube, where the left right channel is displayed in X-Y mode for a more dramatic look.Please view in HD (even then some detail is lost, due to compression not liking dark and faint details)

author: amyk
author_rank: Super Contributor
timestamp: July 03, 2013, 01:18:29 pm
content: When I read your description I was thinking "you should try YouScope or Oscillofun on that"... so you should try YouScope then.Looks good.

author: Odysseus
author_rank: Regular Contributor
timestamp: July 04, 2013, 12:20:57 am
content: Haha that's awesome! I'll have to look into Atom Delta, I've never heard of them till now.I've simulated chaotic circuits like the Chua, Rossler, and Lorentz attractors in LTSpice before, but it's not easy to see what's going on in it's display. Can you use your program on the audio file I attached? It should work with the software you're written.

author: ElectroIrradiator
author_rank: Frequent Contributor
timestamp: July 04, 2013, 12:47:07 pm
content: I approve of this product and/or service.

author: eV1Te
author_rank: Regular Contributor
timestamp: July 04, 2013, 02:04:14 pm
content: Quote from: amyk on July 03, 2013, 01:18:29 pmI rendered the Youscope demo, I almost forgot about that one.But it seems like the fly-back lines are not as nicely handled in this demo, the way the graphics is generated seems to include a lot of fast jumps between different locations, instead of drawing things like you would by hand. I would probably have to tweak the contrast/intensity variables and the shutter-time of the "virtual camera" in order to get a better display (now it assumes a shutter angle of 360 degrees in order to not loose any data).

author: eV1Te
author_rank: Regular Contributor
timestamp: July 04, 2013, 02:42:55 pm
content: Quote from: Odysseus on July 04, 2013, 12:20:57 amI'm rendering your file right now. But there might be a problem...The way I wrote the algorithm is such that in any given image/frame; the lines drawn before the camera shutter is opened will only be very faintly visible due to the faint afterglow of the phosphorous (fade with time). Then the camera shutter is then opened and any lines drawn on the scope will now be registered brightly on the camera, until the shutter closes again.It seems like the figures drawn in your file takes longer than the time of one frame to complete, hence the "frame rate" of your signal is to low, which results in a sort of interlaced/blinking animation. However with your eye it might look very cool, since you can perceive much higher frame rates than 30.Quote from: Pippy on July 04, 2013, 01:13:43 pmI actually wrote everything in Matlab for simplicity's sake, and it is not rendered in real time. Depending on resolution and amount of super sampling of the image resolution (anti aliasing) it takes about 3-10 seconds per frame.The bottleneck by a order of magnitude is the filtering of the image, to achieve the "glow" effect around the lines. A sort of custom Gaussian blur (but not with a Gaussian shape) that is applied to the image (or actually to the raw data that contains more than just 8 bits per pixel).Algorithm:-Data is scaled to fit into the image (vertical/horizontal gain)-Data for each frame is up sampled to ca. 20M points. (originally only 10k points)-A big 1920x1080 matrix is created with only zeroes (or a much higher resolution that can later be down sampled, for less aliasing/jaggies).-When a point ends up in the location of a pixel (element in the matrix), that pixel (element) increases it's value by one (if a lot of data ends up in the same pixel, it becomes very "bright").-The image-matrix is then filtered in order to create a glow around each line/pixel.-The matrix can then be converted into a 1920x1080 image, where the value of each pixel is converted to a color. (Brightness and contrast is applied here)My guess is that all these steps can be parallelized and therefor run efficiently on a GPU or FPG in the case of a real scope. If everything is done on the GPU with some simplifications you could reach real time updates, with a similar "look".