flat assembler
Message board for the users of flat assembler.

Index > MenuetOS > Flat shading

Author
Thread Post new topic Reply to topic
macgub



Joined: 11 Jan 2006
Posts: 346
Location: Poland
macgub 11 Jan 2006, 14:28
Will you see it ? Intros to MenuetOS to download.


Description: Wavy flat shading rotary object.
Download
Filename: flatwav.zip
Filesize: 5.7 KB
Downloaded: 991 Time(s)

Description: Flat shading rotary object.
Download
Filename: regina.zip
Filesize: 5.88 KB
Downloaded: 988 Time(s)

Post 11 Jan 2006, 14:28
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 12 Jan 2006, 11:18
Nice demos - tell us about them. A blog or something Very Happy What techniques did you use and how long it took you...etc.
BTW, they ran under emulator with incredible speed Neutral - I ran them together and 0-1% CPU. When I put the FLATWAV moving faster then one core showed ~50%.

P.S. boobles - did you mean bubble-sort? The algorithm where you swap two unsorted objects and iterate until all have been sorted.
Post 12 Jan 2006, 11:18
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
halyavin



Joined: 21 Aug 2004
Posts: 42
halyavin 12 Jan 2006, 18:38
My very old ugly (it even doesn't support exit) demo, it still have some 3d bugs (I wonder will you see them)... It uses texturing, but doesn't implement lighting. I am not show sources because they are big enough. (it written in fpc+asm)


Description: simple 3d demo.
Download
Filename: opengl.zip
Filesize: 5.86 KB
Downloaded: 970 Time(s)

Post 12 Jan 2006, 18:38
View user's profile Send private message Visit poster's website Reply with quote
macgub



Joined: 11 Jan 2006
Posts: 346
Location: Poland
macgub 13 Jan 2006, 12:16
What is fpc - C compiler?
@Madis I made a triangle drawing procedure. It uses only integer counts - not touch FPU. On this procedure is based engine.


Description: One another intro using flat shading.
Download
Filename: cruce2.zip
Filesize: 6.39 KB
Downloaded: 960 Time(s)

Post 13 Jan 2006, 12:16
View user's profile Send private message Visit poster's website Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 13 Jan 2006, 19:59
Post 13 Jan 2006, 19:59
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 14 Jan 2006, 13:36
Yes - I did make some experiments:
1) www.anim8or.com
2) Some testobject
3) Export to vertex
4) make all floats to integers and put points and vertexes to right places

Very Happy works like magic

EDIT:
I want to thank you for all the hard work you've done. I took your piece of art and made 3DS-reader on top of it. Have a look - I made some optimizations, turning into MMX, but SSE couldn't be tested under MeOSEmul Sad
http://www.whisqu.se/per/docs/graphics56.htm
http://thorkildsen.no/faqsys/docs/3ds2.txt
I didn't make it fully 3DS-compliant, of course, but I filtered out the points and vertexes to quickly get it done. 2-days and I'm very surprised it was that easy.

EDIT2:
What could be wrong with SSE. It constantly keeps crashing like SSE is not supported. MMX code runs well, but at first SSE instruction it just quits with interrupt.


Description: 3DS-reader/renderer + 3DS sample file + source
Download
Filename: 3DS.7z
Filesize: 7.22 KB
Downloaded: 949 Time(s)


_________________
My updated idol Very Happy http://www.agner.org/optimize/
Post 14 Jan 2006, 13:36
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
macgub



Joined: 11 Jan 2006
Posts: 346
Location: Poland
macgub 16 Jan 2006, 08:33
@halyavin. Textured triangles that is it!
@Madis. Seems to be nice. I enjoy, my work was development.
Post 16 Jan 2006, 08:33
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 16 Jan 2006, 22:43
I had to modify Mike's emulator too Sad I didn't wish to do it because it would be nicer if all could get their emulators from one place, but it lacked EMMS and PXOR instructions that I used.
--Sorry Mike

EDIT: I've got an idea! Maybe I can map z into the drawing area and if anything wants to draw - it checks z first. Then you don't have to sort at all. The sorting algorithm is already much faster in non-optimized mode and about 2 times faster in MMX mode, but I think I'm going to do some advanced quicksorting on that thus increasing stack requirements :S but we'll see...

--Mike - I made your MeOSEmul 1.65.8 compatible and I think I'm going to mail you soon if you're not reading these boards Wink

EDIT2:
A demo added using QuickSort+Insert. I noticed that you needed z-s to be top down so I need to make it work the other way Very Happy but here's the teaser.
You'll get MMX-enabled MeOSEmul.exe later and sources...

EDIT3:
Another realization: the top-down order is possible negating only 5 jumps, but it only works perfectly under OllyDBG (I mean no under/overflow). If I put it to MenuetOS - I get an access fault and program exits immediately. But the program is now 100x quicker and I've come to a new bottleneck. If I could get the drawing 30x faster, I would say - a bottleneckless code Very Happy

EDIT4:
Yet a thought: instead of doing:
call calculate_angle ; calculates sinus and cosinus
call copy_points
call rotate_points
call translate_points; translate from 3d to 2d
call clrscr ; clear the screen
call sort_triangles
call draw_triangles
you can sort the triangles and write the result back to original data. This way you can minimize the impact on sorting, because rotating the object causes only minor changes in order which you can easily have insertion sort handle.

You will make angle, rotation, translation only to the fresh data.

EDIT5:
I made quick+insertsort work Very Happy. Yeah! Now back to drawingboards...gotta make drawing faster.

<<<ATTACHMENT REMOVED>>>
Look the following posts, this one had bugs in it.
<<<ATTACHMENT REMOVED>>>

_________________
My updated idol Very Happy http://www.agner.org/optimize/


