Jump to content



Photo
- - - - -

3d-grapher


  • Please log in to reply
50 replies to this topic

#41 MathManiac

MathManiac

    Casio Addict

  • Members
  • PipPipPip
  • 85 posts
  • Gender:Male
  • Location:Portugal
  • Interests:Maths & Physics
    Girls
    Science fiction
    Cinema

  • Calculators:
    fx CG20
    fx 9860 GII SD
    Afx 2.0 plus
    CFX 9850 G
    Fx 115 D
    TI 83 Plus SE
    Ti 92 Plus
    Hp 49 G

Posted 12 November 2002 - 01:32 PM

:huh: Ok, my mail server was with problems again! Please send me your 3d Grapher. I'd like to give it a try!

#42 BiTwhise

BiTwhise

    Casio Overgod

  • [Legends]
  • PipPipPipPipPipPipPip
  • 627 posts
  • Gender:Male
  • Location:Guildford, Surry, UK
  • Interests:Programming, games, consoles, martial arts

  • Calculators:
    FX9700WE, CFX9970G, AFX2.0, Classpad 300

Posted 12 November 2002 - 02:07 PM

ok...

I've sent it again :)

If you use messenger, I can transfer it directly to you.. :)

#43 MathManiac

MathManiac

    Casio Addict

  • Members
  • PipPipPip
  • 85 posts
  • Gender:Male
  • Location:Portugal
  • Interests:Maths & Physics
    Girls
    Science fiction
    Cinema

  • Calculators:
    fx CG20
    fx 9860 GII SD
    Afx 2.0 plus
    CFX 9850 G
    Fx 115 D
    TI 83 Plus SE
    Ti 92 Plus
    Hp 49 G

Posted 12 November 2002 - 06:05 PM

I am beyond a damn good firewall .

#44 BiTwhise

BiTwhise

    Casio Overgod

  • [Legends]
  • PipPipPipPipPipPipPip
  • 627 posts
  • Gender:Male
  • Location:Guildford, Surry, UK
  • Interests:Programming, games, consoles, martial arts

  • Calculators:
    FX9700WE, CFX9970G, AFX2.0, Classpad 300

Posted 16 November 2002 - 08:25 PM

for anyone who wants to download my 3d-test program, you can now do so from the teamg100 website: http://teamg100.free...ode=jeux&type=0

enjoy :D

if you still want the full source, please contact me be e-mail or msn messenger

#45 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 19 November 2002 - 12:02 AM

Hi there, this is my first post here! :)

It's not the first time i come, but now i think i have a lot of things to learn among you, so i decided to register me as member... :D

To present me in a few words, i'm a 18 y.o belgian boy, and i have programmed in basic language on casio CFX-models for 2 years.
Now i also have an algebra-fx2 ( rom 1.02 ) and i began to work in C/asm 2 monthes ago...
Actually i'm admin of the Forum Commun Casio, which concerns only the Basic language ( my current nick is Julien ), and now i use to go to the french Forum G100 to learn C/asm languages ... :)

As you can see my english isn't perfect, sorry about that, but i'm sure it will be a good training for me to come here! :rolleyes:

Anyway, why am i telling that in this topic? :blink: )...

I would ask to BiTwhise which technic he's using to create rotations, because i did it with rotation's matrixes, it works, but it's sooooo slow :(


To end this post i just want to ask if some people is still working with the Basic language here ( making RPG of so :) ), and if some visitors come sometimes with questions about that language: maybe i will be helpful for someone :lol:

#46 Casto Productions

Casto Productions

    Casio Freak

  • Members
  • PipPipPipPip
  • 152 posts
  • Location:IL, USA

  • Calculators:
    TI-83, TI-86, CFX-9850, AFX2.0

Posted 19 November 2002 - 06:21 AM

welcome, yes I still work in BASIC, but probably not a good topic to start this conversation. :D

#47 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 19 November 2002 - 12:50 PM

Sure it isn't, i was just asking :)

#48 BiTwhise

BiTwhise

    Casio Overgod

  • [Legends]
  • PipPipPipPipPipPipPip
  • 627 posts
  • Gender:Male
  • Location:Guildford, Surry, UK
  • Interests:Programming, games, consoles, martial arts

  • Calculators:
    FX9700WE, CFX9970G, AFX2.0, Classpad 300

Posted 20 November 2002 - 12:42 AM

Anyway, why am i telling that in this topic?  <_<
Simply because i'm really impressed by the work of BiTwhise: when i tried to do the same ( in C language ) a few days ago i realized it was time for me to improve my skills (  :blink: )...

I would ask to BiTwhise which technic he's using to create rotations, because i did it with rotation's matrixes, it works, but it's sooooo slow  :(

:D

THANKS!!

Well, basically I use normal rotation matrixes. However, I've written the routines myself, in assembler, and use only fixed point math...

If your using floating points, that should explain any drastic performance hit.. since the calc doesn't have an fpu :(

As for the structure of my program, it's quite streamlined.. that is, most functions are inline.

Things you could do to speed up your program:
* use inline function.. so you don't have to do so many jumps
* use asm libraries for graphics (probably doing so already). in most cases this will be more cpu intensive than the rotations...
* if you're (like in my case) drawing tons of short lines one after another in a loop, make your line drawing procedure inline... that will speed things up a bit
* try to limit data acces as much as you can, align data and use string functions (I know this can be a bit tricky in c.. you can always use inline asm)

