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

YES OH MY GAD! I remember when trinitro did this in ptc but with an oddly shaped rhombus. Its so cool that you can now texture polygons? in sb now. Also, will test on old 3ds non xl.

It's good to have another person working on a 3D tool. Let's see how far it goes.

Replying to:Defaultio
YES OH MY GAD! I remember when trinitro did this in ptc but with an oddly shaped rhombus. Its so cool that you can now texture polygons? in sb now. Also, will test on old 3ds non xl.
Test results: 60 fps on old non-xl 3ds confirmed. But it flickers, a lot. Just like trinitro 3d engine. Check his engine to solve the problem please.

Replying to:Defaultio
YES OH MY GAD! I remember when trinitro did this in ptc but with an oddly shaped rhombus. Its so cool that you can now texture polygons? in sb now. Also, will test on old 3ds non xl.
You can use HARDWARE to check to see what the users' 3ds is so you can then make it run specific code to make the tie fighters not flicker.

I added "wait 1" to the beginning of the loop, and I can confirm that this program runs perfectly at 30fps on the original non-xl 3DS.

Replying to:Defaultio
YES OH MY GAD! I remember when trinitro did this in ptc but with an oddly shaped rhombus. Its so cool that you can now texture polygons? in sb now. Also, will test on old 3ds non xl.
I use a buffer. In my case it's using SPPAGE, but this application would probably use a GPAGE buffer. You draw on one graphic page while displaying the other, then switch it around for the next frame and repeat. It guarantees no flicker, no matter how laggy and what system.

Replying to:Defaultio
YES OH MY GAD! I remember when trinitro did this in ptc but with an oddly shaped rhombus. Its so cool that you can now texture polygons? in sb now. Also, will test on old 3ds non xl.
I don't understand. You're saying Trinitro's 3D engine flickers, so I should check his 3D engine to solve the flickering in my engine? Either way, he has a different engine rendering different things, so we wouldn't likely have the same solution. Try turning the radar off and see if that fixes the flickering for you. It's also possible I put the VSYNC in the wrong spot; I remember with Wire3D I found that flickering varied depending on where I put the VSYNC.

Replying to:Defaultio
YES OH MY GAD! I remember when trinitro did this in ptc but with an oddly shaped rhombus. Its so cool that you can now texture polygons? in sb now. Also, will test on old 3ds non xl.
Missed your reply. Oi, why didn't I think of adding a buffer? I'll have to look into that.

Replying to:Defaultio
YES OH MY GAD! I remember when trinitro did this in ptc but with an oddly shaped rhombus. Its so cool that you can now texture polygons? in sb now. Also, will test on old 3ds non xl.
If you want to add a buffer you can do it with gpage. We use to do it with gcopy until we found out gpage was a lot faster.

Replying to:JustGreat
I added "wait 1" to the beginning of the loop, and I can confirm that this program runs perfectly at 30fps on the original non-xl 3DS.
VSYNC would've been better. WAIT 1 just introduces another frame bottleneck.

Replying to:JustGreat
I added "wait 1" to the beginning of the loop, and I can confirm that this program runs perfectly at 30fps on the original non-xl 3DS.
wait this is a troll isn't it cj add comment editing

Replying to:JustGreat
I added "wait 1" to the beginning of the loop, and I can confirm that this program runs perfectly at 30fps on the original non-xl 3DS.
No, his idea does work.

Replying to:JustGreat
I added "wait 1" to the beginning of the loop, and I can confirm that this program runs perfectly at 30fps on the original non-xl 3DS.
WAIT 1 explicitly forces a frame, while VSYNC will not wait that frame if the display refresh already happened or whatever. Different things are going on.

This is the first programming language that I've really done much with, so I'm still learning the ropes.

Replying to:JustGreat
This is the first programming language that I've really done much with, so I'm still learning the ropes.
I should have replied to my own comment... Shoot

You can fix it, I know you can! It's just buggy at the moment!

Replying to:TheRealGamerBoy07
You can fix it, I know you can! It's just buggy at the moment!
Well, I just issued an update. Which bugs are you referring to?

Does anyone know if SmileBoom might reject this because it includes Arwings and TIE Fighters? They didn't reject the old version which only included TIEs, but maybe I'm pushing my luck here.

With my 3ds (non-new) I get 10-12 fps (when looking at all of the models at once).

Kevinfoleu, I know that you're probably busy doing sb stuffs, but could you probably, maybe upload better screenshots? You can jsut press the home button in the middle of a game and go to miiverse, post a play journal with a screenshot of the game then post it. Go to your computer then go to that same post then save the image. Then upload it here. Viola, better screenshots.