? Poly3D ● SmileBASIC Source

Sign In

Register
*Usernames are case-sensitive
Forgot my password

Poly3D

Submitted
Updated
Author
kevinfoley
Public Key
Y33N4E4M
Min. Compat.
All
Version
0.8.0
Size
23.4 KB
Rating
16 votes
Description Poly3D is a flat-shaded 3D engine for SmileBASIC. The engine supports polygonal 3D models defined with triangles. A sample scene is included with numerous space ships weaving and spinning around. This engine evolved from my earlier Wire3D engine. Version 0.8 update: *Supports rotation on all 3 axes *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 Try turning off the RADAR to reduce flickering on a regular 3DS (as opposed to New 3DS). Use the D-pad or analog stick to walk around, and the touch-screen to aim To enable gyro controls for aiming, set USEGYRO to TRUE on line 40. Note that this will disable the touch-screen aiming To create your own models, you'll need to define them in vertices, faces, and face colors at the bottom of the code. I may eventually make a model editor. Notes Poly3D uses trig rather than matrix operations to do its 3D calculations*. I programmed the engine from scratch without using references to see if I could create an engine by myself*. It may not be the fastest or most practical engine, but it works, dammit. *Excluding 3-axis rotation, which uses trig but is based on the 3-axis matrix operation which I looked up
Categories
Keywords
  • 3d
  • engine
  • render
  • model
