Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A simple application to visualize 3D .obj files.

License

NotificationsYou must be signed in to change notification settings

keelus/3d-viewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MIT Licensestars

ℹ️ Description

A simple application to preview 3D models (currently .OBJ supported), where you can move the model around, flip normals, etc. It's implemented in Golang, and usesSDL2 to show the window, handle user's input, and write pixels into the screen buffer.

I made it from scratch to learn 3D rendering concepts, mathematics and algorithms involved to display a 3D textured mesh into the screen.

✨ Features

  • Fast 3D .obj file loading.
  • Fast and smooth rendering.
  • Simple camera system to move and rotate the object around.
  • Buttons to change the resolution (to gain performance for more complex objects)
  • Support for .obj 3D files and .mtl material files (with PNG and JPEG texture formats).

🐛 Known errors

  • In very specific cases where the Z position of the camera is exactly 0, and rotation is default, some triangles might not be displayed correctly. This can be corrected by just moving or rotating the camera by a few pixels.
  • May occasionally fail to update the text information of the new loaded mesh due to some strange SDL2_ttf error while rendering the text.

📸 Screenshots


🔨 Requirements

To use and/or compile the application, you will need to haveSDL2 andSDL2_TTF installed correctly in your system.

⬇️ Install & run it

The project is compatible with Windows, Linux and macOS, when requeriments are installed.

To use it, simply download thelatest release binary file and execute it (unzip and execute on Windows).

🐧 Linux & macOS

To make the downloaded binary executable, run:

chmod +x 3d_viewer-<rest of the file>

In newer versions of macOS, you might need to runxattr -c 3d_viewer-<rest of the filename> if you get an error message while opening the app.

Then, you can open it running:

./3d_viewer-<rest of the file>

Compile

To compile the project, you will need SDL2 and SDL2_TTF properly installed in your system. Also, a C compiler could be needed (such asGCC).If you encounter any issues while compiling, please checkgo-sdl2 compiling guide.

🪟 Windows

To compile the app, just run:

go mod tidy
go build -o 3d_viewer.exe -ldflags"-s -w -H windowsgui"

Make sure to haveSDL2.dll andSDL2_ttf.dll files in the same place of the.exe.

🐧 Linux or macOS

To compile the app, just run:

go mod tidy
go build -o 3d_viewer -ldflags"-s -w"

⚠️ Disclaimer

The 3D models that are shown in the screenshots are for demonstration purposes only, I don't own the models.

⚖️ License

This project is open source under the terms of theMIT License


Made bykeelus ✌️

](https://github.com/libsdl-org/SDL_ttf/releases/latest)https://github.com/libsdl-org/SDL_ttf/releases/latest


[8]ページ先頭

©2009-2025 Movatter.jp