Jump to content

A new look at the z dimension LOD bug


ChinRey
 Share

You are about to reply to a thread that has been inactive for 2282 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

For those not familiar with that particular bug: A mesh' LOD is of course dependant on how well the LOD models are made but it also depends on the "switch points", the distances the different LOD models are applied at. The switch points are calculated according to the overall dimesions of the mesh and should be fairly easy to determine. But some meshes have much worse LOD than they are supposed to have. What happens is that if a mesh has three or four faces, its dimensions along the z axis is ignored. Usually the difference is barely noticeable but if such a mesh is very tall and thin the bug can have a huge impact. Linden Lab has never shown any interest in fixing the issue, nor have they been able to explain how such a weird bug can even exist.

Anyway, I had a thought it may have something to do with prims. After all, the whole LOD model system we use was originally made for prims and then implemented on items - first sculpts then mesh - it is thoroughly unsuitable for.

Here are two prim pillars, 6 m tall and 0.1 m in diameter:



The difference between them is that the one to the left is a cylinder, 6 m along the z axis, the one to the right is a tube rotated 90 degrees, 6 m along the x axis.

So, the z LOD bug applies to prims too but not in the same way as meshes:



Here the cylinder has been hollowed and pathcut so it has six faces and it still suffers from the z LOD bug. I did some more tests and it turns out spheres and cylinders have the bug, the other five prim shapes don't, regardless of how many faces they have been twisted into.

This is speculation but I think the explanation is that the bug was a deliberate attempt to save a few polys back int he early beta days when there were only two curved prim shapes. LL then forgot to include it when they introduced three more curved prims later and then they forgot not to include it when they introduced mesh.

Link to comment
Share on other sites

That's the point. The one that looks like a stretched hexagon should look like a cylinder (because it is a prim cylinder) but the LOD-z bug is making it display in a low LOD version (of a cylinder) closer than it should. At the distance, it should still be in high LOD like the tube is, and should look like a cylinder.

Link to comment
Share on other sites


Pamela Galli wrote:

I don't understand. Those don't look like a cylinder and tube.

I know but that's what they are.

Easy test to do actually, although perhaps easier horizontally than vertically:

Rez a cyliner and a tube and place them right next to each other, rotate the cylinder 90 degrees around the y axis. Apart from the UV mapping they look absolutely identical.

Make them 64 m long and 0.1 m in diameter and look at their ends. The end surface of the tube is still circular while the cylinder has degenerated into a hexagon.

Link to comment
Share on other sites

Interesting.

It's not the same thing though.

If you look at the list of factors affecting LOD I posted in another thread, the Firestorm JIRA describes #2 and/or 3 on the list, while the hexagonal cylinder is clearly related to #4.

The elongated cylinder becoming a hexagon issue has been in SL for as long as I've been rezzing prims here, it just didn't occur to me until now it has any connection to the z LOD bug. It's conistent, it is affected by RenderVolLODFactor and the LOD model always switch back and forth at the "right" distances - that is the distances that would have been right if the z dimension had been 0.

What the Firestorm JIRA describes is LOD delay or LOD hangup and that's a very different issue. A newly rendered object gets stuck at too low a LOD level. Increasing the LOD factor won't improve the LOD here, if it has any effect at all, it only makes it slightly worse and once the right model has been force loaded, it stays correct. This is not a new problem either but yes, I do think it has grown steadily worse over time. I don't know why and I may be wrong anyway.

Link to comment
Share on other sites

  • 2 weeks later...

A bit of update here. in case anybody are still interested... ;)

 

This is what seems to have happened:

Back when LL developed the first prim system, they used different formulas for the LOD switch points depending on the basic prim shape, cubes and prisms use the official formula while spheres and cylinders use the secret one with the z factor omitted. This is confirmed and it was probably a deliberate decision. A sphere or cylinder stretched only along the z axis will be so distorted anyway the reduced LOD will hardly be noticeable. (The three prim shapes added shortly afterwards all use the official formula.)

Now as far as the SL rendering code is concerned, a mesh is just a distorted prim. Which prim shape it is based on, depends on the number of faces:

  • A single face mesh is based on the sphere
  • A two face mesh is probably based on the hemisphere (I haven't been able to confirm this yet)
  • A three face mesh is probably based on the cylinder (also unconfirmed)
  • Four face mesh is a hollow cylinder
  • Five face mesh: prism
  • Six face mesh: cube
  • Seven and eight face meshes: pathcut cubes

(This is the reason why meshes don't show up properly on the map btw. The map software uses these basic prim shapes rather than the actual mesh shapes.)

Somebody will have to examine the viewer code to confirm this of course but I think the only mystery left to explain is why single faced meshes don't have the z LOD bug. The only plausible explanation I can think of is that LL did notice and correct the bug there but forgot to check the cylinder based meshes.

  • Like 1
Link to comment
Share on other sites

This makes sense actually.

I think it's only cylinders which ignore the Z dimension though.

It's also true that round prim shapes, and sculpties, use a different factor for the LOD switches, than the other prims (and meshes). It's not a secret though. :matte-motes-smile: Round prims use a factor of 0.6, and all others 0.5. Which makes curved prims 20 % larger in the LOD calculation.

Link to comment
Share on other sites


arton Rotaru wrote:

This makes sense actually.

Woops, sorry about that. I swear it was an accident!

 


arton Rotaru wrote:

I think it's only cylinders which ignore the Z dimension though.

I did the same test with a sphere as I did with a cyinder and it to showed up as hexagonal when viewed from the top and down. Very hard to see though, a 0.1x0.1x6 m sphere hardly looks rounded anyway.

 


arton Rotaru wrote:

It's also true that round prim shapes, and sculpties, use a different factor for the LOD switches, than the other prims (and meshes). It's not a secret though. :matte-motes-smile: Round prims use a factor of 0.6, and all others 0.5. Which makes curved prims 20 % larger in the LOD calculation.

Oh. Is there an official documentation about switch points anywhere? I've only seen the formula Drongle posted here logn ago.

Link to comment
Share on other sites

If you look at the number of triangles (Develop -> Show Info -> Show Render Info) while the object is selected, and zoom in and out, you'll notice that the sphere is still displayed at the highest LOD (576 Tris) when the Cylinder is already at it's lowest LOD (24 Tris).

I guess the only documentation is the source code of the viewer itself. There is this comment from Runitai though,  in which it is mentioned, and where to find it in the source code.

https://jira.secondlife.com/browse/CTS-673

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2282 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...