Sagan: A DAZ Studio to Blender Alembic Exporter
TheMysteryIsThePoint
Posts: 2,946
Get Sagan
Get the Sagan Alembic Exporter
Note: Currently, after installing, you must manually configure Sagan to appear in DAZ Studio's menu. Go to Windows | Workspace | Customize... and see the attached image. Basically, find Sagan on the left-side pane under Miscellaneous, and drag it to the desired location on the Menus tab of the right-side pane. Under Main Menu Bar | File, for example.
You may also want to right-click on Sagan on the left-side pane and select "Change Keyboard Shortcut" and choose something like Alt-S.
Torkuda's tutorials
The actual process of exporting including how to properly link materials
Bug/TODO list (not necessarily in order):
- Export only selected node, and presumably its children.
- Derive from DzExporterAction? DzActionMgr?
- Look in SDK docs FAQ section for info on how to save settings, i.e. DzSettings class
- Implement applet to extract hair cap geometry.
sagan_config.png
1377 x 1322 - 282K
Post edited by TheMysteryIsThePoint on
Comments
@Padone
The bug you found is interesting. Does the corruption in materials always stop for you on the frame number, equal to the framerate? I exported at 30fps and the corruption stops at frame 30. I re-exported at 24fps, and then it stops at 24. Blender also stops complaining about faceset overflow in the console, which I can't believe is a coincidence. I did change the way the time sampling is done, but it's so simple, still seems like it should be correct, but this can't be a coincidence.
Can you please verify this for me on your system?
Thanks!
Maybe the mods can merge the two? As long as the merged version remains in the Blender discussion area which is why, I assume, you created the new thread.
just put your Google drive links, description, instructions etc in your first post
You did not start the other thread, it was not your thread
you replied to it
your exporter deserves it's own thread
Well, it did before I messed it all up :) I've removed the download link for the broken version and will update after I figure out what is going on with the facesets corruption.
@Padone asked. Nothing happened.
@TheMysteryIsThePoint
I can confirm that the material issue goes away at the frame equal to the frame rate. That is, if I set fps = n then only the frames from 1 to n are affected. I also tried to export a G8F without eyelashes to see if this was related to having multiple figures in the same scene (eyelashes are a separate figure), but this didn't fix the issue.
I found an invalid bug report explaining that the "face set" feature is needed for materials, I don't know if this may help.
https://developer.blender.org/T72863
How do you install/get it to work? Thanks for your coding prowess to address Daz's largely useless plugin!
The request needed to come from you. We can lock the old thread or merge and move here as you wish.
Thank you for that Richard, but I did not start the thread either...
Doin' what we can.
You just copy the DLL in the zip file to the Daz Studio plugins directory.
Note that we're in an *ahem* transition period where I somehow caused a severe regression and had to roll back a few versions until I can figure out the bug, which is strange one. It doesn't support any of the materials stuff we've discussed. I apologize for not being a competent Win32 programmer and not knowing how to set up proper unit tests that would have caught this.
Just tested it in C4D. It works (and is shockingly fast), but no textures.
No matter, the fact that you acknowledge this means your coding prowess will only get better with every new line! ;) Thanks again for making this plugin!
Thank you very much for your note.
But as a UNIX developer, getting better at Win32 is actually what I am afraid of :)
OK, great! It seems like Daz Studio stands in contravention of the rest of the world with regard to vertex order.
No textures is to be expected, but it at least preserves the material zones and UV mapping so that textures could be reapplied, right?
And to get around a Blender peculiarity, I don't export normals for animation. Do the normals look OK, or does that hack need to be a Blender specific thing?
Let me know and we'll make everything work.
Noted about the textures. Oddly, on my main computer, C4D locks up whenever I try to play an ABC animation if there's anything more than the figure in them, and since that's where my Cycles 4D licence resides, I can't texture it the way I want to. Otherwise, it looks fine. Here's a render from my Surface, untextured, with the standard renderer.
Also, FYI, C4D also uses centimeters, so you could just add a C4D designation to Maya and whatever else.
Done. It'll be in the next release, but I really need to fix the materials bug... hopefully this weekend.
Has it been agreed that this is an issue or is it a matter of selecting what to export? This is where I gave up because I had at least three figures coming across - it seems like anything that creates a shell (i.e. geografts) is seen as another figure but I don't know enough to say that for sure.
@marble At this time the material bug has not been fixed. Then shells and geografts are yet another matter, I guess @TheMystery may work on them once the materials are fine.
I'll put it on the list, but it'll be a rather invasive change because geografts are apparently based on facet groups, while the rest of the exporter is based on material groups. I'm not saying it can't be done, just that I'd like to have unit tests in place before I attempt to do it.
But for now, can't you just ignore all the surfaces of the duplicates you don't want? I thought that worked fine.
I did try clicking all sorts of Ignore boxes in your exporter but still could not avoid getting multiple figures in Blender. I've since noticed that the geograft I'm using from Meipe has an Add-On with an option to "Flatten" which seems to eliminate the shells but I have not had chance to test this as yet. Nevertheless, I am fairly convinced that shells are an issue but if you have a workflow which I am not understanding, please do elucidate.
[EDIT] I attempted working through the Flatten option but it just does not work. I checked in the R'otica forum and it was reported a year ago but no fix. Pity.
OK, 1.13 is up and I believe it fixes the wierd materials issue.
Sagan versions
Thanks to everyone for testing and reporting bugs.
But there is still strange behavior that I do not understand. Now, the exact opposite of the bug that @marble found happens: Now, if the viewport and the render subD are equal, Daz Studio always returns the subd cage resolution, regardless of the viewport subd setting. At a later time I will probably have the exporter ensure that that's never the case for all nodes.
I'll get back to the previous features if no one finds any bombshells with 1.13.
@marble So, I've been doing some reading, and I think that I might be beginning to understand how geografts work. When the core functionality is working, and I've got a test framework in place, I'll try to add proper support. In the mean time, try ignoring the material groups on the character that correspond to the geografted item.
if it's any consolation geografts break the UV mapping in Carrara and possibly one of the reasons DAZ gave up on developing Carrara, so they are a problematic thing even in other softwares owned by DAZ so cannot expect them to work well in all other softwares
The Diffeo Importer seems to have it figured though with the option to merge into a single mesh (I think). I'm pretty clueless with materials and UV maps so I will just have to let the experts figure it out. I have faith in them though
@TheMysteryIsThePoint
Tested with daz studio 4.11.0.383, sagan 1.13.0.0, blender 2.83.4, diffeo commit b188e28 latest available today aug 17.
As for sagan 1.13.0.0 it works better. That is, the undressed G8F works fine and the material issue is fixed there. If you don't mind to explain I'd also be curious to know what the issue was caused by. Then unfortunately if I try a dressed G8F it seems the dress textures are lost. Below there's the standard bardot outfit I used as example. Test scene included.
As for the subd issue I can't reproduce it. That is, the viewport subd seems always exported correctly here. I'm using daz studio 4.11 though that's more stable, I don't know if this issue could be related to 4.12.
Exporting now, which is decidedly less swift than it was previously. An acceptable change if it keeps the materials, though, and it's still going to be much faster than using the bridge. I'm not crazy about how it forces you to save the scene before exporting, but again, acceptable. The interface is much cleaner and easier to digest. I'd prefer if it still showed up in the DS menu as Alembic Exporter, even if you prepend "Sagan".
I'm still not getting any textures in C4D. Which parameters should I have checked? I tried twice, once without separate checked, and one with, and I get nothing either way.
@Padone
Thank you again for your testing efforts and the .duf.
Once again, because the SDK merely provides the header files with little to no explanation, I cannot be 100% sure why it works, or whether it is going to break again in the future. I threw engineering to the wind and became a With Doctor who spent several hours trying every single permutation of the things that need to be done to export until I found a combination of doings things and not doing things that seemed to always work.
The fix was to never explicitly call update() nor finalize() on any nodes, and just allow the QApplication::ProcessEvents() calls, necessary to update status messages etc., to re-evaluate the pipeline. I do not understand why, but this was causing the first frame, and only the first frame, to return the subd cage geometry. Alembic does not care if the vertex/face count changes between frames, but I suspect that Blender reads them from the first frame, and expects them not to change. But since the second frame exported has some power of 4 times as many faces, Blender correctly complains that it found a face index beyond the number of faces it thinks there are, and the indices that determine which face belongs to which material group are all wrong. But I have no idea what any of that has to do with the framerate.
As for the lost textures, this is the same problem as before. I am not sure where the uv map comes from, or why it is different when referenced from the Alembic imported model. Just setting it back to the one in the drop-down fixes it, but then the texture is lost on the Diffeo model. After you implied it was a Blender bug, I tried using the uvmap from each material zone, but it made no difference. I need to research this a bit more before I kill the flea with a sledgehammer by outputting a script to adjust all the normal maps' uv map. Any insight you have is appreciated.
Thanks again.
@gordig
There's some wierd differing behavior between Daz Studio versions, according to @Padone. Not much I can do about that. When it was "fast" it was probably erroneously exporting just the subD cage, not the subdivided model.
The code is made simpler when it has the guarantee that the scene has a scene name, i.e. that it has been saved once. The same is true for saving the scene. But since Daz sometimes erroneously reports when the user has made changes, on the Materials tab, I've included an option "Process Even if Scene is Dirty". But then it is your responsibility to ensure that the materials in the scene file match what you've got in memory.
And yes, everyone wants the menu option under File, I just haven't gotten around how doing it. Daz, for some reason, did not see to include a DzExportAction class in the way that they included a DzEditAction class, and so I'll need to know all the details of the File Menu which I didn't have to know for the Edit menu. It will eventually get there, but there are other options that I'd likt to have working first. But I'll change the name as you suggest right now.
@Gordig
I still don't know if you are referring to the textures not being applied, or if the material zones (or whatver they are called in C4D) are simply not being preserved.
No textures are applied because Sagan doesn't do material conversion at all. For Blender, it can re-use the textures that the Diffeomorphic plugin converts. This obviously won't work in C4D. Unfortunately, there's nothing I can do there... the task of material conversion for C4D is a whole separate endeavor. But there's got to be a way to reapply the textures with a script to reduce the pain of having to do so. If you could, by hook or crook, obtain such a script that re-applies a single texture, I could use it as a model to output a script that will re-apply all of them. We could figure this out together if it is important to you.
If it's just the material zones that are lost, then C4D is not respecting the material zones in the Alembic file in the same way Blender does. There is not much I can do there, either, not owning C4D at all.