CREATE and FUCK your own AI GIRLFRIEND TRY FOR FREE
x

Unity Golden Palace G9 graft bone weights are lost after export from Daz to Unity?

wittyminx

Newbie
Aug 7, 2024
17
5
Not sure if this is an issue with the Golden Palace for G9 graft or a general issue with the Daz-to-Unity bridge (possibly also Daz-to-Unreal bridge).

I have a female-morphed G9 figure with GP graft on it, and in "lying with legs spread" pose the graft looks fine inside Daz: the vertices of the graft spread slightly to reach for the contour of the graft for the spread legs.

GP_Daz.PNG

However, after I export the figure to Unity engine and apply the pose using an animation that I also exported from Daz for this pose, the legs are spread but the part of the mesh that corresponds to the GP graft is left unchanged. Only the outer ring of polygons stretches to fill the gap between the default graft's shape and the space that the graft needs to fill. Note how these stretched polygons lose skin detail both in the diffuse/sss textures and the normal map. That's because the outer polygon ring in GP is pretty small by default, and not much space in the UV maps is given to them. And even if it would have more detail, clearly this isn't how the pussy should look like. It should get wider, like it does in Daz.

GP_AfterBridgeToUnity.PNG


I'm not sure why GP doesn't follow the pose in Unity but my best guess is that, during the export, the bone weights on the GP's vertices get lost, at least to the upper leg nodes, because it's a graft. The official Daz-to-Unity (and -Unreal) bridge docs say that they can't export morphs on grafts - that's clear. Probably these bridges also fail to export bone weights?

I'm on Unity 6 preview but I tested: this also comes up in Unity 2023.

My initial idea of a solution was to programmatically set bone weights on the vertices of the graft from Unity, at runtime ( ). However, I don't know what those weights are. Maybe I could find them with the weight painter tool in Daz ( ) ? Still, it's a hell to try to find out the indices of those vertices at runtime inside a game. It's a huge array of vertices and I don't know how they are sorted in the model. Besides, I really don't want to create a new mesh for each pose and break the logic of mesh sharing between instances of models instantiated in the game scene. After all, a mesh is supposed to be a static asset that the game loads once, not edits on the fly.