* write the entire thing in asm :lol:


Anyway, Welcome to the forum, and good luck with your programming :)

#49 BiTwhise

BiTwhise

    Casio Overgod

  • [Legends]
  • PipPipPipPipPipPipPip
  • 627 posts
  • Gender:Male
  • Location:Guildford, Surry, UK
  • Interests:Programming, games, consoles, martial arts

  • Calculators:
    FX9700WE, CFX9970G, AFX2.0, Classpad 300

Posted 21 November 2002 - 05:37 PM

Hi again there, Orwell / Julien...

I just browsed through the french forum, and came across the source of your 3d programe :)

I'm sitting at school right now, so I haven't uploaded and tried it, but from a brief look at your source I can tell you why it's much slower...

(probably mentioned lots of this in my previos post, but anyway)

* you use doubles for coordinates and roations... that means lots of floating point math... your calc just isn't up for that, and the difference in onscreen result isn't really visible (major performance hit)
* graphical function... well, you do have som inline asm, but you do function calls too often. you use a function inside your line algorithm, wich means you do a call for EVERY pixel, calculating the effective address of EVERY pixel!! (major performance hit)
* use while loops instead of for loops, basically do all you transformations in reverse order... doing this will make the loop compile to a loop statement with the counter in cx, or at least a loop where the counter is only checked for zero, rather than compared for a value. you might even consider asm for inline loops... (minor performance hit)

you can easilly do some minor tweaks to your programe..
* get hold af a line drawing function in asm, pass paramaters as a pointer to 1 structure, rather than x,y values... or, for best perfomance, make it inline
* calculate the memory address of the current page in the start of each frame -> pass this value instead of the page number (or just store it in es, the compiler will probably not change this unless you use string functions for writing to mem)
* as mentioned, reverse your loops, make them while loops (inner loops that is, outers aren't really that important)

Well, that's all I could think of right away, need any help or more suggestions, just post or e-mail me :)

#50 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 22 November 2002 - 09:56 AM

Thanks for providing me so much advices! :)
Sorry i forgot to tell my sources were available on the french forum :unsure: , but you have found them...


Well, i suppose you saw it on the forum: 2072 has the same ideas as you :D

* i know the float type isn't really appropriate for this program, but what would be the most efficient way to replace it ? I tried to work with int type multiplied by 1e4 or another factor, and then divided by the same factor to put the points on screen, but the speed is the same...

* i've put the pixel function inline in the Line one, but i think it would be better to work with some asm function to draw line between 2 points of screen than with for loops like the one i use... Maybe someone has that for me? :D

* i didn't thought about the differences between the loops... but now, perhaps i can try without loops to multiply the rotation matrixes ( 9 lines by multiplication B)
This 3d program was just to have a liitle break in the production of the other; i did it cuz i saw your work and i just wanted to compare the results (now i've seen! :lol: )
Actually i made the same 3d program in Basic a couple of monthes ago ( for CFX models only), sure the speed wasn't the same but for basic language i obtained good results: it draws cubes, spheres, torres ( you know, the donut-like form :D ),...

I keep on mind all your advices, it will certainly help me in another projects, and when i'll have collected enough experience i will try 3d programs again! :)

#51 BiTwhise

BiTwhise

    Casio Overgod

  • [Legends]
  • PipPipPipPipPipPipPip
  • 627 posts
  • Gender:Male
  • Location:Guildford, Surry, UK
  • Interests:Programming, games, consoles, martial arts

  • Calculators:
    FX9700WE, CFX9970G, AFX2.0, Classpad 300

Posted 22 November 2002 - 04:40 PM

To address your questions:

i know the float type isn't really appropriate for this program, but what would be the most efficient way to replace it ? I tried to work with int type multiplied by 1e4 or another factor, and then divided by the same factor to put the points on screen, but the speed is the same...

What you need to do is work with fixed point ingeteger math.. that does not mean dividing by ANY constant factor, it has to be a factor in the power of 2... so you can you bitwise manipulation to obtain the integer, or fraction part of the number. you do this be shifting the number, left (to multiply) and right (to divide)... if you want to compensate for truncation rounding error, you perform an 'adc variable, 0' after the last right shift (or you do an 'inc varible' before the shift)
Using regular division and multiplication to do this is very costly... about 30 ticks for one multiply (I think)

i've put the pixel function inline in the Line one, but i think it would be better to work with some asm function to draw line between 2 points of screen than with for loops like the one i use... Maybe someone has that for me?

Putting the pixel function inline should speed things up a bit (only a bit), so getting a line function in asm would be the best idea. If you use the 'D3' linear screen mode, I have some line drawing functions you can use. If you use casio's standard 'C3' mode, I'm shure someone else can give you those functions

i didn't thought about the differences between the loops... but now, perhaps i can try without loops to multiply the rotation matrixes ( 9 lines by multiplication  )... it isn't really great for the program's size but...

Uncrolling loops, like your matrix multiplications is a good idea.... and it doesn't affect program size that much.. I mean...look at you code.. it's not YOUR code that make the program size 50 - 60 K, it's all the C include files :D (one of the reasons high level language isn't really suitable for small machines like this)

Glad to help, and the best of luck with you diary project :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users