talk about going on a tangent.
right off the bat, i’m burning midnight oil like crazy. sleeplessness as in abusing caffeine for days on end, forcing myself to stay awake until this or that gets done. does bad things to the brain.
and so im sitting at my desk at four am, just about finishing up the importer for an image format ive been working on. its nothing groundbreaking: lossy compression, rgb 4bits per channel. run some tests to see if the images show up correctly and they do, but the shading on the model im testing is waay off… no hard edges, and i really really need some hard edges. dangit all.
thus begins my journey into a whole fifteen hours of nonstop tinkering that could’ve been avoided had i done some, well, thinking. i know the problem comes down to normals, the problem is im trying to imitate elden graphics: lighting is calculated per vertex the gouraud way, and i refuse to fetch any textures on the vertex shader because hardware support for that kind of mambo is a tad nightmarish to figure out. but then i try some edge splitting to get the look i want and that just generates additional data on top of the vertices i am already (virtually) duplicating at the seams to keep the multiple uvs per vertex.
what do i do? i go with it anyway, telling myself its no big deal. but that’s when i remember the fact that i yanked out skeletal animation like a month ago and have been animating basically everything by swapping one mesh for another – so every vertex gets saved once per action, per frame. i desperately went and rewrote the entire 3d model exporter, changed the file structure from head to toe, came up with some funky bit manipulation to squish in more data into less bytes, carried the changes over to the model importer. files down to about half the original size. okay.
but before patting myself on the back i do the math and half size is not nearly enough. high poly in this scenario is anything higher than two thousand, and im going over the line by about 1.9k for this character just because of edge splitting. okay. guess im screwed. havent slept in two days, the sun is setting again and im all out of brain juice. wait a minute… i was working on an image importer hours ago, i can write vectors to a file. i can READ vectors from a file… an image is a file… oooh right, i can use color data to set my normals. all i have to do is a slight adjustment to the per-vertex lighting on the fragment based on a texture. in/out on the shader, some space conversion, dump vectors to a file and i already have code to handle that.
and so, yay, crazy idea but it works. i stare at the picture my motor pushes to the screen and realize, this is just like a normal map. matter of fact, this is quite literally a normal map. oh my god. i could’ve just baked this. i could’ve done it in a much simpler way half a day ago and get it done much quicker! holy molly, this is bullsheezels!!
moral of the story is… not sure. im too absent minded for this line of work? dont be a tryhard? never forget to do the math before a major rewrite? definitively sounds like the last one to me… bonus point though is i did get file size down by a bunch, that’s something.
i dont have a good way to end this so, nighty night.