• To improve security, we will soon start forcing password resets for any account that uses a weak password on the next login. If you have a weak password or a defunct email, please update it now to prevent future disruption.

Daz Vertex normal

nexer

Forum Fanatic
Feb 5, 2019
4,543
17,276
Hi,
Does anyone know where to find the vertex normal for genesis?
We have this two files: .duf/.dsf. Inside I can't find anything about vertex normal.
I suppose that using the vertices, DAZ makes the calculations to get the vertex normal. Am I right?
 

Elohiem

New Member
Aug 18, 2019
10
7
Not sure of your intentions here, you can export your model to .obj format. The vertexnormals start with 'vn'.
 

nexer

Forum Fanatic
Feb 5, 2019
4,543
17,276
Thanks,
My intention is to use vertex normal in a script, their direction out.
I knew this, but you have to export it as .obj and import it later.
I was interested for Genesis. When you export it, the .obj file has all the (vn). I suppose that DAZ makes the calculations, because inside the .duf the values of the vertex normal are not explicit.
 

Elohiem

New Member
Aug 18, 2019
10
7
Indeed, perhaps you can calculate them inside your script if that's within your time-budget ;).

You can assume the normals to be perpendicular to the face of the plane and construct the face itself from the vertexpositions located inside .dsf. Then for a given point of a triangle (where 2 or more faces meet) take the average of the neighbouring facenormals.

This could be an accurate enough solution depending on the usecase, but these normals are later interpolated during rasterization.
 

nexer

Forum Fanatic
Feb 5, 2019
4,543
17,276
Yeap. DAZ has an internal script which collect all data and write an .obj file. So, I don't know, yet, if an user using Script IDE could access it. :unsure:
More, I have to try, if using DAZ script IDE can I read a local file. If it will work, first step: Export a Genesis as .obj and second step: read the .obj saved file and connect (vn) with each Genesis vertex.
 

nexer

Forum Fanatic
Feb 5, 2019
4,543
17,276
I think I find something. It's in Python

Here is the script.


I will take a look at, it's for Blender but, at least, give us an idea about.
 

Elohiem

New Member
Aug 18, 2019
10
7
The .obj format is an open standard, thus rules are not set in stone. Anyone can give it's own interpretation, and so does Daz.

I can share a snippet of my project where I specifically target Daz. And I wrote it in C# if that's your thing :).
With this snippet you can read a .obj and have all the vertices and normals for every face in a list called 'ftuples'. Hope that helps you somewhat further.

I will also include a script to export a model from Daz to .obj with all the right settings.
 
  • Love
Reactions: nexer

nexer

Forum Fanatic
Feb 5, 2019
4,543
17,276
The .obj format is an open standard, thus rules are not set in stone. Anyone can give it's own interpretation, and so does Daz.

I can share a snippet of my project where I specifically target Daz. And I wrote it in C# if that's your thing :).
With this snippet you can read a .obj and have all the vertices and normals for every face in a list called 'ftuples'. Hope that helps you somewhat further.

I will also include a script to export a model from Daz to .obj with all the right settings.
I'm with C++, but THANKS A LOT ;) . I will "translate" it.:love:
 

Elohiem

New Member
Aug 18, 2019
10
7
I don't have genesis 8.1, but i do have genesis 8. The way daz stores the model (data\DAZ 3D\Genesis 8\Female\Genesis8Female.dsf) is almost exactly to that of .obj. You could skip the step of exporting and directly parse this file.

Take a look:
You don't have permission to view the spoiler content. Log in or register now.

And the corresponding indices to make the triangle:
You should skip the first 2 columns since they are used for group ID's.
You don't have permission to view the spoiler content. Log in or register now.

Might I still suggest to do a toy example with a debugger before doing it in Daz or you will pull your hair out :p.
 
  • Love
Reactions: nexer

nexer

Forum Fanatic
Feb 5, 2019
4,543
17,276
I will :ROFLMAO:. It's the same G8/G8.1.
I need VN, vertex and their coords are all there.
 

Elohiem

New Member
Aug 18, 2019
10
7
Indeed you need the vertexnormals. In that case you may be able to infer them from the vertexpositions.
You will likely not be able to verify that the normals that you assign and compute for each face are the correct ones unless you have a way of visualizing that onto the model :confused:.

I'm contemplating if i should give this excercise a go myself :p .. after work :mad:

Just a few questions:
  • Do you wish to edit vn's or just be able to read them?
  • Does g8/g8.1 have any morphs/poses applied?
  • Is a list of unordered vn's per triangle the expected output?
 

nexer

Forum Fanatic
Feb 5, 2019
4,543
17,276
Indeed you need the vertexnormals. In that case you may be able to infer them from the vertexpositions.
You will likely not be able to verify that the normals that you assign and compute for each face are the correct ones unless you have a way of visualizing that onto the model :confused:.

I'm contemplating if i should give this excercise a go myself :p .. after work :mad:

Just a few questions:
  • Do you wish to edit vn's or just be able to read them?
  • Does g8/g8.1 have any morphs/poses applied?
  • Is a list of unordered vn's per triangle the expected output?
Outside of DAZ we have .OBJ, I don't know .FBX never opened a fbx file.
Inside of DAZ, we have this:
You don't have permission to view the spoiler content. Log in or register now.
  • Reading them would be enough, but if I can read them inside, editing would not be a problem. What I'm interested in is IN/OUT the body.
  • G8 has a Tpose, G8.1 has a Apose. If you use the last Public Build, G8.1 is inside the G8Female folder.
  • the code above gives you the index of the vertex normal.
 

Elohiem

New Member
Aug 18, 2019
10
7
FBX is proprietary and as far as I know you need to pay to be able to parse that.

I never tried editing the mesh within Daz, but from your code I quickly tried:

Code:
print(oMesh.getNormal(index));
It gives a valid output ranging between [0, 1]:

Code:
[0.238972,0.961207,0.125559]
Which seems to be what you are after? (documentation seems to be missing)
 
  • Love
Reactions: nexer

nexer

Forum Fanatic
Feb 5, 2019
4,543
17,276
getNormal. :unsure: Where you get.this. :ROFLMAO:
I have tried all kind of combinations ;). Thanks a lot.
Right now I have to check VN .obj with this getNormal:
1611661036193.png
 

Elohiem

New Member
Aug 18, 2019
10
7
From this post:

I saw getVertex(), so naturally the other one should be getNormal() :LOL:
 
  • Like
Reactions: nexer

nexer

Forum Fanatic
Feb 5, 2019
4,543
17,276
So as not to drive me crazy, checking using a cube. Look what we have here:
1611663625177.png
* an error: Last IndexNormal is 23.

And the result using DAZ-Script:
1611663682908.png

We are 100% that .OBJ uses index tu write VN in an .OBJ file. First line who starts with vn has Index 0.
What can I say. Good Job :ROFLMAO:
 
Last edited:
  • Like
Reactions: Elohiem