Jump to content

Unexplained LOD distortion


Nacy Nightfire
 Share

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

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

Recommended Posts

I'm trying to figure out if my LOD problem was a human error or an Blender 2.63.0  bug.  I made a mesh with 2 lod levels.  On upload the lods became distorted.  I very carefull and repeatedly applied ctl-a to zero out location, rotation and scale for each lod mesh in object mode,  then I pressed the shortcut U for each mesh part to just to make certain each part was a single user for its mesh data, then for good measure I selected shift-ctl-a to make duplicates real.  Then I repeated all of this 3 times.  No luck.  Only by exporting the meshes as objs and reimporting into Blender then exporting in the collada format did I get what I expected.  This solved my problem, but I'd dearly love to know why this happened and what I might be doing wrong. Any ideas would be appreciated.

Link to comment
Share on other sites

It's not completely clear what you were doing here,but it sounds as if you may have been trying to upload both LOD meshes in a nsingle Collada file. This is not possible. The LOD meshes have to be in separate Collada files. I believe the latest Blender, 2.63a, just released now has the checkbox for exporting only the selected Blender object, which means you can still export meshes separately although they are in the same Blender scene, as you could always dowith 2.49. If that isn't what you were attempting, just ignore this post. (pictures of the problem might help).

Link to comment
Share on other sites

Thanks Drongle and Gaia for the responses. 

I did export each lod as a seperate collada file.  I didn't try to group them.  Also I was very careful to check export "only selected".

If it occurs again I'll try to screenshop the uploader.  It wasn't a complete distortion, just an odd stretching of  the geometry. In blender all lods matched exactly in position, but somehow that changed and it  these two lod meshes stretched in the uploader.

The obj export/import corrected whatever was causing the problem.  Still it is useful to figure out the reason if possible.

Link to comment
Share on other sites

  • 3 weeks later...

(sorry for the split post..I had problems adding text after I uploaded the pics)

Here's another example of what I'm going through (hell).

 

I made this fan with three objects.  Motor (one material), Blades (two materials), Light (two materials).  I made a low lod model and a phys shape for each obj comprised a triangle for as many materials as the object contained and I assigned that material.  I placed the triangle(s) to create an identical bounding box as the object part represented.

 

I used CTLA on all parts repeatedly.  I assigned and reassigned the materials being very careful to give the same material to the lod parts and the phy shape.  I made sure there were the right number of users for each material and there were no extraneous materials in the file.  The order of the material assignments is identical on the lods and phy shape.

 

I STILL get the warning about the material not being a subset of the reference mesh AND there's a distortion (second pic) in the mesh of the low lod.

I've tried exporting as obj and reimporting, That worked once but there was flipped normals.  I went back into the file, flipped the normals, tried to upload and got that dang  warning about material assignments again.  And I've been VERY careful to select "only selected" on exporting.

When I individually upload each obj part with its low lod, I do not get distortion in the uploader or any complaints about the materials.

 

Why can't I import it as a group?  Is it possible to do so?  Are there any limitations as to how many objects can be uploaded together ( in this case 3 Objects, Total materials 5.  Max material per object 2.)  For a project like this it' much simpler to align the parts in Blender then try to center then perfectly in SL (for me, anyway).  And they have to stay seperate objects for script reasons.

 

Any help would be appreciated. Thanks in advance.

Link to comment
Share on other sites

See this. Blender exporter now uses Datablock names instead of object names for the names of the <geometry> tags. Your datablock names do not have the same alphabetical order at the two LODs. With the 2.49 exporter, they were exported in alpabetical order.

The SL importer works out which mesh goes with which by their order in the collada file (unles they have changed that already). So that would have explained the problem. However, I just found that the 2.63 exporter does not use alphabetical order, either of object or datablock names! As far as I can see (which is not very far) they appear in the Collada file in inverse order of creation. If that's right, it's very bad news because that is almost impossible to adjust retrospectively.

For now, the only thing I can suggest is to manually edit the Collada files so that the <geometry>....</gometry> sections appear in the same order of components in both LOD files. This is not a very practical solution, but trying it would at least confirm whether that is the problem. Then we can see about getting the exporter or the importer (or both?) to do something more useful.

  • Like 1
Link to comment
Share on other sites

Had a brief look at some Blender source code. Not thorough, but it looks like the objects are taken in the order they come from a doubly linked list. Assuming that is a stack, that would produce the inverse of the creation order, which is what it looked like. To change the order without delving into the heart of Blender would require making a new list and sorting it before constructing the Collada output, I think. It might be easier to write a script to sort the <geometry >sections after the export is done. Less chance of messing something up that way.

  • Like 1
Link to comment
Share on other sites

Thanks so much Drongle. I semi-understand this. I'm a bit dense about data blocks and why one would set a material as object vs data, but I plan to do more research in hope of finally getting it into my brain.

I couldn't access the link, but I'm guessing it might be to a previous posting that you authored so I'll search that out and re-read it.  I didn't quite understand it then, but I may have a better sense of it now.

Later  tonight I'll try to edit the collada file and see what I can come up with.

Link to comment
Share on other sites

Whoops. I messed up the link. It is repaired now.

Meanwhile, here is where you can see the datablocks in the outliner. The first two cylinders are different objects with the same data block (AltD). If you edit one, they both change. The third cylinder has its own new datablock (ShftD). Editing it will not affect the others. The level below the datablocks are the material references for each.

