Jump to content
Bloodsong Termagant

LOD Models Voodoo

Recommended Posts

okay, i was banging my head against this for THREE WEEKS... and i still haven't figured it out.  so i have a couple of poll questions.

 

A:  Have you ever built a lower-LOD version of your model from scratch (and had it work/upload)?  IE: for some reason you didn't take the full-res object and decimate it somehow or other to get the lower-res version.

 

B:  Does the SL mesh importer stretch the lower-LOD models so that their bounding box matches the full-res model's bounding box, the same way it stretches/squashes the physics model?

 

 

tl;dr-------------------------------------------------------

i made a simple cushion/beanbag chair, and then i built a really low-res physics model for it.  (if i had been older and wiser, i would have had the foresight to just have saved the original box model i started with, but.  oops.)

the automatically generated lower res versions were... crappy.  and had more triangles.  'i know!' i said, 'i'll use the physics model as the lowest res model!'

but all i ever got was 'material is not a subset' errors.  and yes, i worked through all the fixes on this page:
http://www.pader.world/fixing-errors-on-mesh-upload.html

 

  i took the physics model and i put the three materials of my object on it.  my 'object' was also technically TWO objects in a linkset.  (one with 2 materials, 1 with 1 material.)  so i divided off the 3rd material's faces into a separate object, also.  this is where i got the weird result of this square, which was supposed to be the flat bottom of the mesh, ending up as a diagonal plane through the seat of the chair.  (leading me to suspect some bounding box thing was going on, though i could not find any reference to that, anywhere.)

 

since i can't get, by hook or by crook or by ImportLegacyMatching, this thing to recognize my other model's materials as a 'subset' of the original model's materials (yes, the same exact materials, no .001s)... i'm starting to wonder if the actual VERTICES need to be... i dunno, actual vertices that were in the original model somehow.  :/

 

OR...  maybe it can just never work on two separate objects uploaded as a single mesh thing?  looking for clues, so that's why i'm asking those with more experience in mesh than me.

 

Share this post


Link to post
Share on other sites
1 hour ago, Bloodsong Termagant said:

A:  Have you ever built a lower-LOD version of your model from scratch (and had it work/upload)?  IE: for some reason you didn't take the full-res object and decimate it somehow or other to get the lower-res version.

Yes.  It can be a bit touch and go and not normally recommended. As Pamela said, all LoD models need to have the same number of materials and the uploader is also a bit sensitive to even minor differences in the dae syntax.

 

 

1 hour ago, Bloodsong Termagant said:

B:  Does the SL mesh importer stretch the lower-LOD models so that their bounding box matches the full-res model's bounding box, the same way it stretches/squashes the physics model?

It does, yes. Not only the LoD models but also the physics model.

 

1 hour ago, Bloodsong Termagant said:

(if i had been older and wiser, i would have had the foresight to just have saved the original box model i started with, but.  oops.)

I suppose you still have the dae file for the main model or you wouldn't be able to reupload with new LoD models anyway. So the easy solution is to import the dae file to a new Blender document and create the LoD models from it. Just to make absolutely sure, create a new dae file from the new Blender file for the main model too.

If you don't have the dae file and you use Firestorm, export you mesh as dae with Fs, import to blender, apply location, rotation and scale (this is *very* important!) and off you go.

 

Edit: This case is of course a reminder to us all of the one security question everybody forget every now and then: Is there any doubt whatsoever that you may be doing it wrong?

  • If yes: Make a backup
  • If no: Make a backup
Edited by ChinRey

Share this post


Link to post
Share on other sites

Yes, all the materials of the high-detail model must be present in the low-detail models. This is a bug introduced in 2011 and not fixed.

Not only do you have to have the same materials list, you actually have to map all the unwanted materials to faces. That's a serious limitation. First, you have to find a place to put the useless faces. Second, they eat up your triangle budget. If you're trying to stay below 12 triangles in the lowest LOD, and the highest detail model has 7 materials, there goes your triangle budget.

Is there a way around actually using the unwanted materials? Is it a real sim-side limitation, or just something in the uploader? The built-in decimator in the uploader doesn't seem to have that limitation.

  • Thanks 1

Share this post


Link to post
Share on other sites
5 hours ago, animats said:

Is there a way around actually using the unwanted materials?

