1.5.2 - World file "Shellie" + some fixes
First up-- this release has bug fixes in code as well as a new world file, "Shellie". Your old saves and old world files from 1.5.1 will stil work.
View frustum culling-- or is it view fustrum culling?-- and for that matter, how is it pronounced?-- well, whatever it is, it's the idea that you can simply not draw things that are off-screen. This seems simple and in fact unavoidable (if you could draw off-screen, then parts of the image would materialize in thin air beside your laptop, right?)
The specifics though are that in 3D the normal "culling" that happens is in screen space, at the very end of things. 3D does not work the way you might imagine, long story short but even in VR, the graphics card really is just rendering everything in 2D once a bunch of 3D math has already taken place. View frustrum culling is where you do a calculation *before* the 3D object has that 3D math performed on it that brings it into "screen space". There was a video a year or so ago of Skyrim that got people excited because it showed how the world "disappeared" (people mistook this for loading/unloading) as the camera moved around.
At any rate, the code to do this is not that simple to understand and get right, it's not an unsolved or tremendous problem it's just a bunch of algebra and-- well-- you don't really have to bother to learn/understand the algebra in detail if you get what it's doing. Just cut and paste some code.
But like-- what if the code you cut and paste just doesn't work?
Then you end up with a ton of hacks! I now present to you, hacks around my "R.visible" function that performs this culling. In each case, we are saying, "I am about to draw some object, and if you drew a sphere at point P with radius R, that sphere would enclose it completely. So... is that sphere visible? Becuase if it isn't, I ain't gonna bother with this."
Suppose your view fustum culling was a bit broken. What might happen is one of these things:
- nothing is drawn at all; it culls everything by accident
- too much (say, everything) is drawn; it does nothing, and the framerate is a bit bad
- a bit too little is drawn, and things sort of disappear around the edges of the screen
This last is a kind of "pop in", although "pop in" can be caused by a few things (for instance, something loading from disk.)
In my case, I had some "pop in" and so I just multiplied the radius ad-hoc in places until it sort of worked. The problem is that the math still was not right, so it wasn't really a case of "the radius is too small" it was really a case of "something else is wrong with the algebra, but making the radius bigger will always make more things to be drawn, so that will sort of fix it."
Long story short-- this is now fixed. I didn't fix the algebra, it's just that since releasing VtV I realized the code I cut-and-pasted from somewhere was broken, so I found *other* code to cut-and-paste, and it works reliably. So I cut-and-pasted the already-second-hand cut-and-paste code from another of my projects into VtV and voila.
I thought it might be amusing to show you some clips of the broken code though. Here we go through a 20 year old code base that I am happily (I mean that unironically) cleaning up!
First: a radius hack, and my exasperation. I'd love to git blame and find out how old this is, but the fact is this project was originally in subversion:
OTOH, I had already just disabled this for the point (radius == 0) case. LOL @ ME! I guess because I had no "radius" factor to arbitrarily scale up until the thing that was supposed to be drawing, started to be drawed?
64000.0f. I have no idea. Even with the fix in, I left this one. Good gravy!
Or, just comment out the visibility check! This nicely dovetails with the "return 1", above. I mean, if the visibility code just ain't workin', just throw it at the GPU. (This is not a terrible approach in a lot of cases, GPUs are way faster than anyone's intuition can allow for...)
Lest you think I had an off-by-a-factor-of-2 error, no. Sometimes, you need to times it by 3. Note the "***arrrg"! Good stuff.
Yes, past self. It's truly a mystery why we are always fudging radius to be bigger by some arbitrary amount. LOL @ ME, this is actually an amazing retrospective, I must have been so frustrated :P
Well anyway, this is fixed now. I can't but think that either some evil spirit has been put to rest, or else some of the "flavour" of the original codebase has in fact been lost. C'est la vie!
Ludo-philosophical rambling, but actually "pop in" is quite bad, because it's the confluence of two things:
- developer sees it as no big deal, because she understands the underlying model so well, her brain has no trouble understanding/rationalizing it as an edge case.
- player's illusion is immediately and completely destroyed-- if the thing is /there/, how can it just suddenly NOT be there.
Even if it's only a teensy bit noticable, to someone properly immersed it's an immense abberation. Like having a substitute actor read one line in a conversation because you needed a retake and the original actor was not available. Maybe this seems reasonable when you consider that you need to fly someone halfway around the world to a particular restaurant just to say "it's a penguin, of course", but this is just the two different headspaces of creator and recreator!
This dichotomy was on full display in the previously-mentioned Skyrim view culling debacle. And this to the amusement of people on BOTH sides: devs completely bewildered that players found this astounding, and players completely astounded.
Enjoy the update!
Get Venture the Void
Leave a comment
Log in with itch.io to leave a comment.