Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user maak ! (Registered 2024-04-18) You are not logged in - nap
CSDb User Forums


Forums > CSDb Entries > Release id #172238 : Waves 16k
2018-12-09 10:09
Heaven
Account closed

Registered: Jul 2008
Posts: 102
Release id #172238 : Waves 16k

<Post edited by moderator on 11/12-2018 15:33>

                    ldx #0                  ;top = 0
                                            ;we use Xreg as top
loop_fractal_line   cpx #0
                    bpl @+                  ;if x<0 go to drawing
                    jmp exit_fractal_line
@                   lda sx2,x               ;dx = abs(sx2-sx1)
                    sec
                    sbc sx1,x
                    bcs @+
                    eor #$FF
                    adc #1
@                   cmp #2                  ;if dx<2 skip to plot point
                    bcs subdiv_fractal_line
                    ldy sx1,x
                    lda sy1,x
                    sta heights,y
                    dex
                    bne loop_fractal_line
                    beq loop_fractal_line
subdiv_fractal_line lsr                     ;ed = dx/4
                    lsr
                    sta edge_displacement
                    
                    lda sx2,x               ;sx2 = int((sx1+sx2)/2)
                    sta sx2+1,x             ;use it to copy to top+1
                    clc
                    adc sx1,x
                    lsr
                    sta sx2,x
                    sta sx1+1,x             ;copy to top+1 also
                    
                    lda sy2,x               ;sy2 = int((sy1+sy2)/2)
                    sta sy2+1,x             ;use it to copy to top+1
                    clc
                    adc sy1,x
                    lsr
                    sta sy2,x
                    
                    lda st2,x               ;st2 = st1+st2
                    sta st2+1,x             ;use it to copy to top+1
                    clc
                    adc st1,x
                    sta st2,x
                    sta st1+1,x             ;copy to top+1 also
                    
                    bvs @+                  ;if v<>0 skip displacement
                    bmi n_equal_1
                    lda sy2,x               ;n == 0
                    clc                     ;sy2 += ed
                    adc edge_displacement
                    sta sy2,x
                    jmp @+
n_equal_1           lda sy2,x               ;n == 1
                    sec                     ;sy2 -= ed
                    sbc edge_displacement
                    sta sy2,x

@                                           ;Copy new Y to top+1
                    lda sy2,x
                    sta sy1+1,x
                    
                    inx                     ;top += 1
                    jmp loop_fractal_line
exit_fractal_line

 
... 18 posts hidden. Click here to view all posts....
 
2018-12-11 19:12
Heaven
Account closed

Registered: Jul 2008
Posts: 102
                    
                    ldx #0                  ;top = 0
                                            ;we use Xreg as top
loop_fractal_line   cpx #0
                    bmi exit_fractal_line
@                   lda sx2,x               ;dx = abs(sx2-sx1)
                    sec
                    sbc sx1,x
                    bcs @+
                    eor #$FF
                    adc #1
@                   cmp #2                  ;if dx<2 skip to plot point
                    bcs subdiv_fractal_line
                    ldy sx1,x
                    lda sy1,x
                    sta heights,y
                    dex
                    jmp loop_fractal_line
subdiv_fractal_line lsr                     ;ed = dx/4
  		    alr #$fe ;c = 0 a div 2
                    sta edge_displacement
                    
                    lda sx2,x               ;sx2 = int((sx1+sx2)/2)
                    sta sx2+1,x             ;use it to copy to top+1
                    adc sx1,x
                    alr #$fe
                    sta sx2,x
                    sta sx1+1,x             ;copy to top+1 also
                    
                    lda sy2,x               ;sy2 = int((sy1+sy2)/2)
                    sta sy2+1,x             ;use it to copy to top+1
                    adc sy1,x
                    alr #$fe
                    sta sy2,x
                    
                    lda st2,x               ;st2 = st1+st2
                    sta st2+1,x             ;use it to copy to top+1
                    adc st1,x
                    sta st2,x
                    sta st1+1,x             ;copy to top+1 also
                    
                    bvs @+                  ;if v<>0 skip displacement
                    bmi n_equal_1
                    lda sy2,x               ;n == 0
                    clc                     ;sy2 += ed
                    adc edge_displacement
                    sta sy2,x
                    jmp @+