Last edited by Madis731 on 23 Jan 2006, 08:27; edited 1 time in total
Post 16 Jan 2006, 22:43
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
macgub



Joined: 11 Jan 2006
Posts: 346
Location: Poland
macgub 20 Jan 2006, 08:04
[/quote]
When only piece of triangle with greater z coordinate is visable, the image would be uncorectly... I must check it.
Post 20 Jan 2006, 08:04
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 20 Jan 2006, 13:08
@macgub: Do you mean the black holes?

@Everyone interested:
Finally I'm satisfied. But don't think that I'm quitting now. I will fix some bugs in drawing routine. Only this takes time and I thought posting you some results is appropriate.

1) 3DS.ASM, House.3ds, Comp.3ds, 3DSNON (plain), 3DSMMX (w/ MMX)
The latest sources and binaries nicely in a package for you to test. I'm a bit worried why my MMX theory contradicts with facts, but MMX is slower on emulator - maybe its faster in the real world.

2) My MeOSEmul fixes
It compiles under FASM 1.65.8 and has some increased MMX support as I stubled upon new instructions. Go to Emul_0F.asm and find instructions like EMMS, PMULLW/PMULHW, PSLL(W/D/Q), POR, PXOR, PAND, PANDN, maybe something else too. THERE ARE BUGS!!! I didn't watch very closely the bytecodes so some instructions like PMULLW and others don't support immediates etc.

EDIT: I deleted the file to preserve space - you can always check out http://mikedld.com


Description: (1)
Download
Filename: Full3DSPackage.7z
Filesize: 10.85 KB
Downloaded: 873 Time(s)


_________________
My updated idol Very Happy http://www.agner.org/optimize/


Last edited by Madis731 on 08 Apr 2006, 21:32; edited 1 time in total
Post 20 Jan 2006, 13:08
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
mike.dld



Joined: 03 Oct 2003
Posts: 235
Location: Belarus, Minsk
mike.dld 20 Jan 2006, 21:45
Madis
I've got your e-mail. Yeah, I don't read boards too much now and last time I saw this topic there were only 4 answers (w/o yours). Have nothing against your additions to MeOSEmul. The only thing you have to keep in mind is that Menuet now doesn't support SSE(2,3) and 3DNow! (only MMX), so if you'll add these instructions support to MeOSEmul, it will allow you to write non-working applications.
Post 20 Jan 2006, 21:45
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
macgub



Joined: 11 Jan 2006
Posts: 346
Location: Poland
macgub 23 Jan 2006, 08:03
@Madis IMHO black holes are caused bad color triangle. It's not a big problem. I don't know why but older vwersions of your 3d work dont runs on my computer correctly. Now I run an MMXEmul and MMX version of 3DS and I saw house. Congratulations.
Post 23 Jan 2006, 08:03
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 23 Jan 2006, 08:35
I know what was the problem. I removed the FINIT because I didn't use any other instructions than FPU. But then I added MMX support and forgot to put the "init" back. So I tried fixing it with EMMS but no success. The only fast way was to clear FPU/MMX with FNINIT. This means no waiting for exceptions. And now it works. The drawing routine uses too much pushing and popping of registers. I might try to optimize these. I'll see what I can do.

The z-ordering works only when you have no overlapping triangles. You can't rely on the average z Sad But when fixing this, you must rewrite a lot of calculations and maybe even split some triangles. I think first I'm going to increase some speed and then lets see what we can do on the feature part. Smile

Good luck on your research!
Post 23 Jan 2006, 08:35
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 05 Feb 2006, 13:26
Okey, this needed another post:
I've optimized many parts of the code and got it reasonably fast. Then I decided I needed to loose those divisions so I tried converting it to bresenham, but I'm only in the half way there, because what you see is wireframe, not full faces.
I'm a bit afraid I can't get the most out of it because the wireframe is as fast as the full faces with the previous algo. This means that full-faced-bresenham-algo program might be slower. Lets see what it brings us Smile
Here's a bit of pre-taste!

P.S. Works best on short pipelines because of jumps and random access!!!
(i.e. Pentium III = Good, Pentium MMX = Best but Prescott and up == Worst!)


Description: The program with Bresenham linedrawing wireframe
Download
Filename: Bresenham.7z
Filesize: 9.01 KB
Downloaded: 941 Time(s)


_________________
My updated idol Very Happy http://www.agner.org/optimize/
Post 05 Feb 2006, 13:26
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
macgub



Joined: 11 Jan 2006
Posts: 346
Location: Poland
macgub 27 Feb 2006, 13:40
Now rotary in all directions. I want present another version of house.


Description: another version of house.
Download
Filename: 3ds2.7z
Filesize: 8.94 KB
Downloaded: 886 Time(s)

Post 27 Feb 2006, 13:40
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 27 Feb 2006, 16:59
Simple, but GREAT! Good job.
Post 27 Feb 2006, 16:59
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
willow



Joined: 26 Jan 2005
Posts: 18
Location: Kiev, Ukraine
willow 28 Feb 2006, 11:59
See new really fast emulator from diamond:

http://shade.msu.ru/~msu-se/KlbrInWin.7z
http://shade.msu.ru/~msu-se/KlbrInWin_src.rar

Discussion and bugreporting on Russian forum:
http://meos.sysbin.com/viewtopic.php?t=426
Post 28 Feb 2006, 11:59
View user's profile Send private message Reply with quote
macgub



Joined: 11 Jan 2006
Posts: 346
Location: Poland
macgub 02 Mar 2006, 10:04
Emulators that is really good thing. I can write program in Windows, compile it by FASMW and run/test it by emulator. This one is quick indeed. I test it by MOS3DE - rotary textured cube.
Post 02 Mar 2006, 10:04
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< 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 can 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.