site banner

Friday Fun Thread for July 28, 2023

Be advised: this thread is not for serious in-depth discussion of weighty topics (we have a link for that), this thread is not for anything Culture War related. This thread is for Fun. You got jokes? Share 'em. You got silly questions? Ask 'em.

2
Jump in the discussion.

No email address required.

I've been playing a lot of modded Skyrim recently and finding lots of instances of objects placed incorrectly causing holes or hidden surfaces to be visible. For those with 3d programming experience, does writing a program to detect and report these seem like a reasonable project as an excuse to learn how to work with 3d graphics for an experienced programmer who is completely unfamiliar with 3d graphics or would this be biting off a bit too much?

Since no-one has commented on the technical question, @ZorbaTHut do you have thoughts here? Is this a reasonable first step into 3d graphics programming?

I saw your comment originally, but forgot to answer. I only played around with modding Morrowing way back when, so I'm not familiar with what Skyrim lets you do, but I don't remember anything particularly 3d-graphics-programming-y about it. Does Skyrim scripting let you do some vector/matrix math (other than you implementing it by hand that is)? That's the typical entry point into the world of 3d programming.

For those with 3d programming experience, does writing a program to detect and report these seem like a reasonable project as an excuse to learn how to work with 3d graphics

I might be missing something obvious, but it sounds like a nightmare to me. I think you could do something clever to only fetch the spaces affected by the mod you want to validate, but after that... How would you decide which surface is supposed to be hidden, or a hole is not meant to be there? What does "visible" mean? You'd run a sweep through the entire room?

Does Skyrim scripting let you do some vector/matrix math (other than you implementing it by hand that is)?

I don't know, but I was planning to do this as a separate (probably C++) program that just loaded all the resources and analyzed it rather than doing it in Skyrim itself. The idea was to start off learning how the assets are stored, how the data structures for the models work together, etc and build up to being able to run a "simple/naive" analysis on them.

How would you decide which surface is supposed to be hidden, or a hole is not meant to be there?

It wouldn't, it would just try to identify all of them and leave it to someone/something else to decide if it is meant to be there or not.

What does "visible" mean?

I don't know much about 3d graphics at the moment, but I believe a naive algorithm for detecting what I'm looking for would be to cast a ray from a spawn location straight down until it intersects a surface, then do a breadth-first search of all adjacent surfaces recording any that are adjacent to (roughly, share an edge with) one without a renderable texture.

You'd run a sweep through the entire room?

Ideally it'd sweep over every worldspace in the game.

For the life of me, I can't remember the name of the guy, but when I was getting into 3D programming, there was a series of OpenGL (or was it DirectX) tutorials that some dude wrote, and everybody was using. It looked kind of like this one, and it took you through all the relevant math, and showed all the basics from rendering/manipulating 3d models, to texture mapping, and taught cool effects. Personally I'd go with something like this for a start.

I don't know, but I was planning to do this as a separate (probably C++) program that just loaded all the resources and analyzed it rather than doing it in Skyrim itself. The idea was to start off learning how the assets are stored, how the data structures for the models work together

With this alone you'd have your hands full, I think.

It wouldn't, it would just try to identify all of them and leave it to someone/something else to decide if it is meant to be there or not.

Well, even then you need some criteria to try identify them. Otherwise you'd be showing people the entirety of the game map.

I don't know much about 3d graphics at the moment, but I believe a naive algorithm for detecting what I'm looking for would be to cast a ray from a spawn location straight down until it intersects a surface, then do a breadth-first search of all adjacent surfaces recording any that are adjacent to (roughly, share an edge with) one without a renderable texture.

Yeah, you can do that (and in fact I distinctly remember Morrowind having a scripting function for it), the issue is that you can cast an infinite amount of rays from any point. You can get around that if you know what you're supposed to be looking at. For example, to determine if an NPC can see you, you can cast a ray from it's head on to the center of the player's model (or to a few points defining it's boundaries). If something breaks the line of sight, the NPC can't see you, if not, he can. Then you write the AI code to react appropriately. But if you're sweeping the entire map, and casting rays from everywhere towards everywhere, you're going to make your CPU weep tears of blood. And coming back to identification - if you don't know which rays are supposed to be broken, and which are not, the entire exercise is kind of futile.

Ideally it'd sweep over every worldspace in the game.

That would take approximately forever.

Yeah, you can do that (and in fact I distinctly remember Morrowind having a scripting function for it), the issue is that you can cast an infinite amount of rays from any point.

I don't think I communicated the intended algorithm well. This is just intended to be a batch program that you point your load order at and it spits out a file listing all the "holes" it found. I would only cast a single ray per worldspace, straight down from the (first, if more than one) spawn location to identify a surface to start the breadth-first search. My assumption is that this initial surface would almost certainly be part of the composite surface surrounding the playable volume of that worldspace rather than something floating within it, and thus "flooding" over it with a breadth-first search would suffice to identify holes.

EDIT:

Well, even then you need some criteria to try identify them. Otherwise you'd be showing people the entirety of the game map.

I do have a criteria to identify them: a surface with a texture adjacent to one without a texture. It is classification of them that I defer on. The definition of "adjacent to" is a bit complicated, but basically shares an edge with and if you rotated them around that edge they'd come together without intersecting another surface.

So to make sure I got it right: just a scan from the top to make sure there's no holes in the floor / the ground?

Yes, though I expect for interior worldspaces it'd wrap around to cover the walls and ceilings as well.

Oh ok. I think that should work for interiors (though the math of it is beyond me at the moment)... For exteriors, I thought there are not holes in the ground in TES games, that the map is literally a heightmap defining where topography of the ground?

More comments