LoginLogin
Might make SBS readonly: thread

Poly3D

Root / Submissions / [.]

kevinfoleyCreated:
Download:CPC3Q3CJ
Version:1.3.0Size:263 KB
Poly3D is a flat-shaded 3D engine for SmileBASIC. The engine supports flat-shaded polygonal 3D models defined with triangles (no lighting support). It is a lightweight engine optimized for performance. This engine evolved from my earlier Wire3D engine. Performance tests (New 3DS, rendering rotating models, no gameplay code): 0 - 190 triangles onscreen: 60fps 190 - 390 triangles onscreen: 30fps 390 - 630 triangles onscreen: 20fps 660 triangles onscreen: 15fps Version 1.3.0 (12 March 2024)
  • Model Editor: Added buttons for copy/pasting face colors (this was in 1.1.0 release notes but not actually implemented?)
  • Model Editor: You can now press ZL to show vertex IDs for all vertices
  • Model Editor: In Face Mode, added a white line to show face normal (only relevant for 3DO export)
  • Model Editor: Added a button for exporting models in the 3DO format used by Star Wars: Dark Forces. You would then need to transfer the model to a PC using PetitModem or similar.
  • Model Editor: The size of the current model (in numeric values) is shown in the upper-right corner. Each vertex is 3 values (x/y/z) and each face is 6 values (3 vert indices and R/G/B color channels).
  • Model Editor: Added a Help button.
  • Model Editor: Major fixes to Undo/Redo functionality.
  • Model Editor: Other minor UX improvements.
Version 1.1.0 (13 December 2018)
  • Added FIRSTPERSON example game. Move around and shoot targets as fast as possible. Demonstrates depth-sorting, 3D camera movement and rotation, and basic collision detection. 60 fps on a New 3DS
  • (No engine changes)
Version 1.1.0 (2 November 2018)
  • Added STARBLITZ example game. Fly your spaceship and avoid the obstacles. Demonstrates depth-sorting, 3D movement and rotation, and basic collision detection. 60 fps on a New 3DS
  • Engine, Model Editor: Fixed numerous issues with axes being double-or-triple reversed
  • Model Editor: Fixed vertex movement controls sometimes being reversed
  • Model Editor: Reversed the z-axis. Now the coordinate system behaves like Blender 3D, as I had originally intended
  • Model Editor: Added some parsing code for OBJ files (not tested; how would I get an OBJ file into SB in the first place?)
  • Model Editor: Added buttons for copying and pasting face colors
  • Many other minor bug fixes
Version 1.0.1 (24 October 2018)
  • Fixed error if you deleted all faces from a model
  • Fixed slider values being constantly reapplied until you tapped somewhere else on the touch screen
  • Save/Load remembers the last file name you entered, so that you don't have to keep re-typing it each time you save
  • Added an example model Pumpkin.3D
Version 1.0 (24 October 2018):
  • Rewrote Poly3D into a compact common library that can be easily used by other programs
  • Added Poly3D Model Editor v1.0 (compatible with New 3DS or Circle Pad Pro). This is a simple model editor with limited features, but should be good enough for creating simple models. - Create 3D models with colored faces - Save / Load 3D model files - Camera controls - In addition to the main camera, the model is displayed as a wireframe in three orthogonal views (Front, Left, Top) on the touch screen - Undo / Redo functionality
  • Added a GUI library which can be used to draw interactive buttons, checkboxes, and sliders on the touch screen Note: I released this latest update much earlier than I was planning, so that others can use the included model editor. This version does not contain any other example projects. I am hoping to release another update sometime in the next month or so with additional examples of the engine in use, but can't make any promises. Hopefully I won't disappear for 3 years again! :)