Yes although not always. Some triangles that are needed for the best possible shape may be so small or narrow you don't really see their texture anyway. They can be reassigned to any material you like with no significant reduction in visual quality. And sometimes you may want triangles so small they won't be visible to define the bounding box size.

12 triangles isn't a hard limit btw. Here's one with 48 triangles in the lwoest LoD model and it's still well below 1 LI:

1557950566_Skjermbilde(1930).png.968d51b09346a72616c21f3cacf0108f.png

The download weight is determined not by the triangle count but the size of the (compressed) file and there are several ways to reduce that without removing any details from the model.

  • Like 2

Share this post


Link to post
Share on other sites

That's helpful.

Here's what I'm working on - an impostor maker in Blender.

lowrezimpostor.thumb.png.63b8789365dc2368d3b4b11b6f554df5.png

Automatically generated impostor. At left, 30-triangle blank impostor. The user creates that to fit around the full model. Center, the full model, 10,000 triangles. At right, the low-LOD impostor. Its texture map is 64x256, and that's the map on the far right. You fit the blank impostor around the real model, and one click makes the low-LOD impostor. Then upload and go.

lowsizelowrez.jpg.754b221a79d8eab14f96990ccf52c7ac.jpg

Looks like this, at distance. Houses down the street. Little items on the shelf in the next room. Items in a store seen through the window. This is an alternative to the chopped up mess the uploader makes when you ask for a small number of triangles.  Anything which has roughly flat sides, or is shallow, or can only be seen from one side, can be impostored in this way. This has the land impact benefits of zeroing out the lowest LODs, while providing something that looks good all the way down to one pixel.

What's going on here is simple. The plug-in does a render for each face in the impostor, then pastes that on the impostor object. You can do that by hand, but it's a lot of work getting everything lined up. The plug-in does the renders, makes the composite texture, and sets up all the UV coordinates.

This approach doesn't require that LL do anything.

With the right tools, we can have nice things.

Soon to be available as a Blender add-on.

 

Edited by animats
  • Like 2

Share this post


Link to post
Share on other sites
3 hours ago, animats said:

That's helpful.

Here's what I'm working on - an impostor maker in Blender.

lowrezimpostor.thumb.png.63b8789365dc2368d3b4b11b6f554df5.png

Automatically generated impostor. At left, 30-triangle blank impostor. The user creates that to fit around the full model. Center, the full model, 10,000 triangles. At right, the low-LOD impostor. Its texture map is 64x256, and that's the map on the far right. You fit the blank impostor around the real model, and one click makes the low-LOD impostor. Then upload and go.

lowsizelowrez.jpg.754b221a79d8eab14f96990ccf52c7ac.jpg

Looks like this, at distance. Houses down the street. Little items on the shelf in the next room. Items in a store seen through the window. This is an alternative to the chopped up mess the uploader makes when you ask for a small number of triangles.  Anything which has roughly flat sides, or is shallow, or can only be seen from one side, can be impostored in this way. This has the land impact benefits of zeroing out the lowest LODs, while providing something that looks good all the way down to one pixel.

What's going on here is simple. The plug-in does a render for each face in the impostor, then pastes that on the impostor object. You can do that by hand, but it's a lot of work getting everything lined up. The plug-in does the renders, makes the composite texture, and sets up all the UV coordinates.

This approach doesn't require that LL do anything.

With the right tools, we can have nice things.

Soon to be available as a Blender add-on.

 

I can not find on this addons "Automatically generated impostor on Google" and where is it?

Share this post


Link to post
Share on other sites
1 hour ago, Achille Putzo said:

I can not find on this addons "Automatically generated impostor on Google" and where is it?

Nowhere, he hasn't finished trying to create it yet...
 

  • Haha 1

Share this post


Link to post
Share on other sites
6 hours ago, animats said:

Here's what I'm working on - an impostor maker in Blender.

Really interesting.

One question, should we call item that can be rendered as an impostor impostible?

  • Haha 1

Share this post


Link to post
Share on other sites
On 11/2/2018 at 7:09 AM, animats said:

Not fixed for a good reason. Allowing different subsets of materials between LOD models would require a very different approach to how the faces are rendered today. I would consider this as "expected behaviour" rather than a bug, regardless of what Jira archaeology might suggest.

On 11/2/2018 at 7:09 AM, animats said:

Not only do you have to have the same materials list, you actually have to map all the unwanted materials to faces. That's a serious limitation. First, you have to find a place to put the useless faces. Second, they eat up your triangle budget. If you're trying to stay below 12 triangles in the lowest LOD, and the highest detail model has 7 materials, there goes your triangle budget.

Is there a way around actually using the unwanted materials? Is it a real sim-side limitation, or just something in the uploader? The built-in decimator in the uploader doesn't seem to have that limitation.

The limitation is part of the mesh asset format. Every material slot that you use, becomes a separate submesh in the mesh asset. As these are indexed directly in the viewer pipeline there is no allowance for "gaps" which is why you need to have at least one triangle in there. GLOD has exactly the same limitation which is why when you decimate aggressively with GLOD it leaves you with a handful of random triangles. The cascaded dependencies are not unique to textures either.  When rigging a mesh the bones have to be in the same subset of bones that the High LOD uses. The difference, in this case, is that the lower LOD can have a smaller subset of bones (thankfully).

I'm looking forward to seeing the Blender addon from @animats . He and I have been talking about this for a while and he's making big strides to something functionally viable. Imposters do have real limitations of course. they rarely work well for asymmetrical items and the imposter bounding box can often inflate the object BB which increases your LI. However, having a convenient tool to do the painful work for those items where impostering is workable is a great first step.

I have plans to explore the possibility of true dynamic imposters in the viewer, but it is 1) some way down my list and 2) highly likely to prove to be less efficient and have so many corner cases that it is not viable for general use. We have imposters for rigged mesh in Animesh, they inherit that from the avatars. One option you may have going forward, therefore, is to have an item marked as Animesh and get the imposters. It will come with the caveats that apply to Animesh as a whole. Must be <100K triangles and will carry a 15LI tariff but it may work out for some use cases. 

As for the OP's question on stretching and textures. If you are using the "legacy" import method which is to place your models in a dae called "my lovely model_High.Dae" and the medium LOD versions in "my lovely model_MED.Dae", then the uploader will try to match things up but you are more or less constrained to having things in the right order in the DAE files so that the correct models get associated. There are all kinds of ways in which this fails not least of which is that the bounding box for the physics is calculated from the first (root) model and importing a multipart mesh in this way is not recommended. 

The preferred way is to use name-based association. This allows you to associate models between LODs by naming them properly. This way you have "house" in the high LOD and "house_LOD2" in the medium LOD file, house_LOD1, house_LOD0 and house_PHYS, complete the set. Your second model is thus "roof", "roof_LOD2", etc etc. This method is documented here 

 Though it should be noted that the instructions are far from clear and helpful  and as Drongle points out in the comment it is the objects that have the naming requirements, if you want the improved correlation to work, not the files. 

 

 

  • Like 3

Share this post


Link to post
Share on other sites
17 hours ago, Beq Janus said:

I have plans to explore the possibility of true dynamic imposters in the viewer, but it is 1) some way down my list and 2) highly likely to prove to be less efficient and have so many corner cases that it is not viable for general use.

It's not suitable for general use, I think that is clear. The house Animats used as an example here is a good example of an object that almost certainly shouldn't be impostered. But some of the objects at his in-world demo are.

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, ChinRey said:

It's not suitable for general use, I think that is clear. The house Animats used as an example here is a good example of an object that almost certainly shouldn't be impostered. But some of the objects at his in-world demo are.

yeah, I should clarify what I mean though, as dynamic imposters are a different beast to static ones. 

imposters in the viewer are different to the imposters Animats has made inworld using his (rather fun) avatar tracking lsl script, and also to the impostering that you and I would do on things like windows. In the latter case it literally only works for something either flat-ish like a wall/window or symmetrical around the major axis that you are "likely" to see it. In the former case, it renders prebaked views at a limited set of angles, every 45 degrees, for example, giving you a kind of octahedron of projected imposters. That is a lot of texture space and works best for objects that a "quite" symmetrical in that you can get away with just those few angles.

