| Post Your Message | |
| |
| Previous Messages | Posted By
MMS on 2019-05-26 12:15:01
| Re: Maximum Dimension of arrays in Basic
Really great view! I really need NO imagination to see the Shuttle, it is a Shuttle!
Worth noting, that in the 80s the best of the best 3D views were Mercenary, Flight Simulator2 and Driller like games, next to Elite. All these worked out in assembler, highly optimised code, and used much less complex objects than this Shuttle, especially the filled vector Driller. So the speed you mention in BASIC not the BASIC alone, but because the models you use are a highly complex models with hundreds of surfaces. Downloaded directly from NASA
Blender is a top notch 3D modeller, they can even not able to imagine such possibiilities of it back to the 80s. Much better quality, and much more models are possible with the help of internet, than it was available 30 yeasrs ago.
Just worth mentionning those game had more simple models, like FS2, it updated the screen in every 1.5 - 2 seconds, but used very low poly models, like this. (OK, it i multicolor with 160x200)
Your method can evidently do much better result than these ingame 3D. As we had no real good 3D modeller, like GigaCAD for C64, your program package seems to be the best 3D viewer available for Plus/4.
How to speed up? Compile it. With integers it could be rather fast. Not realtime due to complex object. Even an IBM XT could not manage it. Maybe LITWR would be nice to support you a compiled DRAW command (Austrospeed just passing GFX commands back to the interpreter).
|
|
Posted By
George on 2019-05-26 00:53:25
| Re: Maximum Dimension of arrays in Basic
@MMS: Thank you. After your hint with the integer instead of real i changed the code. The programm remains slow. Since this is done BASIC and speed is not what i was focusing from the beginning.But i think with outsourcing parts to assembler, maybe this experiment could be usable on real machines too.
I spend a few hours modifing the shuttle from NASA in Blender (learning this extrem complex program as sideeffect). There are much better free shuttle models outside, but i wanted the original since it has "only" around 2000 vertices. I turned the triangles into sqares and removed internal faces as good as possible, since my very primitve hidden face algorithm (due slow CPU power), would show them too. It found out, that it is a challenge to find and create 3D-models, that will look good on a 320x200 screen. Either they are too complex or too simple.
I also made a converter in C# for the *.obj files (ASCII Format) that converts the real numbers into integer-numbers and creates the vertex- and face-SEQ-files for the main BASIC-programm. Its great fun to play around with the angles, shifting and scaling to find the best possible view. I hope you like the result.
|
|
Posted By
MMS on 2019-05-24 15:41:31
| Re: Maximum Dimension of arrays in Basic
WOW! It looks GREAT! Also a very nice achievement to show such complex objects on a simple 8bit 64K machine. Congrats!
I read a little: Integers takes much less memory, but in normal BASIC it could be slower(!) than the floating point calculations. "Integer (16 Bit): This is a rarely used type. Integer variables carry a '%' at the end of their name (eg. X%). Note that all computations are performed with float precision and conversion to Integer is only performed when the value is assigned to a variable. Thus Integer math is SLOWER (!) than Float math."
On the other hand, when you compile the program, the things may turn around, and the integers arithmetic could be way faster (as the continuous conversion does not happen). It was a suggestion by SVS or Csabo before Austrospeed compilation some years ago, here we can do a second try, as here are some heavy calculations... It did not work as expected for simple FOR..NEXT, but for real calculations it should have a real impact.
|
|
Posted By
George on 2019-05-24 15:35:26
| Re: Maximum Dimension of arrays in Basic
Next milesstone achieved yesterday: Due to our small resolutiion (320x160) the Vertex information (x,y,z) can be hold as integer in memory. So without any further tricks (accessing hidden memory, loading drawing in stages) the max vertices of an object goes up to 4500+ (depends on the amount of Basic-Code). Thats more than enough to project decent models. The shuttle is loaded in one step now. I will do a release in future.
Edit: polygonian faces, hidden planes, 3581 vertices
|
|
Posted By
MMS on 2019-05-15 13:53:01
| Re: Maximum Dimension of arrays in Basic
Very nice! It is fascinating to see a real NASA 3D model shown on Plus/4 screen as a rotatable object.
|
|
Posted By
George on 2019-05-14 19:35:32
| Re: Maximum Dimension of arrays in Basic
Next milestone and a huge step forward: Today i implemented loading dynamic n-polygon faces (instead of triangels) and loading from sequential files in stages. This model has 3580 vertices and 2370 poliygons. I had to find a way how to hold all vertex information in memory especially for the line drawing. I also found a much easier way to convert the *.obj files with a simple text-editor, to be able to be used with my program.
Two drawing modes: a) dot-mode: (faster for positioning) b) face-Mmode: final drawing of the line for the beauty shot. Again the hidden faces are drawn in this version. This will be my next point.
|
|
Posted By
MMS on 2019-05-14 15:14:37
| Re: Maximum Dimension of arrays in Basic
It looks fantastic! I am really curious, how much time it takes in BASIC? so many points, so many edges.
Seems the demand increases for a proper 3D accelerator card with D4D interface (or at least an FPU)
|
|
Posted By
George on 2019-05-13 16:46:28
| Re: Maximum Dimension of arrays in Basic
With removed hidden faces. Still a lot work to do:
@MMS: Cool thing you got it work on compilers. I am courious how fast you can make this in BASIC..
|
|
Posted By
MMS on 2019-05-13 15:44:26
| Re: Maximum Dimension of arrays in Basic
Thanks for the info! Heh, next time please download one from the little greys! Then we will have an authentic UFO 3D object
More seriously: -Actually the hiding of the rear part will surely mke the picture even more gorgeous, and will speed up the drawing process. On the other hand, the calculation still need to be done. -I agree removing the small parts will significantly speeds up calculation of the shuttle, anyhow our resolution is not there. -The Austrospeed Compilation WORKs! Approx 2x faster code. (3sec/frame instead of 5.5 -6.0 sec/frame). We knwo, that the DRAW routine remains the same BASIC code. -with Fullthrottle emulation (at me C2D 8500: 1800%) the Austro compiled Cube BASIC PRG rotated the cube in realtime -Next one will be Litwr's compiler (probably even faster code), and also will try Hungarian PlusComp (before this it never worked, though it states even handles the drawing routines).
|
|
Posted By
George on 2019-05-13 06:39:04
| Re: Maximum Dimension of arrays in Basic
Thank you all, for the positive feedback.
@SVS: Thanks for the tip with the input# line. I will definatly use this, when i get rid of the triangles and draw polygons instead. @MMS: The Shuttle data comes directly from the NASA site for free use. @MAD: I carry this idea since i am 14 or 15. The internet makes it possible now to obtain the needed knowledge to realize this personal dream of mine. I never did 3D programming in my life. To do it in BASIC is intended by me, to see whats possible. Its also great fun, because its a very easy language.
I realized, that this model is composed of smaller objects, thats why so many additional lines are drawn. Even if you blend out the hidden faces, you can see the underlying faces of the parts. I have to find way in Blender to remove the inner Vertices and faces in order to simplify the whole model.
|
|
Posted By
Mad on 2019-05-12 19:40:20
| Re: Maximum Dimension of arrays in Basic
Didn't know this is possible in basic.. Or at least never thought of such cool stuff! Cool achievement there!
|
|
Posted By
MMS on 2019-05-12 17:59:57
| Re: Maximum Dimension of arrays in Basic
This shuttle looks amazing, especially it could be freely rotated
George, we need that tool to able to design the scenes of our next games in Blender
|
|
Posted By
SVS on 2019-05-12 14:48:28
| Re: Maximum Dimension of arrays in Basic
>>I write int the sequential file as number, but have to read as string. Couldnt get it running otherwise. I suppose the print# method convert always as string.
Yes PRINT# just put the characters of a numbers as ASCII codes, proceeded by " " if positive or by "-" if negative.
>>Is there a better method?
You can make things faster if you save (PRINT#) more data inside each single record. In this way you will read them with a single INPUT#. To do this you have to save a "," between the values when you use PRINT#.
For example: PRINT#2, 10,",",20,",",30 will be read by INPUT#2,a$,b$,c$
P.S. Nice work!!
|
|
Posted By
George on 2019-05-12 13:17:07
| Re: Maximum Dimension of arrays in Basic
The promised Basic-Code from my little experiment:
3dcube.bas
Rotation along the 3 axis with Y,X,C (forward) and B,N,M (backwards). Shift up,right,left,down with W,A,S,D Display current values of the variables (angles...) with I
Copy and paste the code in your favourite emulator and turn maximum speed on for playing around, because the code is not optimised for speed yet.
If there is any interest, i can give you a little tool for converting *.obj files into BASIC code for displaying other 3D objects.
Edit 12.5.2019: Next milestone "Space Shuttle": To get more vertices into memory i read the object datas now from sequential files.
My next question: I write int the sequential fuile as number, but have to read as string. Couldnt get it running otherwise. I suppose the print# method convert always as string. Is there a better method?
wirte OPEN8,8,12,"vertex,SEQ,WRITE" ... print#8,x:
read OPEN 8,8,12,"vertex,SEQ,READ" ... input#8,x$
I will try to hide the hidden faces next days...
|
|
Posted By
MMS on 2019-05-09 18:31:24
| Re: Maximum Dimension of arrays in Basic
Nice!!! much more complex, than the mentioned BMW
|
|
Posted By
George on 2019-05-09 16:44:35
| Re: Maximum Dimension of arrays in Basic
The promised screenshot (370 vertices, 630 triangles).
Sorry for the strange angle, but its just a quick demostration to get an idea. Thank you for your support realizing this so far.
|
|
Posted By
MMS on 2019-05-09 11:40:51
| Re: Maximum Dimension of arrays in Basic
Nice! I am really curious about the final implementation.
One question: most of those XXX-BASIC extensions have a small problem. The program made with it, cannot be saved (compiled) in a way, that it could become a stand-alone program, could be run without loading the basic extension first. For example Sprite Basic can do impressive things, but you cannot share the code you have, or at least not so easy. I read the GRAPHICS program details even in Club Info (quite impressive!), but I could not find, could it export the program as a self--runnable PRG.
@George: if you would draw the lines with POKEs like on C64 , that could be compiled by Litwr's compiler, and may "suffer" a 4-6x speed increase, maybe more... (I plan to find and download a C64 wireframe code, as it should be pretty easy to change the memory addresses, then compile it).
There guys below developed Real 3D, made their debut on C64, and their rotating wireframe BMW car took 10 seconds per frame (!) calculation in assembler(!). Any speed below that should not be surprising (eben in compiled mode). These guys seems to be "pro", as based on their history they had first the idea of ray-trace, and even some of their sample gfxs known by me. http://www.realsoft.com/history/
|
|
Posted By
George on 2019-05-09 09:29:44
| Re: Maximum Dimension of arrays in Basic
Here the site, where i found the code:
http://retro64.altervista.org/blog/3d-graphics-rotating-cube-with-freebasic-pc-and-simons-basic-c64
I did not use Simons Basic. I solved my problem with the arrays by using READ and DATA for initializing and drawing the triangles, reducing so the overall code in memory. So drawing and rotating a more complex model on a plus/4 was possible (my example is a plane with 370 vertices). The basic code (Vertices initialization and Triangle drawing) is directly generated from a OBJ file which I export from Blender (eg). I could not rotate the plane in a way to present it nicely here with a screenshot, got too late yesterday.
|
|
Posted By
SVS on 2019-05-08 05:56:42
| Re: Maximum Dimension of arrays in Basic
The SW I was referring is named Graphics available in Plus4world archive.
|
|
Posted By
George on 2019-05-08 05:28:50
| Re: Maximum Dimension of arrays in Basic
@Csabo: The Circle Command draws a triangle around a centerpoint, which i cannot use in my case. But its fascinating that you can do it this way too.
@SVS: Thank you for the hints. The best way will be reading the 3d data from a separate file to get more complex objects in memory. I will post the source later, for the interested.
|
|
Posted By
SVS on 2019-05-08 04:35:16
| Re: Maximum Dimension of arrays in Basic
Csabo solution is elegant, but be informed that the DRAW command works much faster.
@George: - if you want to calculate the exact array fitting in memory, you could use my Array-calculator inside the Ultimate map, Basic page. - I remember it is existing inside SW archive, a very good 3D utility that add to Basic many 3D commands. Maybe you can retrieve useful info (even if I'm credited for the documentation, it was not me to create it). - Pls let us use your ported 3D engine!
|
|
Posted By
Csabo on 2019-05-07 20:37:03
| Re: Maximum Dimension of arrays in Basic
Yep, that works. You can also do it with CIRCLE
CIRCLE , 160, 100, 50, , , , , 120
|
|
Posted By
George on 2019-05-07 19:34:00
| Re: Maximum Dimension of arrays in Basic
Thank you for the answer. Is there any way to draw a triangle efficiently in BASIC with given coordinates without using 3xDRAW? Could not find anything..
Edit: Found the answer in our Reference: Draws an triangle with a single DRAW command.: DRAW ,160,100 TO 100,100 TO 130,50 TO 160,100
|
|
Posted By
Csabo on 2019-05-07 18:56:27
| Re: Maximum Dimension of arrays in Basic
There's no limit, except the memory. The smallest thing you can hold in an array is an integer, which takes up 2 bytes.
RUN this as an example 0 DIMA%(30000):FORI=0TO29999:A%(I)=I:NEXTI ... and it will happily allocate 60000 bytes for you, filling up pretty much all the memory.
Regular numbers take up 5 bytes, so at most you could dimension a single array for 60671/5 ~= 12K elements. That's pretty much all there is to it, I think.
|
|
Posted By
George on 2019-05-07 16:45:16
| Maximum Dimension of arrays in Basic
Hi,
I am experimenting in Basic with a simple Wireframe 3d engine, which I ported from FreeBasic to our system, which can display and rotate 3d-Objects. Works fine with small objects, that have not too many vertices.
Next step was do display large objects with many vertices (like a plane) and I have the problem with the dimensioning of the arrays which hold the vertices. If the arrays gets too large I run out of memory..is there any limitation? I remember reading something about it, but I can't find the source any more...
Greetings George
|
|
| |
Copyright © Plus/4 World Team, 2001-2024. Support Plus/4 World on Patreon |