Version 0.8 update: *Supports rotation on all 3 axes (uses Euler rotation and suffers from gimbal lock, so I don't recommend rotating on all 3 axes at the same time) *Uses GPAGE buffer to eliminate draw flicker (thanks Trinitro!) *Fixed support for multiple models in a single scene *Added two new models, a cube and a Starwing, which definitely isn't borrowed from any old Nintendo games *Added more models and animations to the sample scene to better demonstrate the engine. The sample scene includes over 200 polys and runs at 60fps on a New 3DS Version 0.7 (initial): *Supports 3D models with per-face coloration *Supports instancing models, reducing memory usage *Models can be translated and rotated *Depth-sorting so faces are rendered in the correct order *Screen-space culling - models that lie outside the screen coordinates are not processed, reducing render time *User can walk around with D-pad or analog stick and aim with touch-screen or gyro controls *Faces darken with distance, so models gradually fade into background *Radar on lower screen shows player position in relation to models *Code is reasonably well-documented *Sample scene included Planned features for the future: *Support for lighting *Scaling support for models *Actual gameplay features Known issues: *There is some distortion to the models when rotating on X and Y axis at the same time; I'm looking into it

Instructions:

Controls for Starblitz: D-Pad moves camera, Circle Pad moves ship Controls for FirstPerson: Circle-pad to move, touch-screen to aim, L or R to shoot Instructions for using the model editor: Load P3DModelEditor into Slot 0, and press Start. The model editor launches with a default cube model. The general idea is that you position points, called "vertices", and then connect them with triangles, called "faces". For example, a cube has 8 corners, so it has 8 vertices. Each side of a cube is a square, which requires two triangles to draw, so 12 faces in total. Controls: - A: Start moving vertex; confirm vertex position (Vertex mode). Confirm selected vertex (Add Face mode) - B: Cancel moving vertex (Vertex mode) - X: Select next vertex/face - Y: Select previous vertex/face - L: (hold) Increase movement speed (while moving vertex in Vertex mode) - R: (hold) Decrease movement speed (while moving vertex in Vertex mode) Touch screen controls should be mostly self-explanatory.
  • To create new vertices, press "Add Vert" while in Vertex mode.
  • To create new faces, press "Add Face". Select the first vertex and press "A". Repeat for two more vertices. When three have been selected, a new face (triangle) is created that connects the three selected vertices.
  • The RGB sliders can be used to edit the color of the selected face in Face mode. They have no effect in other modes.
Note: this engine is unrelated to the P3D engine; the "P3D" in "P3DModelEditor" is short for "Poly3D".

Notes:

Includes: - POLY3D.LIB: Engine library - GUILIB.LIB: Touchscreen GUI library - P3DMODELEDITOR: Model editor for Poly3D - STARBLITZ: simple example game, fly your ship and avoid crashing into obstacles

Replying to:hakke
☆UwU☆ what's this? can i mwake fwortnwite thwee dee ess with this wondewful engwine OwO twanks pweaseeee oneesan UwU byeeeee!~★★★
If you really feel like that you need help.

Replying to:hakke
☆UwU☆ what's this? can i mwake fwortnwite thwee dee ess with this wondewful engwine OwO twanks pweaseeee oneesan UwU byeeeee!~★★★
UwU yeah he's rwight owO?? bwaaaah my bwoyfwiend left me uguu~~ bwaaaa Owo!? thwedee fortnwight is cuming Owo!?
Spoilerive been like half an hour in the fricking queue to play a battlefield 1 game aaa

Man this looks really cool. Maybe I can use it for the fan game I've always wanted to make! Sad things is I lost my 3DS. :-(

Replying to:thou_fatGAMER12
Man this looks really cool. Maybe I can use it for the fan game I've always wanted to make! Sad things is I lost my 3DS. :-(
Also is it possible to load textures? (Probably not)

Replying to:thou_fatGAMER12
Man this looks really cool. Maybe I can use it for the fan game I've always wanted to make! Sad things is I lost my 3DS. :-(
Textures don't exist in this.

Replying to:thou_fatGAMER12
Man this looks really cool. Maybe I can use it for the fan game I've always wanted to make! Sad things is I lost my 3DS. :-(
Textures are a PlayStation-1-level thing, and even the PlayStation didn't do them 100% right (see affine texture warping)

Replying to:thou_fatGAMER12
Man this looks really cool. Maybe I can use it for the fan game I've always wanted to make! Sad things is I lost my 3DS. :-(
Well then. I just wanted to make it more detailed. It's still really cool (for me) to be able to make models! Well, if I can find my 3DS anytime soon.

Replying to:hakke
☆UwU☆ what's this? can i mwake fwortnwite thwee dee ess with this wondewful engwine OwO twanks pweaseeee oneesan UwU byeeeee!~★★★
If you really feel like that you need help.
Your reply has one upvote.

Replying to:hakke
☆UwU☆ what's this? can i mwake fwortnwite thwee dee ess with this wondewful engwine OwO twanks pweaseeee oneesan UwU byeeeee!~★★★
Thank you, kohai. Btw the reply was meant towards your reply, not banana's comment.

Replying to:hakke
☆UwU☆ what's this? can i mwake fwortnwite thwee dee ess with this wondewful engwine OwO twanks pweaseeee oneesan UwU byeeeee!~★★★
I am aware.

Replying to:rando
I love the editor, but BUG: Basically one yellow triangle is not being rendered completely for some reason. It looks like a pink triangle is being rendered above it. (it's up to the right of another yellow triangles, the space between the 3 selected points should be yellow.) I also love the D-PAD precision. Thank you for not forcing me to use the circle pad :)
For performance purposes, I had to fudge the way triangles are depth-sorted. The renderer uses depth sorting to determine what order to draw the triangles in; closer triangles should be drawn after (and thus on top of) further triangles. IIRC, I coded the renderer to determine depth by measuring the distance from the center of the camera to the triangle. This usually works well enough, but can give undesired results if triangles are very close together or very large. In less technical terms: the engine uses a simple formula to determine which triangle is closer to the camera; this formula usually is good enough but it sometimes makes mistakes and draws triangles in the wrong order.

Replying to:rando
I love the editor, but BUG: Basically one yellow triangle is not being rendered completely for some reason. It looks like a pink triangle is being rendered above it. (it's up to the right of another yellow triangles, the space between the 3 selected points should be yellow.) I also love the D-PAD precision. Thank you for not forcing me to use the circle pad :)
Cool

5 1/2 years later, I'm back again with a new update! Version 1.3 includes a new feature for exporting models in the 3DO format used by Star Wars: Dark Forces. Why? Just because! There are also some nice UI/UX improvements. Hurry and get it before online services shut down in 6 days!