I've got the week off for some R&R, and today I'm going to start looking into a new addition to my 3D engine spreadsheet: opacity.
Here's the original, if you're curious: https://docs.google.com/spreadsheets/d/1lUBYurOWNJjBeMJLjiXMQqLVmqPUqhhKOsg-B56spOY/copy
The problem I'd like to fix is that because it uses the SPARKLINE formula, everything on the screen is ultimately one line, which means lines might cross each other in weird ways, and that all objects are effectively transparent.
That's fine for simple shapes, but limits the options for more complex drawings/toys/games.
I *think* I can do it by taking the list of coordinates, splitting them into triplets, numbering each one, then using VLOOKUP to find the first iteration of each triplet. For triplets that appear twice, the VLOOKUP should return a lower integer than the assigned number, giving me a range to pull from the original list.
Just gonna… leave this here for myself, for when I come back to this tomorrow http://www0.cs.ucl.ac.uk/research/vr/Projects/VLF/vlfpapers/tracing/Appel_A__The_Notion_of_quantitative_invisibility_and_the_machine_rendering_of_solids.pdf
Didn’t actually get anything done today — spent most of the day reading that article and others like it.
They helped confirm I’m at least thinking about the problem correctly (I need to define planes then determine whether a given point is visible behind them), but I’m still stuck on how to get a spreadsheet to do that reliably. 🤔
Part 2 will be finding all of the points that appear twice in the new list of points, then marking them based on how "close" they are to the viewer.
Part 3 will then be replacing the points between the "further" marked points, and replacing them with the points between the "closer" marked points.
The end result should be an optical illusion that makes objects look solid. 🤷♂️
Turns out that *in general*, arrays of difference sizes can't coexist nicely. *But*, using the new MAP function does let me take in multiple arrays and return strings based on a LAMBDA function, which can then be SPLIT, giving me arrays of different sizes. https://support.google.com/docs/answer/12568985
Getting close to my goal here, but it breaks when the lines overlap, for... some reason.
OK, so I've been spending a few days figuring out different ways that this *almost* works. Feels like I'm zeroing in on the right strategy, but for now I just wanted to say that the new LAMBDA functions are really great, and can be nested to achieve things similar to a QUERY function but *much* faster. Most of the rest of this project will hinge on MAP and REDUCE.
One of the things I've had to figure out is quickly finding the index of the *second* appearance of a given item in a list. In normal programming, you can loop through the list, and loop through again for each item. "Looping" isn't a thing in spreadsheets, but you can do something like this instead:
This will ultimately let me check to see if a given point is "behind" another point in the list, and retrieve the index of the point that's "in front". When I go to draw the points on the line later on, I can then reliably replace the points between the "behind" points with the points between the corresponding "in front" points, giving the illusion of opacity in the 3D space.
(I also just realized that I haven't been adding hashtags to any of this, oops. I'll add them at the end of the thread when this is all sorted out and working, so people can find the finished product and not my ramblings. 😅)
A tiny server for experimenting with fun things on the web.