how can get 3D obj file from canvas in webgl?
Asked Answered
C

0

12

Some question asked about how can use obj in webgl. But my question is how can get/save/export obj or ply file from content of canvas in webgl?! For example how can I get two objects in obj format in following link? http://learningwebgl.com/lessons/lesson04/index.html

Of course all of my webgl target not is simple such as upper link, and and converting gl code from webgl to opengl is so hard and time consuming.

Then I have to get result object from webgl; but how?

Colbycolbye answered 3/1, 2015 at 13:50 Comment(7)
If it's displayed on canvas it should be stored somewhere in JS code, just find that place and download it. It will work unless you want to have generic solution working for any site.Vaso
No, i want to get obj or ply only. i access to all webgl code, but my problem is that, i need 3d ply or obj object can view in meshlab, not 3d object in webgl viewer.Colbycolbye
So you somehow process vertices and normals in webgl, somewhere under the hood you draw triangles. Just find this place and instead drawing triangle save it's coordinates. This will give you something like STL supported by MeshLabVaso
Converting between WebGL and OpenGL is quite simple, having the raw buffers in javascript its also quite easy to write them out as obj files, that is if you know how an obj file looks like. Otherwise I assume you're trying to rip assets you're not supposed to...Stopgap
@LJᛃ for the sake of closing this answer and helping out the nearly 4000 people that have come to this question seeking help, could you give an example? I'm also stuck on this and really need help figuring this out for a work project.Swipple
@zfb what I said 4 years ago still holds, especially the latter part, if there's a different reason I'd be curious to hear what it might be.Stopgap
@LJᛃ like accidentally deleting your source model file and not realizing it after the client requests some changes be made to the model x.x I could see that being a fairly valid reason x_xSwipple

© 2022 - 2024 — McMap. All rights reserved.