flat assembler
Message board for the users of flat assembler.

Index > DOS > VGA 3D Rotate

Goto page 1, 2, 3  Next
Author
Thread Post new topic Reply to topic
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 13 Nov 2007, 20:41
Hello Wink
Here there is a simple example of 3D rotate that I written for
VGA 4 bit
Have Fun !


Last edited by DJ Mauretto on 19 Nov 2007, 09:27; edited 2 times in total
Post 13 Nov 2007, 20:41
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1389
Location: Piraeus, Greece
Picnic 13 Nov 2007, 22:11
DJ please...
I don't know about FPU stuff yet so judging the result only i say what a great example is this.


400 dos section threads!

_________________
Hobby BASIC Interpreter
Post 13 Nov 2007, 22:11
View user's profile Send private message Visit poster's website Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 14 Nov 2007, 11:20
Thanks Thimis Wink
FPU is only a way to make float point + transcendental computation,
a hobby for mathematic.
Post 14 Nov 2007, 11:20
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 14 Nov 2007, 12:22
2 bugs in your code!!

too much dots are computed, the figure wrap around the half, don't you see!

the screen is blinking, this is not good

but the idea is very good and the coments are very very good, i think you must post this in a FPU stuff thread, no?

like this everybody can use the "tutorials" you make for fpu
Post 14 Nov 2007, 12:22
View user's profile Send private message Visit poster's website Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 14 Nov 2007, 14:02
To Edfed:
Try to raise Delay to 3 or 4 in this point:
Code:
  MOV     CX,2            ; increase to 3 or 4
@Delay:
 Wait_Sync
   LOOP    @Delay    


My PC is slow and I have not tried on computers faster Laughing
If you raise the delay you must compensate the angle also in the data section
therefore: increase delay to 3 or 4 and increase angolo (angle) in the data section to 5 or 6 Wink
Post 14 Nov 2007, 14:02
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 14 Nov 2007, 18:13
If you use Verticle Retrace, as a delay it will run more or less the same on fast or slow PC Wink .
Code:
mov  word[count],0ddf:call FullVertWaitcmp word [count],70jne  ddf;Do some thing in herexor ah, ahint 16hmov ax, 04c00hint 21h;**************************FullVertWait:MOV   DX,3DAhVr:IN    AL,DXTEST  AL,8JNZ   Vr  ;wait until Verticle Retrace startsNvr:IN   AL,DXTEST AL,8JZ  Nvr  ;wait until Verticle Retrace EndsADD  word[count],1RET;**************************count dw 0    
Post 14 Nov 2007, 18:13
View user's profile Send private message Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 14 Nov 2007, 21:05
HI, Very Happy
I made only general setting for test on my P3 ,but you can do more on your pc.
Guide to test:
/* data section */

K_y ; control height of image
K_x ; control width of image
K_z ; control depth of image
Angolo ; rotation speed

/* code sectioin */
Code:
     MOV     CX,4             ; control Delay
@Delay:
     Wait_Sync
   LOOP    @Delay


      CALL    @Rotate_x     ; you can disable also this    
       CALL    @Rotate_y     ;  or this
    CALL    @Rotate_z     ; or this Smile

    

Please meet your favorite setting
Post 14 Nov 2007, 21:05
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 14 Nov 2007, 23:46
yes des4u is right, use the vertical retrace
two buffers are needed
the video memory and a buffer
then transfert buffer into video memory when bit 3 of crt status reg is pulsed
0 is the signal of vertical retrace ok
1011111..11111011111....11101111....11111011111....11111

you don't need any delay
just write in a buffer and wait for retrace

my machines are slower than your i have PMMX @233MHz, PII @ 563MHZ and PIII @800MHZ
Post 14 Nov 2007, 23:46
View user's profile Send private message Visit poster's website Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 15 Nov 2007, 10:52
Try this setting.
I don't have used double buffer,because is only a simply example,
not a professional software,but you can start with this to make your
optimization.
Maybe next days will write a better example.


Last edited by DJ Mauretto on 17 Nov 2007, 23:07; edited 1 time in total
Post 15 Nov 2007, 10:52
View user's profile Send private message Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 15 Nov 2007, 16:45
Hello, here there is a Torus function with Double Buffer,
Please try to make constructive criticism, not destructive Sad
ENJOY Wink


Last edited by DJ Mauretto on 19 Nov 2007, 09:41; edited 2 times in total
Post 15 Nov 2007, 16:45
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 15 Nov 2007, 17:01
EXCELENT!!

As I can see you also changed to rotate only since you previous version was rotating and transforming the shape.

