site banner

Tinker Tuesday for June 24, 2025

This thread is for anyone working on personal projects to share their progress, and hold themselves somewhat accountable to a group of peers.

Post your project, your progress from last week, and what you hope to accomplish this week.

If you want to be pinged with a reminder asking about your project, let me know, and I'll harass you each week until you cancel the service

1
Jump in the discussion.

No email address required.

Homies Ride or Die update

Been consumed by that rendering bug where the lighting seemed all wrong on the tires and I began to suspect my model data was fucked up.

I was using this ancient format for loading 3d models (".obj") that I downloaded from sketchfab.com but it turns out when it says this format is the native format uploaded by the artist and the other formats are derivative, it's kind of lying. A few 3d people have told me you want to get the ones in .glb or .gltf format, even if sketchfab says these were auto-converted . (I do not know how to make sense of what sketchfab says)

Anyway I thought maybe the .glb models would have more reliable model data and they do seem to. So then I got the .glb model loading mostly working (using tinygltf) but I was getting this random error where the car would render fine for the first frame and then vanish. I spent about 4 days trying to debug the bgfx state machine until I realized I was creating vertex and index buffers in the GPU and sticking handles to them in a class, and then I created a destructor for each class that would free those handles up. Fine, except I was not realizing I was copying the class around and the old class, a transient object, was getting destroyed which was deleting the memory held by the handles.

Since the handles are like, integers into a GPU resource table and not pointers, I wasn't getting any kind of pointer derefence error. It was just accidentally working for one frame and then failing to work after that.

I had to spend a long, long time staring at this stuff and remembering C++ copy/move semantics before I was able to track this down. Lesson (re)learned: don't put things like file/resource handles in object destructors unless you're extremely careful.

Finally making progress again. I'm getting a lot more texture data and the tires look a lot more realistic now, matching what's on sketchfab. Maybe I'll get spinning tires and stuff working again by next update!