An imposter in the viewer is different, You fully render the object from the direction that the camera is pointing, using the full lighting of the scene, it is no different in fact, to how it gets rendered to your screen, except, you capture that output and store it. The next frame, you check to see if the angle between you and the object had altered much and if not, reuse the same image as before. It, therefore, has no limitations (except that you must be able to render it!) However, the complication is in the usage. if the object is animated, then how do you know when to refresh? (for avatars and Animesh this is a simple timer) for a fast moving camera or fast moving object, the overhead of rendering the imposter is a waste of time because it will frequently never get reused. It is not only the relative position but relative orientation of course (I forgot that) if the target rotates in place it will look different and need redrawing. Finally, perhaps the biggest concern, you need to have the mesh available to be able to render the imposter, this is a little chicken and egg. Avatar imposters are OK though...but we have max 70-100 avatars and typically a lot fewer. with objects, we have a lot more. Hence, I think it is worth exploring but my gut feeling is that there are too many conditions where dynamic imposters are going to fail to give either a nice result or a speedup. 

  • Like 2

Share this post


Link to post
Share on other sites
On 11/3/2018 at 3:13 AM, animats said:

Here's what I'm working on - an impostor maker in Blender.

This approach doesn't require that LL do anything.

With the right tools, we can have nice things.

Soon to be available as a Blender add-on.

Great idea man, I am considering writing a plugin to automate my icosahedron globe unwrapping workflow too, thanks for the inspiration, and for what appears to be a great time saving tool.  Im excited to see how you develop it further, will it be on github?

Hopefully you're not as cute as your avatar. ?

Share this post


Link to post
Share on other sites
On 10/28/2018 at 2:25 PM, ChinRey said:

the uploader is also a bit sensitive to even minor differences in the dae syntax.

Oh dear.

I do a lot of my building in another program, not Blender, though I use it with Avastar for rigged mesh. Using both, incidentally, I wonder if any program does mesh smoothing in quite the same way as SL.

Both export a .dae that the uploader can handle, but this sounds like yet another undocumented can of worms.

Share this post


Link to post
Share on other sites
1 hour ago, arabellajones said:

Oh dear.

I do a lot of my building in another program, not Blender, though I use it with Avastar for rigged mesh. Using both, incidentally, I wonder if any program does mesh smoothing in quite the same way as SL.

Both export a .dae that the uploader can handle, but this sounds like yet another undocumented can of worms.

What I was talking about, was the "Not a subset of reference model" error and it's very rare if you take a few simple precautions like the one I mentioned.

The simplified explanation: Dae is a variant of xml, essentially it's a text file describing how the item looks. As you well know, different people will often use different words to describe exatly the same thing and so do computer programs. And like a human, a computer program may also describe the same thing differently in different contexts. If the syntaxes of the models are too different, the uploader will fail to connect them and it'll give you the not a subset error message.

In this particular case, the obvious problem was the names of the UV map and materials. They will be different in the Fs generated dae than in the original file and that is bound to give the uploader a headache.

Edited by ChinRey
Typos
  • Thanks 1

Share this post


Link to post
Share on other sites
On 11/4/2018 at 6:39 AM, ChinRey said:

It's not suitable for general use, I think that is clear. The house Animats used as an example here is a good example of an object that almost certainly shouldn't be impostered. But some of the objects at his in-world demo are.

Maybe Imposter is the wrong word here?  Seems to me Mr Lovelycakes addon will help to generate the LOD models/texture right?  But you two are discussing another awesome thing, an auto generated on upload imposter system?

Or do you mean something else like those parts should be broken up more and not a whole house?

Edited by Macrocosm Draegonne

Share this post


Link to post
Share on other sites

Take a look at some of my plants in-world. I create a bounding box with triangles crushed down to single lines, then keep the models inside these frames so the meshes don't go funky as they LOD because I often use a billboard for this. 

  • Like 2

Share this post


Link to post
Share on other sites
On 11/9/2018 at 12:43 PM, Cube Republic said:

Take a look at some of my plants in-world. I create a bounding box with triangles crushed down to single lines, then keep the models inside these frames so the meshes don't go funky as they LOD because I often use a billboard for this. 

I adore your plants and things!  It was one of the first things I found when coming back to SL after being away nearly 5 years.  I had never seen plants so excellently done in SL, but Mesh wasnt much of a thing yet when I left, it was only a few clothing items back then.  You do a fantastic job on LOD and everything, definitely some of my favorite SL objects of all time.  I think I bought half the store my first visit lmao!

  • Like 1

Share this post


Link to post
Share on other sites
16 hours ago, Macrocosm Draegonne said:

