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 itInstructionsControls 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.

74 Comment(s)kevinfoley2 months agoI've added a simple first-person shooter demo where you can move around and shoot missiles at targets (it re-uses the models from the Starblitz demo). Real life has me pretty busy, but if I have time I'll eventually expand the demo into something a little fancier.SimeonScholarReceived for knowing a great deal about programming topicsAchievementsAmazing PageHiddenAchievementsDrawingI like to draw!HobbiesEdited 4 months agoSometimes triangles disappear when they are near-orthogonal to the camera.
Your code currently draws the backfaces of models which means that when you have perspective and you sort, the back faces will sometimes be closer than the front when near-orthogonal to the camera. Adding this line of code will only draw one side of triangles, meaning the back faces will be skipped. It should also greatly boost your performance.
Inside of the site's most up-to-date POLY3D.LIB file, consider adding the following to line 124 (maybe line 165 too).
IF
((POINTS[E2,0]
-POINTS[E1,0])
*(POINTS[E3,1]
-POINTS[E1,1])
-(POINTS[E2,1]
-POINTS[E1,1])
*(POINTS[E3,0]
-POINTS[E1,0]))
>=0 THEN CONTINUEThe only issue is that this requires you to update all of your models, since there are inconsistencies in defining clockwise/counterclockwise triangles, so the models are a bit jumbled up, but only one side of them now gets drawn.
I guess this also depends on how you want it to be, since your STARBLITZ demo (which is really awesome btw) has one-triangle-wide wings, which behaves wrong with this change. So, just consider it.kevinfoley4 months agoI've never noticed triangles to disappear completely, but I'll keep an eye out for that.
I thought about trying to incorporate normals for the purpose of backface culling and potentially lighting, but I didn't think it would be worth the tradeoffs and performance overhead. I like being able to use the two-sided triangles for flat details, like the wings that you mentioned. Another benefit is that you can make a line by connecting two of the three corners of a triangle to the same vertex, thus not requiring any extra code or edge cases to support lines.
I've noticed that SIM.3D also has issues with occasionally drawing triangles out of order, causing similar flickering near corners.
Thanks, I'm glad you enjoyed the STARBLITZ demo. I may expand it more after I add a few additional demos.
Were you able to adapt the model editor for SIM.3D?
DFrostExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming StrengthEdited 4 months agoonce this is like SANIC, you make is even faster by using sprites instead of GTRI, since you would be using sprites, it would be twice as fast when rendering a triangles. This also brings in textures to the mix. We might actually get an engine capable of running games like Crash Bandicoot(1996) at 30FPS Also I have noticed an exceptional difference of rendering speed when you constrain it all to the screen(s). Here is what I used(roughly):
VAR M%,IT%
'draw IT% times because it is less noticable on small scale applications
FOR I = 1 TO IT%
GFILL 0,0,511,511
NEXT
?MILLISEC - M%
GCLIP 0,0,399,239
M% = MILLISEC
FOR I = 1 TO IT%
GFILL 0,0,511,511
NEXT
?MILLISEC-M%
if this doesn't produce usable results, just increase IT%
this also takes care of off - screen culling, too. The culling only actually helps if a part of a triangle is on - screen. If not even a single pixel of a triangle is onscreen, the culling becomes ineffective. GCLIP actually is really useful in this scenario, but even SPCLIP and BGCLIP help, accordingly to what is being rendered.kevinfoley4 months agoI do not think rendering with sprites is practical.
I already have a fast screen culling method in Poly3D. My culling method skips not only the drawing, but also many of the 3D calculations. Maybe I'm just not following you, but I don't see how your example code would help.kevinfoley4 months agoAs far as I can tell, the Givers P3D game only uses triangle sprites for rendering the intro animation, and the result is an ugly mess of misaligned sprites. The rest of the gameplay seems to use flat-colored faces probably drawn with graphics commands.
If you think you can make a 3D engine with sprites, go ahead, but I personally have no interest in trying to rewrite my engine to use sprites.DFrostExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming StrengthEdited 4 months agolet's say we have a triangle that is partially off - screen. It would draw the rest of the triangle(offscreen) anyway. All I'm doing with this code is showing how GCLIP can improve performance by making it check "is this pixel I'm about to draw past the boundaries? Yes, so I can skip this one"
this code proves sprites are faster to draw:
VAR M%,I%
M% = MILLISEC
WHILE MILLISEC-M%<1001:GFILL I,0,15,15:INC I%:WEND
?"a moving box can be drawed",I%,"times a second"
I% = 0'reset it from our last test
SPSET 0,0'16x16 size
'since we are only [i]moving[/i] the sprite anddrawing it, don't include initialization of it.
M% = MILLISEC
WHILE MILLISEC - M%<1001: SPOFS 0,I%,0:INC I%:WEND
?"a moving sprite can be drawed",I%,"times a second"
DFrostExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming Strength4 months agoalso P3D has unaligned sprites because of the trashy way SB scales sprites.SimeonScholarReceived for knowing a great deal about programming topicsAchievementsAmazing PageHiddenAchievementsDrawingI like to draw!Hobbies4 months agoIt's a bit difficult to control. but I can see this being really handy for 3D model making! The code is pretty straightforward, and well documented. Can you possibly add an export-to-text option, or a better way to access .3D/.3DM files? If I could have access to every triangle point, then this would be really convenient for me, and other developers here too!
Thanks for making this!kevinfoley4 months agoThanks! The code for exporting and importing models is at the bottom of P3DMODELEDITOR. That should give you all the information you need to access the data, and is much faster to work with than text. The save format is really very straightforward, and it should be easy to write a parser (or copy and modify my own parsing code). Is there a reason you wanted text rather than an array of numbers?
I am working on an update that fixes some issues with coordinates being double-or-triple-reversed, and will probably release that in the next few days.12Me21Head AdminThird YearMy account is over 3 years oldWebsiteSyntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express Yourself4 months ago.obj is extremely simple and widely used, so it might be worth adding a way to import/export files in this format.kevinfoley4 months agoHmm, good suggestion. I think I could do an OBJ import/exporter without too much trouble.kevinfoley4 months ago@12Me21 Well, I wrote some simple code that could hopefully parse an OBJ file, but how would I get an OBJ file from my PC into SmileBASIC?12Me21Head AdminThird YearMy account is over 3 years oldWebsiteSyntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express Yourself4 months agohttp://smilebasicsource.com/page?pid=812random_godIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthZelda Is Awesome!I love The Legend Of Zelda!Express YourselfVideo GamesI like to play video games!Hobbies4 months agolol yeahkevinfoley4 months agoI've released an update with general improvements and fixes to how axes/coordinates are handled, and a new demo game. The update also has the OBJ parsing code that I haven't tested. I'll need to copy a model file onto my 3DS using the modem app in order to try that.kevinfoley4 months agoSeveral years after the last release, I finally got the urge to start working on this project again. I have completely overhauled the original messy code into a highly streamlined common library. I've also developed a simple 3D model editor to go with the engine. I haven't uploaded the new code yet, but will do so in the next week or two.SimeonScholarReceived for knowing a great deal about programming topicsAchievementsAmazing PageHiddenAchievementsDrawingI like to draw!Hobbies4 months agoThat's exciting! I'll be sure to be one of the first to check it out. No rush!kevinfoley4 months agoI've uploaded the new version with model editor, and updated the download key.h267RNGHiddenEaster EggsPokemon Is Awesome!I love Pokemon!Express YourselfGood PageHiddenAchievements3 years agoYou should make a custom model creator. Depending on the scale of this, this could be used to make 3D game pieces in SmileBASIC. Comboned with the raycaster, you have a full 3D game.12Me21Head AdminThird YearMy account is over 3 years oldWebsiteSyntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express Yourself3 years agoI think someone is working on one nowSuper_DefaultioVideo GamesI like to play video games!HobbiesDay PersonI like the warm sunshine and wake up early!Express YourselfZelda Is Awesome!I love The Legend Of Zelda!Express Yourself3 years agoWell it might be too slow for a 3d polygon and a raycaster all at once. SB can only do so much.ThatStupidGuyAvatar TabooI didn't change my avatar for 180 daysWebsiteAvatar EmbargoI didn't change my avatar for 90 daysWebsiteAvatar BlockI didn't change my avatar for 30 days.Website3 years agoAhem: BBW3E88V
https://twitter.com/Bug_taro/status/691996196626272257Super_DefaultioVideo GamesI like to play video games!HobbiesDay PersonI like the warm sunshine and wake up early!Express YourselfZelda Is Awesome!I love The Legend Of Zelda!Express Yourself3 years agoWhere is this program, what happened to it and how?
YOU REALLY PROVED ME WRONG.... OMG I WUV DIS
ThatStupidGuyAvatar TabooI didn't change my avatar for 180 daysWebsiteAvatar EmbargoI didn't change my avatar for 90 daysWebsiteAvatar BlockI didn't change my avatar for 30 days.Website3 years agoHa.
GuzzlerFirst WeekJoined in the very first week of SmileBASIC SourceWebsiteDrawingI like to draw!HobbiesIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming Strength3 years agoYes make it please!kevinfoley4 months agoI have developed a simple 3D model editor and will release it soon.MinxrodThird YearMy account is over 3 years oldWebsiteExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming StrengthVideo GamesI like to play video games!Hobbies3 years agoThis is so neat :D
But I have no idea how the models are made.
I don't understand how they are defined... if someone knows can they explain to me please?
kevinfoley3 years agoThey're defined in data at the bottom of the program. Each model consists of a set of vertices and a set of faces that connect the vertices. The way I bundled them together is kind of messy and hard to follow, but I'm hoping to improve it in the next version. If you don't know what "vertices" or "faces" are, you might want to do some research on 3D modelling in general.MinxrodThird YearMy account is over 3 years oldWebsiteExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming StrengthVideo GamesI like to play video games!Hobbies3 years agoOh, you define vertices and then basically sets of those vertices?
DasEtwas3 years agoWhat happens if two polys overlap?Super_DefaultioVideo GamesI like to play video games!HobbiesDay PersonI like the warm sunshine and wake up early!Express YourselfZelda Is Awesome!I love The Legend Of Zelda!Express Yourself3 years agoits just an overlaping polygon.12Me21Head AdminThird YearMy account is over 3 years oldWebsiteSyntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express Yourself3 years agopossibly z fightingkevinfoley3 years agoThere's an algorithm to determine the draw order of polygons; if two overlap, it's going to draw one of them on top of the other based on that algorithm. That can look weird but doesn't come up very often.Super_DefaultioVideo GamesI like to play video games!HobbiesDay PersonI like the warm sunshine and wake up early!Express YourselfZelda Is Awesome!I love The Legend Of Zelda!Express Yourself3 years agoWhat's the syntax for creating a polygon?PixelStudio3 years ago"*Actual gameplay features"
Hype hype hypekevinfoley3 years agoEr, okay?kldck_hulFirst MonthJoined in the very first month of SmileBASIC SourceWebsiteScholarReceived for knowing a great deal about programming topicsAchievementsZelda Is Awesome!I love The Legend Of Zelda!Express Yourself3 years ago*Actual gameplay features
What does this include?
Are we going to get any scene graphs etc?
I'm also curious if this does any back-face culling?kevinfoley3 years agoActual gameplay features would include things such as collision detection and maybe a pooling system. I'm working on a demo game that uses a refined version of the engine, but had to take a break due to the holidays. I'll be starting on it again soon.Super_DefaultioVideo GamesI like to play video games!HobbiesDay PersonI like the warm sunshine and wake up early!Express YourselfZelda Is Awesome!I love The Legend Of Zelda!Express Yourself3 years agoModel maker?PixelStudio3 years agoOn line 537 change data to DATA 50,32,24 and it looks like the ships are firing at the tie fightersPtcguyFirst WeekJoined in the very first week of SmileBASIC SourceWebsiteMinecraft Is Awesome!I love Minecraft!Express YourselfBeginner ProgrammerI'm just starting out! I'm still trying to grasp the basics.Programming Strength3 years agocoolPixelStudio3 years agoThis is amazing! Imagine one of these bad boys flying into a fps map and idk, drops supplies or something? Even if it can't be physically there it will sure add a neat effect to the game :) although I can be taking it too far...Super_DefaultioVideo GamesI like to play video games!HobbiesDay PersonI like the warm sunshine and wake up early!Express YourselfZelda Is Awesome!I love The Legend Of Zelda!Express Yourself3 years ago1 word: a person. Just a person. Do it.kevinfoley3 years agoWhat do you mean? Are you asking me to model a person, or what?Super_DefaultioVideo GamesI like to play video games!HobbiesDay PersonI like the warm sunshine and wake up early!Express YourselfZelda Is Awesome!I love The Legend Of Zelda!Express Yourself3 years agoYes, make a person.. like a polygonal model of a person. doesn't have to be good.kevinfoley3 years agoSorry, this sounds like a waste of time. A person isn't very interesting unless it's animated, and animating a person in code would be hell.Super_DefaultioVideo GamesI like to play video games!HobbiesDay PersonI like the warm sunshine and wake up early!Express YourselfZelda Is Awesome!I love The Legend Of Zelda!Express Yourself3 years agoIt doesn't seem boring to me....Y_ackHead Admin3 years agoHow many polygons is that in the first (second uploaded) image? Maybe I underestimated Smilebasic.blizordDay PersonI like the warm sunshine and wake up early!Express Yourself3 years ago Ten I think. They move quickly and in many directions too.kevinfoley3 years agoLol. Ten models, not ten faces. There are about 220 faces in this scene.kevinfoley3 years agoI'm used to saying faces, which is really 3D modelling lingo - polygons and faces are the same thing here.GuzzlerFirst WeekJoined in the very first week of SmileBASIC SourceWebsiteDrawingI like to draw!HobbiesIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming Strength3 years agoWow, this is really "shaping" up!Super_DefaultioVideo GamesI like to play video games!HobbiesDay PersonI like the warm sunshine and wake up early!Express YourselfZelda Is Awesome!I love The Legend Of Zelda!Express Yourself3 years agoKevinfoleu, 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.kevinfoley3 years agoAh, the new screenshot album feature on Miiverse is great. Added a new, better-quality screenshotPtcguyFirst WeekJoined in the very first week of SmileBASIC SourceWebsiteMinecraft Is Awesome!I love Minecraft!Express YourselfBeginner ProgrammerI'm just starting out! I'm still trying to grasp the basics.Programming Strength3 years agoWith my 3ds (non-new) I get 10-12 fps (when looking at all of the models at once).kevinfoley3 years agoDoes 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.
1
2Load: 134msPrivacyAbout