Optimized the transparent cleanup path in the renderer
After rendering the model in the transparent path, we have to resolve the transparent pixels, which basically just pastes in the pixels behind it and sometimes tints it based on how dark and what color the transparent material is (tinted glass will make the things behind it darker, normal glass will be mostly completely untinted). Before, the resolve function looped over every single pixel in the frame, even non-transparent and background ones. This is obviously wasteful. So I made it find the smallest box, in which all the transparent pixels of the whole frame fit and just looped over that. It recovered the overhead of the transparent resolve on models with smaller transparent parts, but it also made fully transparent or mostly transparent models slightly slower (it still basically loops over almost the whole screen on these types of models, so keeping track of the smallest bounding box while also still doing the same work as before made it a little slower). But the performance benefits for the average model outweighed the losses on rare fully transparent models. In the image, you can see the benchmark results versus the baseline.
Comments 4
project is insane, no idea how this isn’t being pushed by the algo
@sol4r_on_hackclub thank you so much! I’m honestly just so glad to hear someone found my project interesting enough to comment.
cool project, but please don’t use ai to write your devlogs! we’d prefer for you to write imperfect but human devlogs than ai polished ones!
@zach Thanks! And also sorry for using AI here, I just couldn’t really describe the resolve step in a way that most people would understand. I rewrote the devlog in my own words, and I’ll never do it again. Btw, I love your work!
Sign in to join the conversation.