OpenGL's shaders have been particularly tricky. I don't know why, but sampling textures has consistently stumped me, and i can't figure out how to draw anything besides that tetrahedron (or how i drew the tetrahedron to begin with).
So i did a bit of research and figured i would need a modeling program to make these 3D environments with. After trying Blender and getting lost and led in circles for hours, i decided to use Sketchup instead.
Yes, i totally ripped off Minecraft's dirt texture. I needed something quick and (no pun intended) dirty to test with. I added random transparent pixels for testing/debugging. In case you wonder, the green numbers on the bottom-right is Bandicam, the best app/screen recording software i've found to date.
Turns out Sketchup is really intuitive. I can specify textures for surfaces of things, and position those textures however i want on the surface. And it exports in the OBJ file format.
After reading around on the Internets, it seems that it's pretty expensive to parse and read in the OBJ format in real time. Which makes sense, considering it is a plain text format. The OBJ format exported by Sketchup also has its limitations, like each project needing its own set of material files that cannot be shared between projects. So in addition, i decided to write an intermediary program that would convert the .obj and .mtl files produced by Sketchup into my personal .vbo and .vbm (binary object/material) file formats.
The file format specification for my personal binary object file format, along with all the data from the above cube for testing. The pony is mandatory. She keeps the peace when the file format decides to become chaotic.
The quick-and-dirty conversion program is about 650 lines long and works great. The file format is fairly straight-forward, and it should be easy to write a loader that i will put directly into lo_mipri. I am getting started on that now. Once that is finished, i will look for a way to write a fragment shader that will allow me to actually show the dirt cube ...
.png)

No comments:
Post a Comment