n_equal_1           lda sy2,x               ;n == 1
                    sec                     ;sy2 -= ed
                    sbc edge_displacement
                    sta sy2,x

@                                           ;Copy new Y to top+1
                    lda sy2,x
                    sta sy1+1,x
                    
                    inx                     ;top += 1
                    jmp loop_fractal_line
exit_fractal_line


slightly optimised with my new friend ALR #$fe
2018-12-11 19:17
Bitbreaker

Registered: Oct 2002
Posts: 499
you still should get rid of the cpx #0 decision :-) You can do that already on the branches from inx/dex ;-)
2018-12-11 19:25
Rastah Bar

Registered: Oct 2012
Posts: 336
Quoting Heaven

btw. if you wonder what ST1 and ST2 is. It's what Carpenter calls "node tag values" and those represent the characteristics of the line (e.h. "mountain" or "cloud" etc).

so... say fractline(0,100,4 to 319,100,4) will be different to fractline(0,100,20 to 319,100,4). Even Tag1 4 and Tag2 5 should be different.

http://old.siggraph.org/publications/rarities/carpenter-1980sup..


Thanks for the link! Btw, is this the same kind of algorithm that is behind the change disk part of Old Men in Used Cars ?
2018-12-11 19:29
Heaven
Account closed

Registered: Jul 2008
Posts: 102
yup.

http://www.evilshirt.com/_ataristuff/dsr_waves_opt_packed.zip

including the new core... don't see much difference... but haven't meassured the rendering time...
2018-12-11 19:33
Heaven
Account closed

Registered: Jul 2008
Posts: 102
Quote: Quoting Heaven

btw. if you wonder what ST1 and ST2 is. It's what Carpenter calls "node tag values" and those represent the characteristics of the line (e.h. "mountain" or "cloud" etc).

so... say fractline(0,100,4 to 319,100,4) will be different to fractline(0,100,20 to 319,100,4). Even Tag1 4 and Tag2 5 should be different.

http://old.siggraph.org/publications/rarities/carpenter-1980sup..


Thanks for the link! Btw, is this the same kind of algorithm that is behind the change disk part of Old Men in Used Cars ?


i doubt as this looks like a "classic voxel" animation.

but Voxel maps can be generated by midline displacement... and me using a grid while voxel uses "screen collums" and RoF uses collum height drawing (front to back) same like later commanche... so yeah some tech is used later ;)
2018-12-11 19:33
Heaven
Account closed

Registered: Jul 2008
Posts: 102
Quote: you still should get rid of the cpx #0 decision :-) You can do that already on the branches from inx/dex ;-)

now as more as I look at it it's most annoying thing :D.
2018-12-11 20:05
Heaven
Account closed

Registered: Jul 2008
Posts: 102
And this doc describes the “flag based” displacement:

http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.85.378..

As we see Carpenter was already at Lucasfilm 1986
2018-12-11 22:06
Heaven
Account closed

Registered: Jul 2008
Posts: 102
https://youtu.be/OaCiNi1Y5pE

this is the Atari 800 version with my new "core" but it has 3d calc (camx,camy plus persptrans with fastmul)...

;)

and here the c64 "core" without 3d and precalced nodepos on the A8...

https://youtu.be/jxYKiNWMznU
2018-12-12 08:23
Bitbreaker

Registered: Oct 2002
Posts: 499
I expect a c64 demo in two years that shows the effect as fast :-)
2018-12-12 16:12
Heaven
Account closed

Registered: Jul 2008
Posts: 102
actually i am now precalculating those "x fract" tables as in a non camera moving scenario all line length are fix...

so code will only do y1 to y2 displacement in realtime.
Previous - 1 | 2 | 3 - Next
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
Smasher/F4CG
Sentinel/Excess/TREX
E$G/hOKUtO fOrcE
Guests online: 111
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 The Ghost  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.9)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Crackers
1 Mr. Z  (9.9)
2 S!R  (9.9)
3 Mr Zero Page  (9.8)
4 Antitrack  (9.8)
5 OTD  (9.8)

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