You can help CodeWalrus stay online by donating here. | New CodeWalrus | Old (dark mode) | Old (light) | Discord server

X3D - A 3D engine for TI68k & Nspire Calculators

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

0
b/[Inactive] X3D (TI-89/92+/v200/Nspire/PC) publicado por u/catastropher June 27, 2015, 02:37:43 AM
Earlier this year I posted on Omnimaga about X3D, my 3D engine for the 68k calcs. After a month hiatus for health reasons, I resumed work on it in May :D Some of you may recall the dazzling light bridge from earlier this year:



Currently, I am in the process of rewriting the engine to support more complex geometry. It's been a long and slow process (I'm currently interning full time as a software engineer), but I've started to make some progress. The last version had levels which were constructed of interconnected cubes. The player could walk around inside the resulting structure, which proved to be very efficient. However, my whole goal of starting X3D was to get Descent to run on the 68k calcs, and many rooms in Descent are constructed of 20 or more cubes, which is just too much to handle. So, this new version will allow levels to be constructed of prisms instead of just cubes. What do I mean by prisms? Here's an example of an octagonal prism:



The idea is you have two bases, each with the same number of points. However, the bases can be stretched, skewed, and rotated, so long as the resultant 3D shape is convex. My ultimate goal for Descent 68k is to merge the cubes in complex rooms into large convex prisms. This is several times more efficient to render than the same room partitioned into cubes.

So far, I have created a new clipping algorithm that clips prisms against a 2D polygon. A fast algorithm for this is crucial for a portal renderer like X3D. So far so good!



Anyway, this time around, it's going to have a lot of cool features. I'm hoping to get some people involved on the project or at least make some games with it once complete (it will be a TIGCC/GCC4TI C library). Let me know if you're interested!
Last Edit: February 11, 2016, 08:38:16 PM by DJ Omnimaga
Inicia sesión o crea una cuenta para dejar un comentario
u/CKH4 June 27, 2015, 02:41:43 AM
Holy cow thats impressive. This looks great. Maybe we'll get some cool 3d stuff.
u/catastropher June 27, 2015, 02:53:16 AM
Hey thanks! I may even write a scaled down version in Z80 assembly if I can get it fast enough. Unlike most 3D renderers for the calculators, X3D only ever draws lines for the level geometry. Thus, everything is solid without filling any polygons. This makes it really really fast :D I may also write a tutorial on how to do this type of rendering as it's a bit involved and I'd really like to teach other people all the techniques I've found or discovered myself.
u/CKH4 June 27, 2015, 03:40:25 AM
So are the things solid? I'm confused by the third screenshot.
u/catastropher June 27, 2015, 03:44:50 AM
Yup things are solid, it's just easier to work in wireframe as I'm developing the clipping algorithm :D
u/CKH4 June 27, 2015, 03:50:33 AM
So instead of polygon filling you just don't draw the lines that are covered up?
u/catastropher June 27, 2015, 05:00:40 AM
Exactly! To achieve this, I use a modified version of portal rendering. Pretty much, you have a 3D polygon that is your portal (such as a doorway). Through this portal you clip any lines against the portal. So longs as your rooms are convex, you can draw them in any order and it makes things solid! Suppose we have this level (the camera is blue and the portal is colored orange, also please forgive my mspaint skills and crappy 3D drawing skills :P):

[spoiler=Basic Portal Rendering]

Suppose you were rendering this scene in wireframe from the perspective of the camera. What do you think you'd see? Something like this (the portal is still orange and the red lines are those outside of the portal):



Now, just clip out the lines outside your portal polygon and viola, you have a solid rendering of both rooms!



Obviously, the process is much more complex (especially when multiple rooms are visible, geometry is behind the camera, etc) but that's the general idea. The most expensive part of rendering is the clipping. But, with it in place we don't have to do any Z-sorting or polygon filling! :D[/spoiler]
u/CKH4 June 27, 2015, 05:05:09 AM
But with this method you would theoretically have to split up some lines right? In your diagram you have that but what do you do to accomplish it?
u/Dream of Omnimaga June 27, 2015, 05:29:24 AM
That really looks impressive Catastropher. Thanks for sharing this project. I am curious about what kind of game could be done using this engine. :)

Also sorry about your health issues. I hope it's nothing too bad.
u/catastropher June 27, 2015, 05:59:28 AM
Quote from: CKH4 on June 27, 2015, 05:05:09 AM
But with this method you would theoretically have to split up some lines right? In your diagram you have that but what do you do to accomplish it?

Indeed you do. There are a few different algorithms to accomplish this. The canonical polygon clipping algorithm is Sutherland-Hodgman (https://en.wikipedia.org/wiki/Sutherland%E2%80%93Hodgman_algorithm). For a prism, you'd have to clip each polygon separately (a prism has n + 2 polygon, so for an octagonal prism you'd have to clip 10 polygons) and then draw the visible edges after clipping. Worse, it has a time complexity of O(n^2), and you're running it for each polygon. I'm working on a better algorithm for prism clipping, but I'm still working out all the details. I'll make a post when it's done :)

Quote from: DJ Omnimaga on June 27, 2015, 05:29:24 AM
That really looks impressive Catastropher. Thanks for sharing this project. I am curious about what kind of game could be done using this engine. :)

Thanks! I hope people will get interested in it and make some cool stuff! But I'm still developing the core, so it may be a bit before it's ready.

Quote from: DJ Omnimaga on June 27, 2015, 05:29:24 AM
Also sorry about your health issues. I hope it's nothing too bad.
Thanks for the concern, that's really nice of you :) It's nothing too bad, just some rheumatoid arthritis that flares up every once in a while (yup, I have it at 20 :()
u/Lionel Debroux June 27, 2015, 06:34:15 AM
Looks good, as before. Keep going :)
u/Snektron June 27, 2015, 09:49:44 AM
Whoa, awesome! So how good does this compete against glib for example?
Also i thought Portal used FrameBuffers and all that advanced stuff for portals :P
u/TheMachine02 June 27, 2015, 10:25:19 AM
Quote from: Cumred_Snektron on June 27, 2015, 09:49:44 AM
Whoa, awesome! So how good does this compete against glib for example?

You should note that the screen is a 68K screen  :P  It hasn't been writed for z80 yet.

Also, I did try that few year ago on z80, it worked, (1 portal bring down the whole scene to about 9 fps) but the main issue that I encounter is that the cliping is a very expensive method to use on z80 (that is, no div or mul command), and should be evited. But it is still definitly doable.
u/Duke "Tape" Eiyeron June 27, 2015, 10:49:32 PM
I'm amazed at the speed and the quality of the screenshot you gave us. 3D untextured solid? Collisions? Cinematics? Mazette!
u/Snektron June 28, 2015, 09:23:27 AM
Next thing you know someone made Assassins Creed Unity for calculators :P
Start a Discussion

b/[Inactive] X3D (TI-89/92+/v200/Nspire/PC)

A 3D portal rendering game engine for Nspire, 68k, and PC by Catastropher.

3
Topics
Explore Board
Website statistics


MyCalcs | Ticalc.org | Cemetech | Omnimaga | TI-Basic Developer | MaxCoderz | TI-Story | Casiocalc.org | Casiopeia | The Museum of HP Calculators | HPCalc.org | CnCalc.org | Music 2000 Community | TI Education | Casio Education | HP Calcs | NumWorks | SwissMicros | Sharp Calculators
Powered by EzPortal