Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@BaldScripter Wow, that's pretty old, right? Would be fun to write, but don't know any C++ 😅
-
Does Assimp read geom files? It's my go-to library for reading 3D data
Also, it's pretty easy to write OBJs on your own, or you can just search for a library that does it given vertex and index buffers. -
@RememberMe what I need is, that c++ program should be able to read geom file, take values of vertex and facet and convert it to obj file. But I get what you mean.
-
@BaldScripter okay just looked at it, geom looks fairly easy to parse actually, get a line -> tokenize -> branch on primitive type
And obj is pretty easy to work with too. Sorry if I can't help much, but this definitely looks doable manually. I would have offered you my obj reader/writer module but it's part of a university project and I'm not allowed to release any code till it's done (yay for nonsensical rules). -
@RememberMe this is my first experience with converter functions. But thank you.
-
@BaldScripter so, a simple strategy
OBJ polygons are defined like so (eg. For a quadrilateral)
v (X coord) (y coord) (z coord)
v (X coord) (y coord) (z coord)
v (X coord) (y coord) (z coord)
v (X coord) (y coord) (z coord)
f 1 2 3 4
Basically all the v lines represent vertices, and they are numbered from the top starting from 1. The f line defines a face and says that it uses vertices 1, 2, 3, and 4. Imagine all the vertices form an array and the faces are defined using array indices
The geom equivalent is
f4 (vertex1 coords) (vertex2 coords) (vertex3 coords) (vertex4 coords) (vertex colour in RGB)
So as a starter, if you geom exporter can export everything as quads for example, then you just need to read each f4 line, write 4 v lines in the OBJ file and one f line with the vertex indices (remember the second quad will use indices 5 6 7 8). -
@BaldScripter one small issue is that geom isn't using indexes so it's going to repeat vertices if you have a mesh. So your OBJ will have repeated vertices too. What you can do is after importing the OBJ into Blender, select the whole thing and use the Remove Doubles command to merge all duplicate vertices, you'll get one unified object then.
This is how I'd start, you'll of course need to add more details as you go.
Fellow C++ Devs, I need your help on this one. I have to write a converter for view in geom format to obj, so I can visualize it with blender or similar program. Do you guys have any ideas or suggestions?
Thanks in advance.
Have a great a day !
question