+DrTypo Posted May 24, 2020 Share Posted May 24, 2020 (edited) After Tube2020, I decided to make a more complete 3d engine. It is still a very simple engine and lacks many features. It displays only flat shaded triangles and does rotations only around Y axis. So what to say about it? It's not very fast despite the fact that it uses the GPU and blitter. On my PAL machine, it runs in 3 frames (16.6 fps) while computing about 254 triangles. Possible optimisations are: improve depth sorting: if I remove depth sorting, it runs in 2 frames (25 fps). To do depth sorting I uses comb sort, which is an optimized bubble sort. Shell sort would probably be better. Another optimisation would be to do depth sorting only on the objects and use convex objects. backface culling: I didn't implement backface culling (because lazyness). This would likely speed things up quite bit. use the DSP for transformation and clipping, the GPU for rasterisation. reduces the amount of transformations: there are duplicate vertices that are transformed multiple times. This could be improved. Doing this would take time and also run into the 4K limit of the GPU (except using DSP, this would help a lot with the 4K limit but good-bye U235 sound engine). The routine could easily be split into 2 chunks for the GPU (transformation/clipping and rasterisation). Anyway, doing fast 3D on the Jag is not easy (who knew?). Now I understand Checkered Flag (which probably uses a faster engine than this one). But I don't understand No Second Prize on the Atari ST. Edit: I implemented backface culling and things are indeed quite a bit faster. It now runs in 2 frames (25fps). The effects of backface culling are two-fold: there are fewer triangles the rasterize will attempt to draw and fewer triangles to depth sort. By the way I'll explain the meaning of the numbers on screen: the first is the size of the routine in bytes. I can check that I stay within the 4096 bytes limitation of the GPU. the second one is the number of triangles rendered. the third one is a bit hard to grasp: it's the number of ticks (1/50th ou 1/60th of a second depending on your region) used to render 50 frames. So if the number is 50, one frame takes one tick. You are at full framerate (50fps or 60fps). If the number is 100, one frame takes two ticks you're at half framerate (25fps or 30fps). engine.zip Edited May 25, 2020 by DrTypo edit: backface culling implemented 18 Quote Link to comment Share on other sites More sharing options...
+Saturn Posted May 24, 2020 Share Posted May 24, 2020 Nice! Cant wait to check this out. Quote Link to comment Share on other sites More sharing options...
BeefMan Posted May 24, 2020 Share Posted May 24, 2020 More 3D plz! I’ll check this out later. Quote Link to comment Share on other sites More sharing options...
oakcitycomics Posted May 24, 2020 Share Posted May 24, 2020 Fired it up on my Jag GD. On my NTSC Jag movement is pretty fluid. Looking good Quote Link to comment Share on other sites More sharing options...
dilinger Posted May 24, 2020 Share Posted May 24, 2020 Works well on the Virtual Jaguar emulator too. Quote Link to comment Share on other sites More sharing options...
agradeneu Posted May 24, 2020 Share Posted May 24, 2020 2 hours ago, DrTypo said: After Tube2020, I decided to make a more complete 3d engine. It is still a very simple engine and lacks many features. It displays only flat shaded triangles and does rotations only around Y axis. So what to say about it? It's not very fast despite the fact that it uses the GPU and blitter. On my PAL machine, it runs in 3 frames (16.6 fps) while computing about 254 triangles. Possible optimisations are: improve depth sorting: if I remove depth sorting, it runs in 2 frames (25 fps). To do depth sorting I uses comb sort, which is an optimized bubble sort. Shell sort would probably be better. Another optimisation would be to do depth sorting only on the objects and use convex objects. backface culling: I didn't implement backface culling (because lazyness). This would likely speed things up quite bit. use the DSP for transformation and clipping, the GPU for rasterisation. reduces the amount of transformations: there are duplicate vertices that are transformed multiple times. This could be improved. Doing this would take time and also run into the 4K limit of the GPU (except using DSP, this would help a lot with the 4K limit but good-bye U235 sound engine). The routine could easily be split into 2 chunks for the GPU (transformation/clipping and rasterisation). Anyway, doing fast 3D on the Jag is not easy (who knew?). Now I understand Checkered Flag (which probably uses a faster engine than this one). But I don't understand No Second Prize on the Atari ST. engine.zip 30.75 kB · 14 downloads Great stuff! Can I ask a question? How do you make and import your 3D meshes? Quote Link to comment Share on other sites More sharing options...
Cyprian Posted May 24, 2020 Share Posted May 24, 2020 looks nice @DrTypo Quote Link to comment Share on other sites More sharing options...
+DrTypo Posted May 25, 2020 Author Share Posted May 25, 2020 4 hours ago, agradeneu said: Great stuff! Can I ask a question? How do you make and import your 3D meshes? I make the 3D meshes in Blender and export them as .obj files. Then I convert them in raw structures for my engine using a tool I made. 1 Quote Link to comment Share on other sites More sharing options...
+DrTypo Posted May 25, 2020 Author Share Posted May 25, 2020 I implemented backface culling. More info in the original post. 2 Quote Link to comment Share on other sites More sharing options...
Songbird Posted May 25, 2020 Share Posted May 25, 2020 Impressive! Can we expect a port of Superhot to the Jaguar soon? 1 Quote Link to comment Share on other sites More sharing options...
+Saturn Posted May 25, 2020 Share Posted May 25, 2020 This looks pretty awesome Quote Link to comment Share on other sites More sharing options...
Clint Thompson Posted May 25, 2020 Share Posted May 25, 2020 (edited) Cool! Pretty zippy, too! *It would be cool for an auto spin around routine to kind of automate and show off the 3D at full speed without any user interaction, say pressing 5 and it could loop to 4 points, pausing at each one briefly or spinning around complete then ping ponging to another coordinate point at random though I suppose that may be silly and useless. Also, I take it the U235 isn't implemented at all on this one but am curious as to impact it would make if added. **and maybe other goofy stuff like background color cycling Edited May 25, 2020 by Clint Thompson 2 Quote Link to comment Share on other sites More sharing options...
+CyranoJ Posted May 25, 2020 Share Posted May 25, 2020 But can it do a completely straight road with weird random clipping errors? 2 6 Quote Link to comment Share on other sites More sharing options...
Gummy Bear Posted May 25, 2020 Share Posted May 25, 2020 1 hour ago, CyranoJ said: But can it do a completely straight road with weird random clipping errors? Only the best of the best ultra-wang coders could even dream of such greatness! 4 1 Quote Link to comment Share on other sites More sharing options...
+DrTypo Posted May 25, 2020 Author Share Posted May 25, 2020 5 hours ago, CyranoJ said: But can it do a completely straight road with weird random clipping errors? I'm not elite enough to attempt such a task. But it does overflow when things are a bit far. @Clint Thompson I don't think I'll implement an auto-spin feature. However I'll try to have U235 SE play some music. I expect the impact to be minimal. From my experience, U235 SE has hardly any effect on the rest of the system. 7 Quote Link to comment Share on other sites More sharing options...
+Stephen Posted May 25, 2020 Share Posted May 25, 2020 10 hours ago, CyranoJ said: But can it do a completely straight road with weird random clipping errors? He hasn't worked out the 200 pages of spreadsheets showing cycle counts nor re-worked the engine continuously for 2.5 years. Give it time, and it just may be possible! 2 2 Quote Link to comment Share on other sites More sharing options...
Cyprian Posted November 2, 2020 Share Posted November 2, 2020 @DrTypo any news about your project? Quote Link to comment Share on other sites More sharing options...
+DrTypo Posted April 18, 2021 Author Share Posted April 18, 2021 Well @Cyprian there is news! So I went back to this project and separated the geometric transformations and rasterization parts. Now the DSP is doing the transformations and GPU+Blitter rasterization. The rendering now is between 25fps and 50fps. I also added a basic sound routine (3 voices with panning and resampling) to see if it interfered with the transformation calculations. And yes it id, I got weird random clipping errors! In the clipping function, I had code like this: load (r15+CVertexXti),rX load (r15+CVertexYti),rY load (r15+CVertexZti),rZ or rZ,rZ store rX,(r14+CVertexXti) store rY,(r14+CVertexYti) store rZ,(r14+CVertexZti) I had to change it to: load (r15+CVertexXti),rX or rX,rX load (r15+CVertexYti),rY or rY,rY load (r15+CVertexZti),rZ or rZ,rZ store rX,(r14+CVertexXti) store rY,(r14+CVertexYti) store rZ,(r14+CVertexZti) I don't know really why. In other parts of the code I also run several load instructions in succession without issues... Controls: move around with the D-pad, strafe with A and C, play sounds with numpad 1,2 or 3. For the moment I'm not planning on doing any game with it. By the way, better try it on real hardware. In VJ the animation is choppy. I guess it's because of synchronization between TOM emulation thread and JERRY emulation thread. On older monothread VJ it should run fine. 3djag.zip 4 Quote Link to comment Share on other sites More sharing options...
Zerosquare Posted April 18, 2021 Share Posted April 18, 2021 45 minutes ago, DrTypo said: In the clipping function, I had code like this: load (r15+CVertexXti),rX load (r15+CVertexYti),rY load (r15+CVertexZti),rZ or rZ,rZ store rX,(r14+CVertexXti) store rY,(r14+CVertexYti) store rZ,(r14+CVertexZti) I had to change it to: load (r15+CVertexXti),rX or rX,rX load (r15+CVertexYti),rY or rY,rY load (r15+CVertexZti),rZ or rZ,rZ store rX,(r14+CVertexXti) store rY,(r14+CVertexYti) store rZ,(r14+CVertexZti) I don't know really why. If r15 is pointing to main RAM, this is a known bug: 1 Quote Link to comment Share on other sites More sharing options...
+DrTypo Posted April 18, 2021 Author Share Posted April 18, 2021 Indeed @Zerosquare, r15 is pointing to the main RAM. But I thought the last OR (or rZ,rZ) after the last LOAD was enough to protect the first STORE. Apparently this is not the case. What's really strange is that the issue appears only when the interrupt is enabled. Otherwise it works fine. Quote Link to comment Share on other sites More sharing options...
drludos Posted April 18, 2021 Share Posted April 18, 2021 Woaw, this is very impressive, congrats and thanks for sharing! I really hope you make a full game out of this, the engine is promising, and for a shoot'em up the "flat shaded" look works perfectly IHMO :) 2 Quote Link to comment Share on other sites More sharing options...
SlidellMan Posted April 18, 2021 Share Posted April 18, 2021 Maybe you could make something in the vein of Axelay? Quote Link to comment Share on other sites More sharing options...
+DrTypo Posted April 19, 2021 Author Share Posted April 19, 2021 10 hours ago, SlidellMan said: Maybe you could make something in the vein of Axelay? I guess you meant StarFox? Axelay is a (gorgeous) 2D scroller. For the moment I don't have any specific idea. The game should be fun and simple to do, which is not very compatible with 3D. 3 Quote Link to comment Share on other sites More sharing options...
phoboz Posted April 19, 2021 Share Posted April 19, 2021 (edited) On 4/18/2021 at 5:02 AM, DrTypo said: For the moment I'm not planning on doing any game with it. Wow, this looks like a perfect engine to be used for a Battlezone inspired game. (using flat shaded, solid polygons instead of the wireframe graphics of the original) Great work! Edited April 19, 2021 by phoboz 2 Quote Link to comment Share on other sites More sharing options...
agradeneu Posted April 19, 2021 Share Posted April 19, 2021 3 hours ago, phoboz said: Wow, this looks like a perfect engine to be used for a Battlezone inspired game. (using flat shaded, solid polygons instead of the wireframe graphics of the original) Great work! We already have similar games like I War and Hoverstrike... But how about a 3D puzzle game like Cubixx? Looks doable on that engine. Looks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.