Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 14:51 16 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Kaleidoscope

Author Message
William Leue
Guru

Joined: 03/07/2020
Location: United States
Posts: 405
Posted: 03:20pm 12 Nov 2020
Copy link to clipboard 
Print this post

Here is a little demo program that uses 8-fold symmetry with random triangles and colors to produce a nice kaleidoscope effect.

-Bill


Kaleid.zip
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10588
Posted: 04:42pm 12 Nov 2020
Copy link to clipboard 
Print this post

Like it  

But for the full effect add
page write 2
cls
circle mm.Hres\2,mm.Vres\2,mm.vres\2-20,,,,rgb(white)
page write 1
cls

at the top and replace the pause 200 with
 Polygon 3, xv(), yv(),, c
 page and_pixels 2,1,1
 page copy 1 to 0,b
 pause 50

at the bottom
 
William Leue
Guru

Joined: 03/07/2020
Location: United States
Posts: 405
Posted: 06:56pm 12 Nov 2020
Copy link to clipboard 
Print this post

Ooh, excellent! I was considering adding circles but was too lazy to do it.

I didn't do the offscreen write and blit because the flashing did not appear to be annoying.

-Bill
 
William Leue
Guru

Joined: 03/07/2020
Location: United States
Posts: 405
Posted: 09:22pm 12 Nov 2020
Copy link to clipboard 
Print this post

Attached is version 1.1.0 of Kaleid. It clips the overall image to be contained in a large circle, which enhances the kaleidoscope effect. This change was suggested by Peter Mather, who kindly provided the code snippets to implement this.

-Bill


Kaleid.zip
 
William Leue
Guru

Joined: 03/07/2020
Location: United States
Posts: 405
Posted: 12:20pm 14 Nov 2020
Copy link to clipboard 
Print this post

I notice that on my CMM2, after adding the circle clipping, there is a randomly-occuring "twitch" that happens. This looks like all the graphics moving suddenly to the side for a few milliseconds and then it is stable.

This did not happen in my original version, so it definitely is the result of adding the clipping circle. I am guessing that the problem is (somehow) in the page copy.

I experimented a little, and I find that changing the pause from 50 to 60 ms greatly reduces the problem but does not entirely eliminate it. A further increase in the delay does eliminate the problem but impairs the overall kaleidoscope effect, at least to my taste.

Of course, I don't know whether this problem is unique to my CMM2 or is general.

Peter, can you give me any clues as to the root cause and whether this can be fixed without lengthening the delay more?

Thanks!
-Bill
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4147
Posted: 12:42pm 14 Nov 2020
Copy link to clipboard 
Print this post

Sounds like the kind of video artefact caused by a refresh (frame) rate & (software) drawing rate which are not synced.  E.g. say refresh is 75Hz (13.3ms) and you use 50 or 60ms then you wouldn't get a whole number of refreshes per 50 or 60ms.

John
Edited 2020-11-14 22:44 by JohnS
 
William Leue
Guru

Joined: 03/07/2020
Location: United States
Posts: 405
Posted: 02:12pm 14 Nov 2020
Copy link to clipboard 
Print this post

That is what I think, too, John. However, isn't the "b" option on PAGE COPY supposed to handle that?

-Bill
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10588
Posted: 02:34pm 14 Nov 2020
Copy link to clipboard 
Print this post

You need to sync the PAGE AND_PIXELS to frame blanking as well as the copy. Because you are using mode 1,16 the video is reading from the SDRAM, the PAGE AND_PIXELS is also hammering SDRAM


dim frame=0
mode 1,16,0,myint
.....
frame=0
do: loop while frame=0
page and_pixels 2,1,1
.....
sub myint
frame=1
end sub

 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4147
Posted: 02:41pm 14 Nov 2020
Copy link to clipboard 
Print this post

Thanks, Peter!

William, Just to add to Peter's snippet, set frame=0 again once the main program has detected it's not 0 (in that do: loop while frame=0 code).

John
 
William Leue
Guru

Joined: 03/07/2020
Location: United States
Posts: 405
Posted: 03:03pm 14 Nov 2020
Copy link to clipboard 
Print this post

Oh great! That fixes the problem! It all makes sense now. Using that ISR to help synchronize the memory-intensive ops is a neat trick.

Attached is Rev 1.1.1 of Kaleid that has Peter's fix for video glitches.

-Bill


Kaleid.zip
 
epsilon

Senior Member

Joined: 30/07/2020
Location: Belgium
Posts: 255
Posted: 03:51pm 21 Nov 2020
Copy link to clipboard 
Print this post

Very nice! It's still a bit glitchy for me but I think that's because I really should be installing that crystal oscillator mod to calm down my HSync signal.

Imagine if we could get a whole demoscene going on CMM2. It was actually the youtube video of Mauro's demo that got me into CMM2 in the first place.
Epsilon CMM2 projects
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025