Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Twister's primer
2009-05-03 21:35
Luca

Registered: Apr 2002
Posts: 178
Twister's primer

How to obtain simple/cool/elaborate primer graphics (bitmap) for a general vertical twister effect (let's say simply 3 colours+background colour)? Should I draw'em on PC first, with a 3DMax or similars, then convert'em? Which height in pixels would be enough to smoothly describe and include the whole 360° rotation?

For a very basic one, I could simply draw a slice of column in two colours by drawing them with a sin(x) function, what with more complex stuff?
2010-03-31 07:21
Luca

Registered: Apr 2002
Posts: 178
OMG I've just seen I got zero answers after almost a year, it's a world record, great! :D
2010-03-31 07:39
JackAsser

Registered: Jun 2002
Posts: 1990
Quote: How to obtain simple/cool/elaborate primer graphics (bitmap) for a general vertical twister effect (let's say simply 3 colours+background colour)? Should I draw'em on PC first, with a 3DMax or similars, then convert'em? Which height in pixels would be enough to smoothly describe and include the whole 360° rotation?

For a very basic one, I could simply draw a slice of column in two colours by drawing them with a sin(x) function, what with more complex stuff?


Depending on the shape of your twister you need different amount of angles to smoothly rotate it. F.e. a cube based needs to rotate 90 degrees before being symmetrical again. Typically u want as many angles as possible, so it's always a trade off between that and loading time / memory usage. One VIC bank can easily contain 256 angles, in three different twister shapes, which should be enough for most applications.

To render a twister, simply use your favorite raytracer or code one on your own.

/JackAsser
2010-03-31 08:13
Twoflower

Registered: Jan 2002
Posts: 434
Or pixel it. :-)
2010-03-31 08:46
HCL

Registered: Feb 2003
Posts: 717
Quoting Jackasser
One VIC bank can easily contain 256 angles, in three different twister shapes


Hmm, sounds like a magic formula :), how's that obtained? Of course it depends on how much data each animation needs, easiest case (?) would be 8 stretched sprites, and then you have space for 2 * 256 angles.
2010-03-31 09:13
JackAsser

Registered: Jun 2002
Posts: 1990
Quote: Quoting Jackasser
One VIC bank can easily contain 256 angles, in three different twister shapes


Hmm, sounds like a magic formula :), how's that obtained? Of course it depends on how much data each animation needs, easiest case (?) would be 8 stretched sprites, and then you have space for 2 * 256 angles.


In that magic lies the limitation that you only show one of the three shapes at any given frame and that you're only using 7 sprites in width (21 bytes).

Sprite offsets 0-20 for the first shape, 21-41 for the second shape and finally offsets 42-62 for the third shape.

But yes, using 8 sprites limits you to only two shapes per sprite.
2010-03-31 09:38
Luca

Registered: Apr 2002
Posts: 178
Thanks guys, I'll try that.
I would admit I afforded the problem from the wrong side (my difficulties in rendering/converting a primer), instead of facing the code first.
I'm very interest in all the different approaches to twisters: one seems to be a sort of "special plasma", with sintables and all the rest; another one seems to be playing with DMA delay. A good example is the double-twister in Zenith of Puberty on Plus/4, which probably shows both.
2010-03-31 09:53
Scout

Registered: Dec 2002
Posts: 1568
If you want to know how it is done on a DTV, check the sources of Twistro
There's also an exomized twister bitmap (256x256) which I made in Photoshop.
You can decompress it and load it back as RAW image in Photoshop/GIMP/Paintshop.
2010-03-31 13:49
WVL

Registered: Mar 2002
Posts: 886
Quote: In that magic lies the limitation that you only show one of the three shapes at any given frame and that you're only using 7 sprites in width (21 bytes).

Sprite offsets 0-20 for the first shape, 21-41 for the second shape and finally offsets 42-62 for the third shape.

But yes, using 8 sprites limits you to only two shapes per sprite.


The all-border sprite zoomer in Pearls for Pigs uses this technique :)

There's 7 sprites on screen, the picture is 64 pixels high and there's 12 different x-sprite sizes for every sprite. These 12 different sizes are made using 256/64 = 4 and I can fit 3 sizes in each sprite (by offsetting in y with 0,7 or 14). 4*3 = 12.

Maybe to explain it better :

If I want to show the full width, i put my sprites at y-offsets of 0,1,2,3,4,5 and 6, and i use sprite-images 0-63 (changing each line) to show the picture. I can also chose 64-127, 128-191 or 192-255, to make all sprites 1,2 or 3 pixels smaller.

If i want to make them 4 pixels smaller, i use offsets 7,8,9,10,11,12 and 13 and sprite images 0-63 again.

Ofcourse the code allows for any combination of y-offsets :)

The fact that you can only have max 7 sprites with sprite-fpp and open border suddenly becomes an advantage, because you can use the memory 3x more efficiently :)
2010-03-31 14:07
Mace

Registered: May 2002
Posts: 1799
@ WVL: please explain this to me again, on paper, at X-2010 (before we drink beer) ;-)
2010-03-31 14:55
Luca

Registered: Apr 2002
Posts: 178
Quote: If you want to know how it is done on a DTV, check the sources of Twistro
There's also an exomized twister bitmap (256x256) which I made in Photoshop.
You can decompress it and load it back as RAW image in Photoshop/GIMP/Paintshop.