Thanks for posting this new example!!
Post 15 Nov 2007, 17:01
View user's profile Send private message Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 15 Nov 2007, 17:20
Thanks Loco, intelligent observation Wink
Post 15 Nov 2007, 17:20
View user's profile Send private message Reply with quote
Mac2004



Joined: 15 Dec 2003
Posts: 314
Mac2004 15 Nov 2007, 19:57
DJ Mauretto: Neat example indeed ! Smile

regards
Mac2004
Post 15 Nov 2007, 19:57
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 15 Nov 2007, 20:38
my critisism are constructive.
you prove this by making a good optimisation of your code by using buffering
Smile
Post 15 Nov 2007, 20:38
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1389
Location: Piraeus, Greece
Picnic 15 Nov 2007, 22:21
excellent!!
runs fast and smooth on my laptop.
Post 15 Nov 2007, 22:21
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 16 Nov 2007, 10:51
Great work .
Post 16 Nov 2007, 10:51
View user's profile Send private message Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 19 Nov 2007, 09:40
HI Smile
I updated and optimized the examples from the point of view of graphic
Post 19 Nov 2007, 09:40
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 19 Nov 2007, 13:30
do you want to continue your 3Dengine project?
i hope you will
do you want to make it compatible with others 3D(highlevel)engines or do you want to make it in pure optimised asm?

to increase the speed you first make a build of your objects at the begining
the builder will launch the formula or algorythm and translate it in a 3Dfile
like this one from my engine, he he!
Code:
builder:
;esi = formula
;edi = destination file
...
call esi
;returns:
;esi = result
;edi = file
;eax = file id
...
ret
;end of builder
;x,y and z are the coordinates, dword size
;ax,ay and az are the rotation angles ;dword resolution??
;i don't compute the angles because it's hard to do 
file3D:           ;the editor or the coder makes this

.camera:        ;this little file is the camera used with .global
dd x,y,z,ax,ay,az,,focus, zoom,mode,...

.universe:         ;the universe builder makes this
 dd .camera
 dd size
dd macro1,x,y,z,ax,ay,az;,others datas 
dd macro2,x,y,z,ax,ay,az,etc etc ...
...
;end of universe

.macro:            ;the macro builder makes this
 dd size
dd object1,x,y,z,ax,ay,az;other datas
dd object1,x,y,z,ax,ay,az
...
;end of macro

object:              ;the object builder makes this
.size dd ?          ;size of all file
.lines dd ?         ;where is the line list?
.planes dd ?      ;where is the plane list?
.dsize dd ?         ;size of dot list
.dot1 dd x,y,z    ;this is one dot
.dot2 dd x,y,z
...
;here are lines of the objetct
dd dot1,dot2     ;this is one line
;if dot is outside the dot list then line doesn't exist  
;here are planes of the object
triangle1 dd line1,line2,line3  ;this is a triangle
dd ;extradatas for the polygon, colors, lights
; texture, texture algorythm,etc etc
others datas are to be defined step by step during the design of the engine
triangle2 dd line5,line6,line7
    


this kind of structure works well and permitts a global threading of the universe to show
it's good to don't have to recalculate the objects during all loops
just the use of the 3D to 2D is then required
with the Dot, line,plane structure, you can compute first
the dots, X,Y,Z
the 2D result goes in X,Y and Z is a flag
line is a very fast line algorythm that needs to interpolate the screen limits in case of crossing and recalculate temporary X1,Y1,X2,Y2 coordinates
i didn't try the plane type, but it needs to put the texture in the triangle and ignore the hidden faces, interpolate with other planes, and all fat computations
Post 19 Nov 2007, 13:30
View user's profile Send private message Visit poster's website Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 19 Nov 2007, 15:54
WOW Very Happy
Very Very good!
Quote:

do you want to continue your 3Dengine project?

I don't Know,I like Hardware programming and my hobby is math,
this is my first experiment with 3D,i have started one week ago.
It is a intriguing stuff, my purpose is only learn some computer graphic basis.
Thanks for your guidance Wink
Post 19 Nov 2007, 15:54
View user's profile Send private message Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat 23 Nov 2007, 05:46
DJ Mauretto & edfed: WOW O_O

Bravo!!!

DJ - Your stuff reminds me of some of the stuff I think my dad used to do in QBasic a while back.

edfed - Your stuff reminds me of (don't ask me why) the Star Wars Tie Fighter game that used to be for DOS.

All in all, amazing work you two!
Post 23 Nov 2007, 05:46
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2, 3  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.