[Python] .obj to raw vertices converter with normals in python

Discussão em 'Python' iniciado por Stack, Dezembro 22, 2024.

  1. Stack

    Stack Membro Participativo

    Iam asking for your help again. I want to make a script with python that takes an .obj format file of vertices and normals and exports 2 files with the vertex coordinates and another with the normal coordinates of the normal

    v 1.900470 2.777519 -1.000000
    v 1.900470 2.777519 -3.000000
    v 2.095561 2.796734 -1.000000
    v 2.095560 2.796734 -3.000000
    v 2.283154 2.853640 -1.000000
    v 2.283154 2.853640 -3.000000
    v 2.456040 2.946049 -1.000000
    v 2.456040 2.946049 -3.000000
    v 2.607577 3.070412 -1.000000
    vn 0.0980 -0.9952 0.0000
    vn 0.2903 -0.9569 -0.0000
    vn 0.4714 -0.8819 0.0000
    f 2//1 3//1 1//1
    f 4//2 5//2 3//2
    f 6//3 7//3 5//3


    and export them in the format of:

    vertizes

    verxex1.x,verxex1.y,verxex1.z, verxex2.x,verxex2.y,verxex2.z,verxex3.x,verxex3.y,verxex3.z,


    normals:

    normal1.x,normal1.y,normal1.z, normal2.x,normal2.y,normal2.z, normal3.x,normal3.y,normal3.z,


    with the sequence of the faces as they appear. Hoping i can get some sample code if someone has already implemented it in order to save some time.

    Thank you very much!!

    Continue reading...

Compartilhe esta Página