So I tried solving this in another way (and it didn't work): in Hexagon, create a morph that would deform the GP graft to the exact state it has in this pose, then export the figure to Unity with this morph included, and then export the animation with this morph applied at 100%. Supposedly this should look wrong in Daz (because the GP graft already stretches for the pose, and the morph would even further exaggerate the stretching) but should come out fine in Unity (the morph would fill in for the lack of stretching in the pose). The problem with this workaround is that Hexagon won't let me import a graft with a stretched outer contour. Here is a screenshot of what you get in Hexagon if you try to import GP from a figure that's in a "legs spread" pose. I've selected the outer edges to make it clear that the outer shape of the graft is imported to Hexagon as if there is no pose. Yet all of the inner vertices are stretched properly. I tried moving the vertices of the graft's contour manually (even synced their positions with the positions of the corresponding vertices in the female figure by copy-pasting exact XYZ coords) - yet during import from Hexagon back into Daz they all get reset silently.

GP_Hexagon.PNG

After a lot of attempts with Hexagon (I tried different combinations of settings "Reverse deformations" and sub-options there), the best I'm getting in Unity is this:

GP_UnityWithMorph.PNG

While the graft's inner vertices more or less stretch fine (I guess those still could be improved with some manual edits in Hexagon), the outer ring of polygons has incorrect normals. The lighting gets all messed up - it shows those polygons darkened as if they were on the bottom side of the figure. That's most likely because Hexagon forces the outer contour of the edges of the graft to their default state for the graft, and this rotates the outer ring of polygons to look inside the figure instead of outside. I couldn't find a way in Hexagon to edit normals on vertices. I'm not even sure that data would get carried over 2 bridges correctly anyway.

Any ideas?

If there is no solution, I guess I'll have to leave these stretched polygons as they are. It's just only this pose with wide open legs where it's so severe. Also, strangely, with Dicktator graft I don't see the issue. Maybe it still has to do with how bone weights are assigned in Golden Palace, so it's Meipe who can fix this? I posted this question also on Renderotica's support forum
 
Last edited:

wittyminx

Newbie
Aug 7, 2024
17
5
Update: I wasn't sure if the texture stretching in the polygons was the Golden Palace issue or poor UV re-mapping that I did as I explained in detail here: https://f95zone.to/threads/geoshells-turn-into-unskinned-meshes-in-unity.225406/

Turns out, it's G9's base textures and the UV maps of the G9 figure. They simply don't expect your character to spread legs (because only porn games would need that, and who needs porn anyways).

Here is a screenshot of the original Kat G9 character, in the pose "lying on back with legs wide open".

Kat_Stretching.PNG

There is noticeable stretching when a thin line of pixels turns into a stack of lines to fill a wide polygon. It's not as bad as after export to Unity because at least that outer ring of polygons is not as wide, and the inner polygons partially grow to fill up the space.

With Golden Palace added (no tinkering there, it's just the default geoshell), the situation isn't much different. After all, the majora geoshell is almost completely transparent on those edges anyway:

Kat_GP_TextureShaded.PNG

Kat_GP_WireShaded.PNG

One can improve this a little bit with the "GPL_Majora_Contour Fix 3" morph but it's still not enough:

Kat_GP_TextureShaded_Fix3.PNG
 
Last edited:

wittyminx

Newbie
Aug 7, 2024
17
5
In the end, the sub-perfect solution that I came is to add extra space in the UV maps for the outer polygons.

In my geoshell remapping steps here https://f95zone.to/threads/geoshells-turn-into-unskinned-meshes-in-unity.225406/, in step 1 (creating UV new UV map in Hexagon) I moved the outer vertices of the majora Torso part much wider.

This is the first version of them: the polygons on the sides that connect to the legs are very thin.

Hexagon_UV_Initial.PNG

This is the edited UV map:

Hexagon_UV_Wider.PNG

In step 6 (merging remapped majora, minora and body textures), now the original body textures come with stretching, like this (this is Feminine01_D texture remapped):

Photoshop_Stretched.PNG

I took a piece of Feminine01 body and copied pieces of it with Photoshop stamp tool (brush, big size, with transparency) to replace these horizontal lines on the sides of labia majora with skin-like texture, like this:

Photoshop_SkinCloned.PNG

Need to do this for D, SSS, NM and R maps.

Now, when the figure is imported into Unity and posed, it looks almost acceptable:

GP_AfterThickerOuterPolygonsInUVMap.PNG

The texture on the inner thighs on the sides of the pussy looks almost indistinguishable from the legs. Still, the shape of the pussy itself is weird.

One would want to at least apply "GPL_Majora_Contour Fix 3" (by exporting as part of the animation) but this breaks the normals of some polygons around. Maybe because this morph still doesn't change the outer polygons and simply folds the 2nd ring of polygons and causes them to go behind the outermost ring in those places:

Fix3_BreaksNormals.PNG

If you guys have a better solution, please leave a comment. Thanks
 
Last edited:

DayDreamDream

New Member
Aug 5, 2021
6
0
Hmm,
So the geoshells come in as meshRenders, not skinnedMeshRender so they are a simple mesh that you can only apply as a solid mesh to one bone. So, I get get rid of the shells.
I don't know if this will help, but here's what I do:

Add GP. Go tools ->Node weight is set to on - this will make it look like the p is covered up. The P underneathe the skin, which is a good thing, especially if you just want to give users the option to see genetials or not.

Export. In Unity it'll look like the P is covered. Copy the skin texture on the body, use it to create an Alpha channel, and cut out the area you want showing through - add the alpha texture to the alpha map so that the P can be seen. You can add and replace the Alpha in code to show/hide the P.

As for geoshells - You can just add whatever extra details they provide into the texture, but I tend not to bother.

This is a quick hack - I haven't cut out the area properly but hopefully shows how it works.

1729311262378.png
 

DayDreamDream

New Member
Aug 5, 2021
6
0
Here's one I made for gen 8, not quite properly cut out but fairly close.

1729311600647.png

If your character has body morphs as well, like pregnant, or body building etc, then the golden palace would need the follow those morphs as well
 

wittyminx

Newbie
Aug 7, 2024
17
5
Add GP. Go tools ->Node weight is set to on - this will make it look like the p is covered up. The P underneathe the skin, which is a good thing, especially if you just want to give users the option to see genetials or not.

Export. In Unity it'll look like the P is covered.
Thanks. Do you mean just select Node Weight Map Brush tool in Daz Studio (this makes the whole surface of the figure visible, including the parts replaced by grafts) and export to Unity? Probably I misunderstood because the figure is still exported fully, and tool selection in Daz doesn't affect export.
 

wittyminx

Newbie
Aug 7, 2024
17
5
Yes - and then cut it out using an alpha map.
Thanks. I've tried it again. You are right! Apparently, if node weights brush is selected in Daz (and I also clicked on "Blended weights" in Tools settings for the brush to show the magenta map over the figure), the figure is exported with the body mesh covering the pussy.

I then created the alpha map by doing Map Transfer of the 6 GP surfaces to Default UVs (similar to how sacredsage guy does it in his video ), then in Photoshop edited curves to make the non-black areas completely white and finally inverted the image to get this:

G9Feminine01_Body_A.jpg

After applying this alpha map to the body material on the model, it cuts out the GP area correctly, and also gets stretched correctly when legs are spread. However, the GP itself is not stretched. How do I make the GP's own geometry to stretch after the body?

GP_still_not_stretching.PNG

As you see, the cutout is far larger that the pussy because the body mesh stretches after the legs but the GP's mesh doesn't. I bet it's not a texture issue, it's weights on the vertices.

Actually, I'm not even sure it's weights towards bones. This "blended weights" map that seems to uniformly cover the whole figure (it's just pure magenta color everywhere, so it's value 0.5?) - is this map responsible for the vertices gently following each other? I see the same magenta map on the GP as well. My guess is that, after the export thru the Unity bridge, the connection between the 2 maps get lost because it's a graft. If so, we can't fix it at all, only the guys at Daz who wrote the bridge can. Here are these magenta maps:

Blended_weights_figure.PNG

Blended_weights.PNG

As for the bones, only Pelvis node seems to have any "general weights" assigned in both the figure and GP:
weight_figure_pelvis.PNG

weights_pelvis.PNG

And Left/Right Thigh nodes have no influence on that area at all:

weights_figure_thigh.PNG

weights_thigh.PNG

What I can't figure out is why/how the crotch area gets stretched at all if there are no weights for the thighs there. The only conclusion I have to make is that in Daz (unlike in Unity?) it's not just bone weights but also this "blended weights" thing that makes vertices "blend" (?) and follow each other regardless of bones. I couldn't find any documentation about that. And whatever this is, the bridge must be breaking it for grafts (?) because what we see in Daz and then in Unity is inconsistent.

Well, the bridge can't export morphs on the grafts either (you have to to convert them to full-figure morphs). So, maybe this loss of weight maps (or map connections) is just another limitation (?)
 
Last edited:

wittyminx

Newbie
Aug 7, 2024
17
5
I also noticed that figure meshes animate somewhat worse in Unity that in Daz. My guess is because Unity only has bone weights while Daz has more weight maps and also JCMs which aren't converted at all? The difference is the most prominent at acute angles. E.g. when the character is sitting on knees.

sitting_on_knees_Daz.PNG

sitting_on_knees_Unity.PNG

In Unity, the knee looks deformed and the figure itself feels like it was made from plasticine and then bent, as the mesh follows the bones more crudely than in Daz... So, it seems like parts of the general convertibility problem. Daz just has more stuff, and it can't be converted, only approximated, if at all.
 
Last edited:

DayDreamDream

New Member
Aug 5, 2021
6
0
First of all, we need more dedicated heroes like you, getting pussy into into Unity ;)
I think it's possible to get jcm's to work but it's hard enough that I'll look at them later, if it needed.

When exporting animations, you can remove jcms's.
1729774417384.png
Not sure if this makes much difference, but you can see how it animates without jcm's.

Daz unity bridge
1729775044585.png
Make sure THAT morphs are not on, I think they mess the animations. Make sure "include animations" is ticked
1729779330053.png
 

DayDreamDream

New Member
Aug 5, 2021
6
0
If your really keen on trying to get jcms to work here's some links I found
Jcm controller


Maybe this asset might help: I haven't bought it.


I haven't noticed any stretching with the technique above ie she's got a pregnant morph & vag morph & animating as well.

1729781636283.png
In game shot - not sure if too many players are going to question the lack of jcm - you can draw their attention to other areas.. With that being said though, jcms would be nice, maybe when I go through the "game mastering" phase. The knee joints aren't great.
1729781876104.png
 
Last edited:

wittyminx

Newbie
Aug 7, 2024
17
5
Thanks for the links to the JCM addon and script. I'll check how early testers evaluate the models. If they are unhappy with how knees and other joints look, I'll have to buy that addon and check the scripts (someone in the comments wrote that they optimized the angle calculation code to work 10x faster so I guess that would the be a thing to look into right after purchase).

Anyways, the original problem (loss of blend weights during bridge export?) remains unsolved. I welcome any suggestions.

As I was working further on the game, the main issue with this isn't even the texture stretching (for which I found a semi-fix with edited UV maps and manually populated extra texture pieces). It's the polygon intersections (holes) and incorrect normals when morphs are applied.

Here is what PGPV_Vagina_Open morph does (and you need this morph for penetrations and pussy fingering):

nomals_distorted.PNG

The thick black horizontal area on the right shouldn't be there. It's because a polygon that was supposed to be just a tiny piece of the GP's outline gets stretched to fill a large area and simply has a wildly different normal than what polygons were supposed to have in that area. And the widened labia exacerbate the issue.

nomals_distorted_with_wireframe.PNG

Also notice how on the left there is an abrupt switch from the deep shade of the leg to the brightly lit band. Because instead of a 1-polygon-thick band there should be some 4-5 polygon-thick transition there. Textures can't fix that. Only proper weights on the vertices for them to move into correct positions. Or some new mesh to replace the GP piece with something that's already pre-morphed into the correct shape.

My latest idea of a fix was to export the figure with stretched legs to Blender instead of Hexagon. But it seems that even the Blender bridge breaks the weights. The pussy similarly ignores the pose. Moreover, as you see, the clit is wildly off (it stretches to where it should be in A-pose). The whole pose of the figure is actually broken. Well, Daz docs say in many places that one shouldn't export posed figures.

blender.PNG
 

wittyminx

Newbie
Aug 7, 2024
17
5
Update: I managed to get a GP prop of proper shape. For that:
  • export the whole (posed!) figure from Daz as an OBJ file,
  • import the OBJ file in Hexagon,
  • manually remove everything there except for the GP mesh. Note that in the OBJ, both Breastacular and Golden Palace come mixed into a mesh named "Eyelashes" (yep...). It has no eyelashes however, and the mesh has 2 "islands": breasts and pussy.
  • using vertices selector, select the whole breasts island, delete. This only leaves the pussy area. Note that UVs look broken in Hexagon. But it's okay! Ignore this
  • save as a new OBJ
  • import that OBJ in Daz. UVs will be fine!
  • in Daz, imported OBJ prop gets wrong materials, it's Daz default "plastic" shader. Note that the prop looks too bright compared to the normal GoldenPalace on the figure. You need to copy materials from the GoldenPalace node attached the figure to the independent prop (before that, you must have completed all the steps in my other guide https://f95zone.to/threads/geoshells-turn-into-unskinned-meshes-in-unity.225406/ to have properly merged textures on the GoldenPalace itself). Open File->Tabs->Shader Mixer. You can dock this window together with Viewport. Select GoldenPalace node, open Surfaces tab, select GP_Labia Minora surface, then in Shader Mixer tab, in the top bar inside that tab, press File->Import from Scene... This will load the shader into the Mixer (it looks quite similar to Unity's Shader Graph window). Then select your prop node (which was auto-created when you imported the OBJ), click the cyan Apply button in the bottom-right corner of Shader Mixer.
  • repeat this 5 more times, for each of the surfaces in GoldenPalace. Make sure that the prop now looks the same as GoldenPalace on the figure.
  • select the prop node and export the prop to Unity as a Static Mesh
  • now, in Unity, you need to show the prop instead of the figure's own GoldenPalace mesh region of body. When putting the figure into the pose, one way to hide the pussy on it is simply to set Alpha value to 0 (or just below the Alpha culling threshold you have there) on all of the 6 materials coming with GP: GP_LabiaMinora, GP_Rectum etc.
  • instantiate the prop in the scene
  • in my game, I dynamically set textures for character bodies and the pussies depending on the race of the character, so I also have to copy all material settings (D, SSS, R, NM textures) from GP's materials to the prop materials. For that, in uDTU.SSS shader that comes with the bridge, in Graph Inspector dialog, tick the checkbox Allow Material Overrides.