55 Comment(s) Shelly Shelly How does it work? h267 h267 RNG Hidden Easter Eggs Pokemon Is Awesome! I love Pokemon! Express Yourself Good Page Hidden Achievements You 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. 12Me21 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Second Year My account is over 2 years old Website I think someone is working on one now Super_Defaultio Super_Defaultio Video Games I like to play video games! Hobbies Beginner Programmer I'm just starting out! I'm still trying to grasp the basics. Programming Strength Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Well it might be too slow for a 3d polygon and a raycaster all at once. SB can only do so much. ThatStupidGuy ThatStupidGuy Avatar Taboo I didn't change my avatar for 180 days Website Avatar Embargo I didn't change my avatar for 90 days Website Avatar Block I didn't change my avatar for 30 days. Website Ahem: BBW3E88V https://twitter.com/Bug_taro/status/691996196626272257 Super_Defaultio Super_Defaultio Video Games I like to play video games! Hobbies Beginner Programmer I'm just starting out! I'm still trying to grasp the basics. Programming Strength Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Where is this program, what happened to it and how? YOU REALLY PROVED ME WRONG.... OMG I WUV DIS ThatStupidGuy ThatStupidGuy Avatar Taboo I didn't change my avatar for 180 days Website Avatar Embargo I didn't change my avatar for 90 days Website Avatar Block I didn't change my avatar for 30 days. Website Ha. Guzzler Guzzler First Week Joined in the very first week of SmileBASIC Source Website Drawing I like to draw! Hobbies Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Yes make it please! Minxrod Minxrod Summer 2016 Contest Participant I participated in the SmileBASIC Source Summer 2016 Contest! Programming Contest Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Pokemon Is Awesome! I love Pokemon! Express Yourself This 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? kevinfoley kevinfoley They'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. Minxrod Minxrod Summer 2016 Contest Participant I participated in the SmileBASIC Source Summer 2016 Contest! Programming Contest Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Pokemon Is Awesome! I love Pokemon! Express Yourself Oh, you define vertices and then basically sets of those vertices? DasEtwas DasEtwas What happens if two polys overlap? Super_Defaultio Super_Defaultio Video Games I like to play video games! Hobbies Beginner Programmer I'm just starting out! I'm still trying to grasp the basics. Programming Strength Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself its just an overlaping polygon. 12Me21 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Second Year My account is over 2 years old Website possibly z fighting kevinfoley kevinfoley There'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_Defaultio Super_Defaultio Video Games I like to play video games! Hobbies Beginner Programmer I'm just starting out! I'm still trying to grasp the basics. Programming Strength Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself What's the syntax for creating a polygon? PixelStudio PixelStudio "*Actual gameplay features" Hype hype hype kevinfoley kevinfoley Er, okay? kldck_hul kldck_hul First Month Joined in the very first month of SmileBASIC Source Website Scholar Received for knowing a great deal about programming topics Achievements Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself *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? kevinfoley kevinfoley Actual 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_Defaultio Super_Defaultio Video Games I like to play video games! Hobbies Beginner Programmer I'm just starting out! I'm still trying to grasp the basics. Programming Strength Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Model maker? PixelStudio PixelStudio On line 537 change data to DATA 50,32,24 and it looks like the ships are firing at the tie fighters Ptcguy Ptcguy First Week Joined in the very first week of SmileBASIC Source Website Minecraft Is Awesome! I love Minecraft! Express Yourself Beginner Programmer I'm just starting out! I'm still trying to grasp the basics. Programming Strength cool PixelStudio PixelStudio This 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_Defaultio Super_Defaultio Video Games I like to play video games! Hobbies Beginner Programmer I'm just starting out! I'm still trying to grasp the basics. Programming Strength Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself 1 word: a person. Just a person. Do it. kevinfoley kevinfoley What do you mean? Are you asking me to model a person, or what? Super_Defaultio Super_Defaultio Video Games I like to play video games! Hobbies Beginner Programmer I'm just starting out! I'm still trying to grasp the basics. Programming Strength Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Yes, make a person.. like a polygonal model of a person. doesn't have to be good. kevinfoley kevinfoley Sorry, 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_Defaultio Super_Defaultio Video Games I like to play video games! Hobbies Beginner Programmer I'm just starting out! I'm still trying to grasp the basics. Programming Strength Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself It doesn't seem boring to me.... Lumage Lumage Head Admin How many polygons is that in the first (second uploaded) image? Maybe I underestimated Smilebasic. blizord blizord Ten I think. They move quickly and in many directions too. kevinfoley kevinfoley Lol. Ten models, not ten faces. There are about 220 faces in this scene. kevinfoley kevinfoley I'm used to saying faces, which is really 3D modelling lingo - polygons and faces are the same thing here. Guzzler Guzzler First Week Joined in the very first week of SmileBASIC Source Website Drawing I like to draw! Hobbies Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Wow, this is really "shaping" up! Super_Defaultio Super_Defaultio Video Games I like to play video games! Hobbies Beginner Programmer I'm just starting out! I'm still trying to grasp the basics. Programming Strength Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself 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. kevinfoley kevinfoley Ah, the new screenshot album feature on Miiverse is great. Added a new, better-quality screenshot Ptcguy Ptcguy First Week Joined in the very first week of SmileBASIC Source Website Minecraft Is Awesome! I love Minecraft! Express Yourself Beginner Programmer I'm just starting out! I'm still trying to grasp the basics. Programming Strength With my 3ds (non-new) I get 10-12 fps (when looking at all of the models at once). kevinfoley kevinfoley 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. TheRealGamerBoy07 TheRealGamerBoy07 You can fix it, I know you can! It's just buggy at the moment! kevinfoley kevinfoley Well, I just issued an update. Which bugs are you referring to? JustGreat JustGreat First Month Joined in the very first month of SmileBASIC Source Website Avatar Taboo I didn't change my avatar for 180 days Website Night Person I like the quiet night and sleep late. Express Yourself This is the first programming language that I've really done much with, so I'm still learning the ropes. JustGreat JustGreat First Month Joined in the very first month of SmileBASIC Source Website Avatar Taboo I didn't change my avatar for 180 days Website Night Person I like the quiet night and sleep late. Express Yourself I should have replied to my own comment... Shoot JustGreat JustGreat First Month Joined in the very first month of SmileBASIC Source Website Avatar Taboo I didn't change my avatar for 180 days Website Night Person I like the quiet night and sleep late. Express Yourself 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. snail_ snail_ Helper Received for being very helpful around SmileBASIC Source Achievements First Day Joined on the very first day of SmileBASIC Source Website Night Person I like the quiet night and sleep late. Express Yourself VSYNC would've been better. WAIT 1 just introduces another frame bottleneck. snail_ snail_ Helper Received for being very helpful around SmileBASIC Source Achievements First Day Joined on the very first day of SmileBASIC Source Website Night Person I like the quiet night and sleep late. Express Yourself wait this is a troll isn't it cj add comment editing Chemicalex Chemicalex Drawing I like to draw! Hobbies RNG Hidden Easter Eggs Video Games I like to play video games! Hobbies No, his idea does work. snail_ snail_ Helper Received for being very helpful around SmileBASIC Source Achievements First Day Joined on the very first day of SmileBASIC Source Website Night Person I like the quiet night and sleep late. Express Yourself 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. SamKitsune SamKitsune It's good to have another person working on a 3D tool. Let's see how far it goes. 1 2