Getting objects from Blender to DS

Often i want to do it the other way around: get objects from DS into blender. So i started to make an addon for this. However, it turned out to be rather complicated, mainly because it is hard to see what is important and what is not. So i got the idea to export objects from blender to DS instead, which is much easier, because i can leave something out and see if the missing parts do any harm. Since the question how to get objects from blender into pops up now and then in this forum i describe how i do things using a simple example, which covers most of the possibilities.

As an example i use small forest scene; Here is a ground i created in blender:

 

edp-ground.jpg
647 x 310 - 16K
«13

Comments

  • This could be easily exported as wavefront-obj, and imported into DS. I use my own script, however. I select the ground, choose a filename in a ds-library-directory (i use test.duf for this example).

    There are two options that are of interest:

    • blender differs from DS in which coordinate axis is usually considered "upward". In blender it's Z, in DS it's Y. Using the Y-up option this is converted automatically.
    • The scale option is a multiplier by which every coordinate is multiplied. Blender is basically dimensionless, DS uses centimeters for coordinates. Most of the times i use a blender scale of 1unit = 1meter, so a factor of 100 is required

     

    edp-ground-setting.jpg
    231 x 159 - 5K
  • This generates a DS scene-subset file containing the ground. I can import that in DS using the Content-Library. The image shows how it looks in DS.

    Note that the object in DS's scene view is called "ground-3". Internally the export generates 3 things: a geometry entry, an object definition, and a scene-object. They are all mangled into one scene-subset file. Within the scene-subset file all things must have distinct identifiers, The export-script generates distinct identifiers by appending a number to the names (hence the "-3"). You have the same effect when loading multiple e.g. Genesis figures into one DS scene.

     

    edp-ground-ds.jpg
    680 x 632 - 41K
  • So far there is nothing that i could not have done with a wavefront-obj export/import.

    In blender i populate the ground by attaching two particle systems. One containing some lumps of grass and one containing mushrooms. This is how it looks in blender; right of the plane the prototype objects can be seen which are used by the particle system.

    edp-ground-part.png
    736 x 355 - 327K
  • I select everything in this scene and call my export-script. In the settings, i check the do-instances toggle. This will export the mushrooms and the grass by generating DS-instances. 

    The second image shows how it looks in DS, when i load the resulting scene-subset into it. Note that the instances of the grass and mushrooms are parented to the ground-plane. This is done to keep the scene-view readable, even if the instances are not necessarily children of the ground-plane. The instances keep the resulting scene-file relatively small. It is only 500k even though it contains rougly 200k polygons (mainly because of the grass).

    edp-ground-setting-part.jpg
    231 x 158 - 5K
    edp-ground-ds-part.jpg
    739 x 632 - 84K
  • I also create some rocks and place them on the ground. Because there are so few of them i do not use a particle system, but use duplifaces instead. When exporting duplis, the parent object must also be selected for exporting the duplis (and therefore it will be exported, too). This is how it looks in blender. The mesh that contains the duplis is colored red. Since this is usually not rendered, i need to make it invisible in DS later.

    The rocks on the right of the plane are not really useful for the scene in blender. But in DS they are created as instances and in DS instances means always "instance of some master-object. And that "master-object" also needs to be present (and therefore exported). When assigning a material on the instances this is also done by using these master-objects. So i put them separated from the main-scene, to make them easier selectable.

    edp-ground-duplis-illu.jpg
    780 x 328 - 39K
  • millighostmillighost Posts: 261
    edited December 2015

    Next i want to include a tree. Most forests have at least one tree. In blender, i used a subdivision modifier on the model to make it look smoother. The first image shows the tree how it looks in blender.

    However, DS in contrast to blender, supports real subdivision surfaces (at least when using 3delight). So i find it always better to use DS's subdivision than blender's modifier. Since the exporter always uses the preview-setting of the modifiers i set the viewport-subdivision to 0 before exporting (by pressing Ctrl-0). It will look very lowpoly like in the second image (which it is), but DS's subdivision will make it smooth again.

    To make the tree more interesting, i add some ivy to it, using blender's Ivy addon. The ivy addon generates leaves and the stem of the ivy. The leaves are a simple mesh, but the stem of the ivy is a blender-curve object. In order to export the curve, the to-mesh option needs to be checked on export. This is basically what the to-mesh option does; it allows for all kinds of blender objects that DS does not natively support (metaballs, nurbs, etc), to be exported as meshes (3. image).

     

    edp-tree1.jpg
    408 x 467 - 21K
    edp-tree2.jpg
    408 x 467 - 20K
    edp-tree2-set-illu.jpg
    234 x 181 - 5K
    edp-tree-ds.jpg
    739 x 632 - 58K
    Post edited by millighost on
  • mjc1016mjc1016 Posts: 15,001
    jpb06t said:

    This generates a DS scene-subset file containing the ground. I can import that in DS using the Content-Library. The image shows how it looks in DS.

    I don't know for how long Studio will still be able to read unencrypted DUFs so I personally would go to a different path: export the thing into some non-DUF format and write DsScript code to import it into Studio (they keep repeating that import/export/scripting won't be removed and, since it is Christmas season and everybody pretends to be good, I pretend to believe that story).

    Forever...well, maybe not forever, but you get the idea.

    User generated content is still duf format (that does stand for Daz User File or something like that, after all).  And we have been told many, many times in the long, tortuous threads about 4.9 that user generated content will NOT be encrypted.  Besides, if the format can be encrypted and still read, it's a lot more work to make it able to reject the unencrypted version. 

    Killing the ability to do so would wipe out all content made before this past summer...so think about that when thinking the encryption scheme is really some covert 'evilness' and that the dev team is a pack of something lower than used car selling lawyers.

  • mjc1016mjc1016 Posts: 15,001
    edited December 2015

    millghost...this is looking great. 

    Sure beats a bunch of individual exports/imports and instancing in Studio (placing them in Studio is not easy).

    A couple of quick questions...

    Are you going to make this available?  I WAAAAAAAAAAANT!!!!

    I have a bunch of scenes from Blendswap that this would be perfect for...and it takes forever doing the export/import of all the individual parts.

    Post edited by mjc1016 on
  • millighostmillighost Posts: 261
    edited December 2015

    Last, i want to add a protagonist into the scene: Here i have created an animal which is some kind of mixture between an elephant and a kangaroo or a duck.It is made of two parts: an armature and a mesh. To export this to DS, i need to select both objects (the armature and the mesh). The exporter looks for a combination of mesh/armature it can convert into a DS-figure. Blender and DS have some differing representation of what a figure is; in blender it is a mesh with an armature modifier, whereas in DS it is more like an armature with a mesh. For simple cases like here, there is no big difference. In more complicated settings with multiple armatures manipulating a single figure or vice versa, there likely will be problems.

    edp-duckophant.jpg
    678 x 474 - 35K
    Post edited by millighost on
  • This is what i get after i load the resulting scene into DS;

    The figure that is created in DS is based on the armature of blender (it is named after the armature, not the mesh).

    Some bones have a different name than they have in blender (with a suffix, like "eye.l-1") for the same reason as above: because there are different entries generated in the resulting file, some with a conflicting name.

    I rotated the trunk down, so the posing of the figure works. The exporter converts the vertex-groups, bones and such to modify the mesh according to the skinning mode. It does not actually convert a full rig. I.e. IK, constraints and so on are all ignored. These have to be done in DS. What i get is a simple FK-rig. The exporter supports the two skinning algorithms Linear-Blend and Dual-Quaternion (in blender the latter is selected by enabling Volume-Preserving in the armature-modifier). Triax skinning and geometric-parametric are not supported (there is no easy blender representation of these).

    Weights for skinning are exported as they are needed by the skeleton, but there is no selection map. This means to select a specific bone, it has to be done in the scene-tree (or in the pose-menu). Simply clicking onto the head of the figure will just select the whole figure.

     

    edp-duckophant-ds.jpg
    739 x 632 - 62K
  • SickleYieldSickleYield Posts: 7,634
    edited December 2015

    Nice work!  Out of all of that I'm particularly interested in the fact that you successfully got Blender to export generated particles to obj.  I don't think the normal wavefront exporter does that?

    Post edited by SickleYield on
  • The figure that is exported does not need to be in the rest-position. It can actually be already posed. Here i have placed the animal on the ground-plane from above (but only the figure is selected). The generated scene-subset then contains the applied pose. The pose of the figure is adjusted so that it looks like it does in blender. The pose is not necessarily parameter-equivalent, because of the different coordinate systems and posing methods (e.g. blender supports axis-angle and quaternions, DS does only support Euler rotations). 

    edp-duckophant-posed.jpg
    678 x 474 - 29K
    edp-duckophant-posed-ds.jpg
    739 x 632 - 50K
  • mjc1016mjc1016 Posts: 15,001

    Nice work!  Out of all of that I'm particularly interested in the fact that you successfully got Blender to export generated particles to obj.  I don't think the normal wavefront exporter does that?

    Not without a lot of hair pulling, chicken sacrifices and general teeth grinding and wailing...it's not totally impossible, but not easy.

  • In order to make the figure reusable for other scenes and to create poses for it, putting everything into one scene-file gives some problems. This is mainly because of the automatic renaming of objects in the scene (i.e. the numbered suffixes this generates). To get rid of them i can create what is called a figure-asset from it. This is what the group-parameter is for. When setting that parameter to some value the exporter will create an additional directory in the DS-library which is used to store all the data the figure uses. The scene-file it exports then will only have references for the actual figure in it, not the actual data. This also makes DS cache the associated data, which can sometimes be tricky to work around. So i usually let the group be empty, until i do not want the to make any more changes.

    Here i set the group to "millighost" and saved the posed figure to a separate file, which i can include into other scenes later. When simply loading the generated scene-file, the bones have exactly the same name like they have in blender.

    edp-duckophant-setting.jpg
    230 x 160 - 5K
    edp-duckophant-asset-ds.jpg
    739 x 632 - 62K
  • By the way. Creating shared assets is possible from all objects, not just figures. The exporter actually tries to export meshes for instance only once, even if they belong to different objects, to save disk space.

    Back to the scene. The last kind of object that can be exported is the camera. Since the version before the last version or so of DS, a camera can contain the dimensions and aspect ration of the image. This can be very useful when matching a scene in DS with a scene in blender. The exporter can export the camera with these local settings so that the point-of-view is the same in blender and DS. i simply select the camera with all the other objects (except the figure, since i have saved the figure as an asset in the previous post).

    First image is the scene from blender when looking through the camera. Second image after loading the scene and the figure and looking through the exported camera.

    edp-cam.jpg
    875 x 533 - 60K
    edp-cam-ds.jpg
    739 x 632 - 62K
  • Nice work!  Out of all of that I'm particularly interested in the fact that you successfully got Blender to export generated particles to obj.  I don't think the normal wavefront exporter does that?

    Oops, i did not notice your response. This is all done without the wavefront obj exporter. This is an addon that writes duf/dsf files directly from blender and can be found here:

    https://sites.google.com/site/millighostmix/home/export_dsf_prop

    With a short reference manual (kind of), but not many examples. Try it out!

     

  • mjc1016 said:

    Nice work!  Out of all of that I'm particularly interested in the fact that you successfully got Blender to export generated particles to obj.  I don't think the normal wavefront exporter does that?

    Not without a lot of hair pulling, ...

    Hair particles (and halos) are actually not supported, only object and group-particles are.

  • mjc1016mjc1016 Posts: 15,001
    mjc1016 said:

    Nice work!  Out of all of that I'm particularly interested in the fact that you successfully got Blender to export generated particles to obj.  I don't think the normal wavefront exporter does that?

    Not without a lot of hair pulling, ...

    Hair particles (and halos) are actually not supported, only object and group-particles are.

    Figured as much.  Converting hair to a mesh is not a very automatable process...

  • Here is a quick ao-render of the example scene (for the fun of it). Completely setup in blender, rendered in DS. Feel free to try it yourself (see 3 posts above for location) and let me know of any problems with it. BTW i use almost always Linux (with wine), so this is probably where that addon works best. I have tried it once or twice with windows (never with mac), so it is quite possible that i overlooked something (backslashes in filenames or something like that).

    render.jpg
    800 x 600 - 61K
  • jpb06tjpb06t Posts: 272

    However, DS in contrast to blender, supports real subdivision surfaces (at least when using 3delight).

    Are you joking? ever hear of the Subdivision Modifier? what Cycles does not (like Iray and a ton of other render engines) is to support micropolygon displacement.

    The whole idea of bringing stuff from Blender into Studio (and not vice versa) is perverse. Anyway, don't feel deterred in your efforts. I will watch, eating popcorn, while you bring into Studio a multi-billion poly particle system <sarcastic grin>. 

  • Joe CotterJoe Cotter Posts: 3,259
    edited December 2015

    Thanks millinghost for taking the time to put together this well done topic complete with screenshots. This type of post takes time and I as well as others I'm sure do appreciate you doing it. :)

    Post edited by Joe Cotter on
  • nicsttnicstt Posts: 11,715

    +1 @Gedd

    Indeed.

    I would also like to add my thanks and appreciation.

  • kitakoredazkitakoredaz Posts: 3,526

    I have not noticed this topic...,,, sadThank you very much  millghost.!!!  It is really good new blender toy for me , as same as hard ops,,,.

    I remember when I first import  genesis from ds  to blender just for making  really silly morph,, I used ,your import add on !!

     

  • SzarkSzark Posts: 10,634

    awesome stuff, thank for sharing millighost

  • nicsttnicstt Posts: 11,715

    Next i want to include a tree. Most forests have at least one tree.

     

    I like your sense of humour.

    Nice job

  • Thanks for your hard work. It will be a nice addtion to blender tool set. Keep up the great work.

  • nonesuch00nonesuch00 Posts: 18,120

    I'm loving the look of, I guess it's a game you are making. Let us know in this thread when you publish it.

  • Nice work!  Out of all of that I'm particularly interested in the fact that you successfully got Blender to export generated particles to obj.  I don't think the normal wavefront exporter does that?

    I don't use Studio and the few times I've tried ... well let's just say my head's a few hairs lighter, shall we? However, just for the record, you CAN export particles from Blender as a wavefront obj. I've done it from Blender to Poser.   Blender will let you transform the particles to a mesh, and once you do that you can export as normal.

  • Great product!  Thank you for the help, this is something I've been trying to get to work smoothly for a while now.

  • mjc1016mjc1016 Posts: 15,001

    I'm having a problem with this script...I can't get to export lately. 

     

Sign In or Register to comment.