Here are some screenshots I made on the way:

OBJ imported into Hexagon after all items in Scene Tree exc Genesis9Eyelashes have been deleted (still need to delete the Breastacular island, UVs on GP look messed up but it's okay):

hexagon_obj_import_after_deletions.PNG

Posed GoldenPalace imported back into Daz as a prop. Note that textures and UVs turn out fine.

obj_after_import_to_Daz_UVs_correct.PNG

Posed GoldenPalace in my later attempts, after export to Unity as prop. It has 2 morphs applied: GPC_GenScaleZ2 100%, PGPV_Vagina_Open 20%. Actually, these morphs conflict with each other a bit, and meshes overlap at the bottom - so I moved those in Hexagon before saving the OBJ.
Oh and there is also PGPA_Anus_Contraction03 100%, GPV_Vagina_Shrink_1 100%, GPA_Colon_Natural_Pose 100%... Anyways, with a prop, all those become immutable and unanimatable.

GP_unity_target_lying_F_vagina_open_20.PNG

And the result, on the black and the white figures:

GP_in_Unity_as_prop.PNG GP_in_Unity_as_prop_white.PNG

First off, there is still the strong color difference between the pussy and the legs + some stretching. That's simply because of the textures. See my post closer to the top how to edit the UV maps to insert okay-looking skin patches for the stretched polygons. I guess one would also need to make those edges darker to match the inner thigh color.

The second issue is bad: GP doesn't exactly match the cutout area. Because after export to Unity, weight maps are simplified/approximated/lost, and legs simply have a slightly different shape in Unity compared to Daz.

Further ideas to try out: go thru every vertex on the outer contour of the prop, locate matching vertices on the body and copy vertex position to close the gap? Maybe this can even be done with editor scripts. Since the vertices would have to be moved on a shared mesh asset.
 
Last edited: