3D STL Viewer

3D STL Viewer

by Hacker-Cat2

👁 867 ❤️ 124 ⭐ 105 🔄 2
Created: Nov 15, 2022 Last modified: Jun 28, 2024 Shared: Jan 5, 2023

Description

My first tri-filled 3D object renderer, and 100% of the code is by me! TurboWarp: https://turbowarp.org/762252744?fps=250 The (small-ish) bug: Z-sorting of the triangles occasionally has problems with thin parts of models, but I've fixed most of the issue with back-face culling (though it's still slightly noticeable on model 2). Features: - Loads STL files - Has some basic shading - (Decent) z-sorting algorithm - Auto detects similar points in models and merges them so only 1 has to be calculated - Auto centers/scales the model to fit within the Scratch canvas Tags: #3D #tri #triangle #dimension #object #stl

Instructions

- Mouse to rotate objects - Right/Left arrow keys or "Model" variable to change the object If you want to import your own object: READ TO AT LEAST STEP 6 BEFORE IMPORTING!!! 1. Open the model you wish to view with a text editor (make sure not to change anything, and immediately exit the editor without saving if you do) 2. Make sure it's an ASCII *.stl file (if the file name ends with *.stl and the contents is human-readable, it should be correct). If it's not ASCII (or an STL), you should be able to open the file and convert it here: https://www.meshconvert.com (make sure to select ASCII stl) 3. Press [space] in this project 4. Copy and paste the contents of the file into the text bar and press [enter] 5. The object should then be displayed (keep reading...) 6. Make sure the model doesn't have too many triangles (I'd recommend a maximum of around 500 triangles on Scratch) 7. To reduce triangles, try to avoid any type of curve and adjust any settings that lower the poly count 8. All models made in Tinkercad have very low triangle counts, so you shouldn't have to worry as much if you use that, though you will need to convert the output to ASCII 9. If you have a model designed in a different 3D design software and are unable to reduce the triangles enough, you may be able to upload the model to Tinkercad and re-download it with fewer triangles If you are reading all of this and don't know what an STL file is: Thanks, but why... STL stands for stereolithography which has probably only confused you further... If you really want to know about this stuff, read here: https://wikipedia.org/wiki/STL_(file_format)

Project Details

Visibility
Visible
Comments
Enabled