Thanks Scout, that would be a very good starting point, though I am still not able to understand how to use it (if color infos are not needed, if I have to read it as hires then assign some colours...).
2010-03-31 15:38
Oswald

Registered: Apr 2002
Posts: 5025
sprite fpp is a wonderful thing indeed :) who invented it btw?
2010-03-31 19:49
WVL

Registered: Mar 2002
Posts: 886
I honestly don't know :( I didnt know about it until Royal Arte, but I'm sure it has been used plenty of times before that..
2010-03-31 22:27
SIDWAVE
Account closed

Registered: Apr 2002
Posts: 2238
There is no twister, its just to print some chars that animate so they look like twisting, using a pretyped char index table, sorry to break your dreams :D
2010-03-31 23:24
Skate

Registered: Jul 2003
Posts: 491
FPP is a very old effect.

http://www.codebase64.org/doku.php?id=base:demo_world_records_a..

Codebase64 says it's from 1989, I think it might even be older.
2010-04-01 07:01
Radiant

Registered: Sep 2004
Posts: 639
FPP != sprite FPP.

Coding your own raytracer for generating the twister graphics isn't a bad idea. You can always touch the result up manually afterwards if you want to. The graphics for the "twister" in Patterns was generated by simply texturemapping a cylinder with different texture offsets.
2010-04-01 07:30
Oswald

Registered: Apr 2002
Posts: 5025
"Coding your own raytracer for generating the twister graphics isn't a bad idea."

its like coding your own ext editor for the twister's code...
2010-04-01 10:15
JackAsser

Registered: Jun 2002
Posts: 1990
Quote: "Coding your own raytracer for generating the twister graphics isn't a bad idea."

its like coding your own ext editor for the twister's code...


I see your point, however, it's not valid to me. For me, learning some 3d program to generate the gfx takes longer than doing a simple raytracer. However, as complexity of the objects increases, using a real tool becomes more and more sane. F.e. the wireframe cube in Andropolis was generated using povray. (And now that I know povray I don't think I'd make my own raytracer again for a twister. :) )

The horizontal twisters in The Wild Bunch and Amplifire both used a custom raytracer that only could render such an object (i.e. some cylinders and planes).
2010-04-01 15:51
Oswald

Registered: Apr 2002
Posts: 5025
okay, in some cases it is a good idea indeed :) but I'd guess most coder's cant just slap together a raytracer even this simple in 5-10 minutes, it needs some perequisites like in the case of using a tool. :)
2010-04-01 18:53
Pantaloon

Registered: Aug 2003
Posts: 124
a simple twist tracer in kickasm script, stores which side is visible for each line.

.for (var side = 0; side < 4; side++)
{
.var y0 = round(coords.get(side*2+0))
.var y1 = round(coords.get(side*2+1))

.var ydiff = y1 - y0

.if (ydiff > 0)
{
.for (var y = y0; y < y1; y++)
.eval points.put(y,side)
}
}
2010-04-01 20:08
Mace

Registered: May 2002
Posts: 1799
@ Pantaloon: don't you forget declaring 'coords' as a List()? Or something...
2010-04-01 21:22
Pantaloon

Registered: Aug 2003
Posts: 124
was just a little snippet. you need to rotate the coords first, and store them in a list.
2010-04-06 08:34
MagerValp

Registered: Dec 2001
Posts: 1059
POV-Ray is perfect for these kinds of tasks. It's trivial to get it to render a series of 21x1 pixel (or whatever you need) cubes, and as a programmer you gotta love its scene description language. Slapping out a POV-Ray'd twister is faster than coding your own raytracer too, even if you've never used POV before.
2010-04-07 13:28
Krill

Registered: Apr 2002
Posts: 2852
Depending on the type of twister, you can also simply generate the graphics on the c64 itself, like i did here in 4k: Bar4Kode - doesn't look as cool as raytraced, but still nice enough. :)
2010-04-07 13:59
Mace

Registered: May 2002
Posts: 1799
Hey, this was the kind of stuff I was looking for :-)
Thanks Krill.
2010-04-07 14:18
Krill

Registered: Apr 2002
Posts: 2852
Mace: I can send you the source if need be.. But it's uncommented and generally not up to my current standards :D
2010-04-08 08:02
Luca

Registered: Apr 2002
Posts: 178
Plenty of available choices, I see.
I tried POV-ray but as a complete prophan, I ran away in pain. Probably a bit more patience would be needed. The Krill's solution looks tasty too.
Scout: I still dunno how to use the .raw image, because I didn't understand if that twister's primer is deliberately drawn in 3 colors, or there's something I missed around it (probably my ignorance in DTV...).
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
DKT/Samar
kbs/Pht/Lxt
zscs
ready./Level64/HF
the mad-zap/Royal Cr..
duce/extend
Malmix/Fatzone
DeeKay/Crest
Guests online: 127
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (9.5)
8 Quadrants  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Birth of a Flower  (9.5)
Top Groups
1 Nostalgia  (9.3)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Graphicians
1 Sulevi  (10)
2 Mirage  (9.8)
3 Mikael  (9.7)
4 Lobo  (9.7)
5 Archmage  (9.7)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.071 sec.