I adore your plants and things!  It was one of the first things I found when coming back to SL after being away nearly 5 years.  I had never seen plants so excellently done in SL, but Mesh wasnt much of a thing yet when I left, it was only a few clothing items back then.  You do a fantastic job on LOD and everything, definitely some of my favorite SL objects of all time.  I think I bought half the store my first visit lmao!

Thanks very much for the compliment.

  • Like 1

Share this post


Link to post
Share on other sites
On 11/7/2018 at 1:13 PM, ChinRey said:

The simplified explanation: Dae is a variant of xml, essentially it's a text file describing how the item looks. As you well know, different people will often use different words to describe exatly the same thing and so do computer programs. And like a human, a computer program may also describe the same thing differently in different contexts. If the syntaxes of the models are too different, the uploader will fail to connect them and it'll give you the not a subset error message.

Thanks...

Did the Lindens document any of this?

I find it hard to be confident.

Share this post


Link to post
Share on other sites
5 minutes ago, arabellajones said:

Did the Lindens document any of this?

Does Linden Lab have a tradition of documenting things? :P

Dae (or Collada as it's real name is, dae is jsut the file suffix) is not an LL product though. It's an open format for 3D applications and there is plenty of documentation elsehwere. The wikipedia article is perhaps the best place to start.

Then there is the official web page and if you really want to go in depth, here are the official specs.

I better warn you though, dae is not actually a mesh format, Mesh is only one tiny part of it although it's the only part SL uses.

 

  • Thanks 1

Share this post


Link to post
Share on other sites
On 10/28/2018 at 2:11 PM, Bloodsong Termagant said:

A:  Have you ever built a lower-LOD version of your model from scratch (and had it work/upload)?  IE: for some reason you didn't take the full-res object and decimate it somehow or other to get the lower-res version.

Yes. Most of the time I start making the most detailed version and then build a less complex version around it, keeping in mind that the UV map must also correspond with the original texture. Very labor-intensive, but worth it for small mesh objects that you don't want to look like crap from 10 m away.

ad37e4b92a25a3573c37292d11fa2c4f.thumb.png.d3bf902d29e498c8372aa90eed654ee7.png

In this example, I placed cylinders around each piece and squeezed them at the relevant latitudes. From this set, I discarded the middle row of pieces, because the resulting Land Impact was still too high. So I ended up using the front row for full detail, and the back row for the next LoD (and no mesh for the lowest two LoD levels).

On 10/28/2018 at 2:11 PM, Bloodsong Termagant said:

B:  Does the SL mesh importer stretch the lower-LOD models so that their bounding box matches the full-res model's bounding box, the same way it stretches/squashes the physics model?

Yes it does, just like the physical models. This allows for some serious mesh voodoo magic, like making things appear bigger as you move away from them. ;)

  • Thanks 3

Share this post


Link to post
Share on other sites

Edit - Extra advise, if you make lower LoD models manually: If you use smooth shadowing on your highest detail models (right), set the shadowing to flat on the subsequent lower LoD versions (left). This counters adverse shadowing effects (middle; unwanted, suddenly appearing darker corners and sides when you zoom out).

fcc79ac57feda3cadee2a0a144cb3468.png.7d5d9b351adc5cedcb09b00a3fe931da.png

From left to right: low LoD flat, low LoD smooth, high LoD smooth

Edited by Arduenn Schwartzman
  • Thanks 1

Share this post


Link to post
Share on other sites

I wouldn't use flat personally, adding sharp edges where necessary will give you better control. "flat" shading is obtained by introducing edge splits and this will effectively doubles your vertex count.

Share this post


Link to post
Share on other sites
On 12/1/2018 at 12:58 PM, Kyrah Abattoir said:

I wouldn't use flat personally, adding sharp edges where necessary will give you better control. "flat" shading is obtained by introducing edge splits and this will effectively doubles your vertex count.

It can get complicated, and not all mesh-creation programs handle sharp edges the same way. But there is an Upload option, "Generate Normals", which can work well. It would be good for something such as that cube, less good for  other things. I've used it to preserve a sharp step that would otherwise be lost in smoothing, specifically a lapel edge on a coat.

I also wonder if any external program does smoothing in quite the same way as SL But remember that low-LOD models can be far enough away that you can't see that sort of detail. Will sharp edges matter at a distance?

Share this post


Link to post
Share on other sites

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

×