Video wird geladen...
Video konnte nicht geladen werden
** Sega Genesis 3D engine Day 2 ** Added solid filled triangles. Added colors ( full 15 color buffer ) . All code in C so far apart form the buffer clear and DMA buffer sending so should be some good speedups to come yet once line / triangle... show more
17,718 Aufrufe • vor 6 Monaten •via X (Twitter)
30 Kommentare

I had this question in my mind for some time now. I remember reading a post by one of the programmers that Thunder Force V was originally for the MD with a mix or pre-rendered and actual polygons. A MD version of TFV could be actually possible?

didn't solve the division problem here, but it's partly what led me to preferring Quads as at least you're only doing 4 instead of 6 to fill the same shape!

I can use reciprical multiplication rather than division so that will cheapen them a bit , although i dislike the cost of the divisions its a the minor part of the cpu load when drawing the triangle in reality, it just hurts seeing 100s of cycles per instruction, thats interesting what you say about quads though . I'm writing the triangle routine in assembly now , hoping for good gains .

@spacebruce Newton-Raphson approximation for 1/x may come in handy 🤓

@spacebruce Yes ! I've used it before and it could net some gains but the hot path is more in the line drawing part of the triangle filling , so focusing energy there at present. If only i could make a workable row layout buffer rather than column.

@spacebruce My guess is, you'd need to generate a "jumpable" code map for various cases of span offset (within 8-pixel tile) and span length, then do optimized unrolled line drawing. MOVEM looks like it can come in handy, I would expect it to avoid the instruction fetch bus access.

@birt_shannon This seems the way, I'm doing figure out number of tile spans, move.l, decrement 1, branch, which should be easy to adapt to a table.

Pretty much doing that now , it has to slow down near the edges though . Got to watch the overhead too as if you spend too long figuring out how many spans etc then its slow for everything thats a small span. Unless you have a code segment for every span length which is getting into python script territority to write the asm for you .. the edges eg alignment , do muck up the simplicity of that though . I think movem here is of limited use as it can't stride well .

@EndoOleg Yeah, it's easy to cook up schemes that will load the perfect optimised routine for every occasion, but at some point the detection/entry mechanism drags down all the other cases.

What if you use smaller forms? If so can you increase the number of them?

Yes, if they are smaller you can have a lot more of them . Its still been optimised though so should be ablemton get more yet .

I hate to just geek out but OMG, so cool!! A great start

Thanks 😀 Its been a lot of fun so far !

Literally incredible! Getting solid 3D at 60fps on Genesis hardware? Respect. 🤩

👍

THX attack chopper 2 is coming !

Haha , maybe just the tail rotor .

@pikuma You need two 68k chips which Genesis lacks

@pikuma A 68020 would be nice !!

@pikuma Konami used dual chips . Wec Le Mans 24 is a good example of 3d w those 32bit older cisc chips

Errr.. distracted again ? cough cough Parodus, lufthott, Sota.........Or maybe start porting oids from the St. good work focus on the goal, before I pass on, 57 you know not much left in the tank....

Its hard to not get distracted admittedly , but normally able to take the learnings back to the other projects so its not a total time waste 😉

I can feel my arteries tightening , I may not make it to any completions..... dial 99999999999999999999999999999999999999999

🤣 .. I worry about the same thing haha . Got to keep it fun - we will get there !

So you have a fixed tilemap and the soft rasterizer is writing into 8x8 tiles data?

Yes , thats how you do a bitmap type mode on the Genesis. It works but the layout does require a bit of cpu to translate to x and y , as you have tile boundaries. For speed you cant Write directly to vram as theres a small window every frame to write to vram at speed, so you Write to ram first , then send a buffer at a time to vram .

ok so the software rasterizer is writing in stadard 32k RAM (using weird tile layout) and then you copy into VRAM using a single DMA memcpy during vblank? I wrote a genesis game decades ago (Shaq Fu), my memory is fading away :)

Yes, so 2x16 kb ram buffers , write to one in Ram as per tile layout whilst sending the other to vram via dma ( takes 4 frames to send a buffer currently - ill get it to 3 soon ) . 2x16 kb buffers in vram also . Using double buffering to stop screen tearing .

I just now finally after all these years of looking at the BDT figured out how to draw 3-D shapes using the DMA. Obviously, it’s an undocumented trick, but would greatly speed up 3-D graphics on the SEGA Genesis. We could even draw textures.

Would you like me to rewrite that into Assembly using reciprocal lookups?
