Jump to content
IGNORED

Simple Plasma Demo


RevEng

Recommended Posts

Between the RIOT investigations and refining the 7800basic rotational controls once again, I've been in a very technical headspace lately. As a... uh... break... I decided to work on a little plasma demo yesterday.

 

For now it's just single color 320A mode, though it does use one of the composite artifacting colors. The plasma code is just a simple collision between 2 vertical sine waves, and 2 horizontal sine waves, so it's pretty basic and periodic. I'm going to look at adding another component to perturb the regularity, and possibly a higher color mode change, when I get back to... uh... slacking.

 

Anyway, enjoy if you will...

 

Plasma Demo, via the excellent online JS7800 emulator

 

plasmatest.bas.a78 plasmatest.bas.bin

 

...all glory to the hypnotoad!

 

  • Like 11
Link to comment
Share on other sites

That looks great! Very mesmerizing. 

 

hail GIF

 

48 minutes ago, RevEng said:

The plasma code is just a simple collision between 2 vertical sine waves, and 2 horizontal sine waves

I suspect that your definition of "simple" may differ from the average person's. :P

  • Like 2
Link to comment
Share on other sites

17 hours ago, RevEng said:

For now it's just single color 320A mode, though it does use one of the composite artifacting colors. The plasma code is just a simple collision between 2 vertical sine waves, and 2 horizontal sine waves, so it's pretty basic and periodic. I'm going to look at adding another component to perturb the regularity, and possibly a higher color mode change, when I get back to... uh... slacking.

 

Who needs one of those groovy Atari Video Music machines?!? :) Just convince whomever gets a viable 7800 SD cart out first to add a 3.5mm audio Line In connector tied to cartridge audio in and we'll be rockin' it 70's style! :)

  • Like 3
Link to comment
Share on other sites

3 minutes ago, DrVenkman said:

Who needs one of those groovy Atari Video Music machines?!? :) Just convince whomever gets a viable 7800 SD cart out first to add a 3.5mm audio Line In connector tied to cartridge audio in and we'll be rockin' it 70's style! :)

Not a bad idea! Wonder if something like that can be done so that the amplitude from an audio line in populates variables with random values into the code to generate patterns on the screen in some way?

Link to comment
Share on other sites

Honestly, I'd be down for it. One of my long-benched assembly projects was an Atari Video Music pattern generator for the 2600, with the intent that the 7800 would follow - lots of neat effects could be had on the 7800.

 

My original thought was that the hardware could be a couple simple filters+amps going to the joystick ports for low and high frequency input. While the cart audio line could be used (not for 2600 though) I think the interfacing is a bit more complicated that way. Maybe someone who is more hardware oriented could advise on that point.

 

Whatever the hardware might be, it would be great to put out the specification openly, so multiple coders could submit their own display routines.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

18 hours ago, RevEng said:

The plasma code is just a simple collision between 2 vertical sine waves, and 2 horizontal sine waves, so it's pretty basic and periodic.

Can you provide a bit more detail of how this works?  Are the sine waves just used to select a colour AND position?

Link to comment
Share on other sites

Sure, no problem.

 

There's an outer Y loop and and inner X loop, where I run through each character position, and do a bunch of sine addition for the index at that particular location. Between frames the sines advance.

 

The vertical component is 2 waves that are out of phase. The vertical component on it's own looks like this:  vertical plasma component, via JS7800 online emulator

 

The horizontal component is also 2 (different) waves that are out of phase. On it's own it looks like this: horizontal plasma component, via JS7800 online emulator 

 

When the components are added together, the interference of both vertical and horizontal waves is what makes a basic dull plasma. Think of this as a height map.

 

To liven up the dull plasma, I take the height map value and use it in a sine table lookup to get the actual shade of grey. (the shades are just dithered characters running from dark->light->dark)

 

If your sine table is 256 bytes long, this has the added advantage that you don't need to worry much about values that go past 255, when you're adding the sine components together. Similarly, you can intentionally overflow 255, and get a plasma display that's more stripey.

 

There's a pretty good overview at this site. (it uses javascript, but the concepts are well illustrated)

 

I'll eventually release the source for the plasma, but I need to clean it up and comment it out a bit.

 

plasma-y-only.a78

plasma-x-only.a78

 

  • Like 6
  • Thanks 1
Link to comment
Share on other sites

  • 1 month later...

I've added a flame effect to the demo (select switch to change between the two effects) and changed the display over to 160a. I've renamed the demo to "lava", since it's no longer just a plasma. I may eventually add some other effects.

 

Source is included, in case anybody is interested.

 

You can also view the demo in-browser via the excellent JS7800 emulator.

 

lava.bas.a78

lava.bas.bin

lava.zip

  • Like 6
Link to comment
Share on other sites

I've given it thought, but I haven't genuinely worked toward it. While I dabble in hardware with microcontrollers, logic probes, know my way around a schematic, etc., I'm more software than hardware, so hardware tends to be a time suck for me. When life is a bit less busy I might try my hand at prototyping something for the joystick port. (though I'd be happy if someone else beats me to it.) 

 

I think the best approach here is to go cross platform and more or less just allow a low pass filter and a high pass filter to drive the joystick lines. That way the hardware would be bigger than our community, giving it more visibility and lifespan. There could be video music projects for the 7800, 2600, A8, C64, Vectrex, or whatever. Software is always easy once the hardware is there and documented.

  • Like 1
Link to comment
Share on other sites

Also, if anybody is interested in lower level info for the Flame effect, I based it on the classic PC fire effect. The only main difference between mine and PC one is is the random seeding of the bottom row. Due to the coarse resolution, this didn't give as nice of a flame effect as it does on the PC. To make mine more flamey, I do a combination of random seeding and sine interference on the bottom row.

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...