databloks.png

  • Like 1
Link to comment
Share on other sites

Hi, Drongle;

I thought it was only the naming of the geometry blocks that is needed to be kept consistent. But now it appears like its the sort order that counts. Or is it both at the end ?

Has that changed or have i misunderstood something ?

Link to comment
Share on other sites

I just re-checked in case it had changed with latest viewer, but it hasn't.Currently it looks like this...

The names of the imported meshes are taken from the name attributes of the <geometry> tags, which are now (Blender 2.63) the names of the datablocks (was object names in 2.49b). However, the names of the meshes are not used to associate meshes at different LODs, even if they identical. It is still only the order of the <geometry> sections in the collada file that counts. In Blender 2.63, it appears that the exported <geometry> sections are in the opposite order to the order of creation of the objects in Blender*. That means the only way to control the order is to create the meshes for each object at each LOD in the same order. This is tricky to do, although not impossible. You can do it in retrospect by shiftD copying in the right order and deleting the originals, I think.

In Blender 2.49b, I was using alphabetical ordering, with the LOD for each object having the same name, but with a suffix iondicating the LOD (name_hi, name_lo, etc.).  The alphabetical ordering was with a patch to the export script that I described in this forum. I had forgotten that it needed that patch. I don't know what the ordering was in the unpatched export script.

* this is consistent with scanning from the head of a doubly-linked list to which new objects are added by insertion at the head. Blender does use such a list and it is scanned from the head by the exporter, but I don't know for sure that new objects are inserted at the head. (I was not accurate describing this as a stack, because elements can be deleted from the middle, but only from the top of a stack, I think.)

ETA: I guess it wouldn't be too difficult, instead of exporting them in the order they are, to collect the object pointers into a new list, sort it (during construction?) by the datablock name, and do the export as it is but using the new list, so that its alphabetical order.  That could be invoked by the "Export for SL" toggle. I could write something, but I don't think I can set up a Blender build environment.

Link to comment
Share on other sites

Drongle, you wrote: "That means the only way to control the order is to create the meshes for each object at each LOD in the same order. This is tricky to do, although not impossible. You can do it in retrospect by shiftD copying in the right order and deleting the originals, I think."

I'm waaay out of my league in this discussion here between yourself and  Gaia, but I'll mention that to make the LODs in the case I've described below, I created the highest LOD first then used shift D to copy and move to a new layer and reduced via removal of edgeloops to make the Lower LOD. With the physics shape I just went into bounding box mode and used triangles to delineate the bounding boxes with just enough tris to support the number of materials.  For a more complex LOD I would just shift-D copy from high, to medium, to low.  Is there something wrong with this workflow method?

Link to comment
Share on other sites

There's no problem if ther's only one mesh. The problems arise when you are uploading several meshes together. Then the uploader has to decide which mesh at each lower LOD (and physics) belongs to which mesh at the high LOD. At the moment, it does that by the order their <geometry> sections appear in the collada files. So you have to make sure they are in the same order in all of the files. The exporter exports them (whichever you have selected) in the oppositr order to the order they were created (I think). So you have to make sure the equivalent meshes for each LOD were created in the same order relative to the others in the same file. You can do this in several ways;

for example if A, B, C are the objects, you could create them in the order A_hi, B_hi, C_hi, A_med, B_med, C_med, A_low, B_low, C_low ...etc.;

or you could make A_hi, A_med, A_low, B_hi, B_med, B_low, C_hi, C_med, C_low, etc.

A_hi, A_lo, B_lo, B_hi would also work because in the file they would be hi: B_hi, A_hi; low: B_lo, A_lo.

But A_hi, B_lo, A_lo, B_hi would fail because the files would be hi:B_hi, A_hi; lo: A_lo, B_lo.

In that case, the low LODs of A and B would be swapped. If they don't have the same materials, you would probably get the material subset error and not be able to upload.

I don't know how layers would affect this, if at all.

My suggestion for correcting the order when it is wrong is to create a whole new set of meshes by using shiftD, making sure it's in the right order within each LOD set. Then you casn delete the old ones that were in the wrong order and they new ones should work correctly.

I think it would be easier if the export-for-sl switch sorted a copy of the object pointers so that they were then exported in alphabetical order. That way, if you made the datablock names like A_hi, A_me, A_lo and B_hi, B_me, B_lo etc. (ie name_lod), then having the same name part would mean that they were always in the same order for all the LODs.

I hope that makes it a bit clearer?

  • Like 1
Link to comment
Share on other sites

It absolutely does make it clearer!!! Thanks a gazillion Drongle. I don't know where I'd be without all you excellent and generous help here on the forums.

I bravely embarked on the adventure of editing the Collada file, per your instructions and it WORKED. Although I really do not have a full grasp on what everything in the file means, I get the sense there are three "sections"  in the file and the Geometry part in is the middle. Just to make sure I got it right, I sorted all three areas, not just the geometry part, on the lower lod file to match the high.  Although not difficult, it's tedious and time consuming. I'm weighing the tedium of this process against the tedium of perfectly matching up parts in SL.  Probably it is stil worth it to get the Collada file correct, but it would be terrific if someone could implement your recommendations for alphabetizing the parts. 

Hats off and unlimited kudo-hugs to you!

Link to comment
Share on other sites

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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...