Does OpenMW have concepts of "absolute coordinates" and "cell coordinates"?

Not about OpenMW? Just about Morrowind in general? Have some random babble? Kindly direct it here.
Post Reply
User avatar
afritz1
Posts: 47
Joined: 05 Sep 2016, 01:18
Contact:

Does OpenMW have concepts of "absolute coordinates" and "cell coordinates"?

Post by afritz1 »

In my Arena engine I need to break away from using absolute coordinates for everything so I can properly represent some of the original game's quirks like infinite interiors and wrapping terrain outside the walls in cities. I also need to be able to load the wilderness in chunks because trying to load all 64x64 chunks is pretty naive. I think there are probably several parallels we could draw between Arena and Morrowind with regards to cells and things like that.

Are there any gotcha's about things like moving an entity between two cells?
User avatar
akortunov
Posts: 899
Joined: 13 Mar 2017, 13:49
Location: Samara, Russian Federation

Re: Does OpenMW have concepts of "absolute coordinates" and "cell coordinates"?

Post by akortunov »

IIRC, objects in OpenMW (including scene nodes) use world coordinates (what leads to precision issues with huge world size).
Each interior has its own coordinates system.
User avatar
afritz1
Posts: 47
Joined: 05 Sep 2016, 01:18
Contact:

Re: Does OpenMW have concepts of "absolute coordinates" and "cell coordinates"?

Post by afritz1 »

So when a cell is loaded in OpenMW it never has its own relative coordinate system, it's just instantiated at some 3D coordinate in the world then.

I was wondering whether I should store Arena entity coordinates relative to their current cell and render them relative to the player's current cell so there are never precision problems. However, Arena's wilderness is 4096 blocks total on each side and each block is roughly 2 meters big so I don't know if there would be any issue using 32-bit floats. The min and max coordinates would be 0 to 4096.

I don't know how big a wilderness in Arena is relative to Vvardenfell... potentially 8km x 8km based on the numbers above?
User avatar
AnyOldName3
Posts: 2667
Joined: 26 Nov 2015, 03:25

Re: Does OpenMW have concepts of "absolute coordinates" and "cell coordinates"?

Post by AnyOldName3 »

Cell-relative coordinates are more reliable. Even if you don't end up running into precision issues, it can make batching easier if you just end up with a single merged mesh for each cell with only the cell's overall transformation matrix affecting it. It's probably what we're going to end up doing to sort out our precision issues with Tamriel Rebuilt. It works in Star Citizen where a much bigger range and much finer precision is needed, so hopefully we'll see gains, too.
User avatar
afritz1
Posts: 47
Joined: 05 Sep 2016, 01:18
Contact:

Re: Does OpenMW have concepts of "absolute coordinates" and "cell coordinates"?

Post by afritz1 »

Yeah, the reliability is one thing that stands out about cell coordinates. I think the 3D (well, 2D) transform math should be pretty easy too. In the unlikely event I allow wilderness to generate far beyond the fixed 64x64 size, then it would be trivial to make that happen with cell coordinates.

I experimented a bit with bfloat16 for textures (float32 with half its precision bits truncated for fast conversion), and maybe I could try something similar with entity positions if the range of coordinates is only 0 to 64. I kind of wish 16-bit floats were a standard thing :(
User avatar
AnyOldName3
Posts: 2667
Joined: 26 Nov 2015, 03:25

Re: Does OpenMW have concepts of "absolute coordinates" and "cell coordinates"?

Post by AnyOldName3 »

Depending on the version, OpenGL has either built-in or extension-provided support for several small float formats both for images and vertex attributes: https://www.khronos.org/opengl/wiki/Small_Float_Formats. There's more-or-less the same level of support in DirectX. That means that there are a lot of tools out there that support some type of small float or other, and in the graphics world, they're pretty close to standard.
Post Reply