Code Monkey home page Code Monkey logo

Comments (8)

virtualritz avatar virtualritz commented on September 17, 2024

I quickly made a file in Wings3D – this is an all quad model. Feel free to use however you want.

knotty02.zip

from obj-rs.

simnalamburt avatar simnalamburt commented on September 17, 2024

Hi @virtualritz! Thanks for using obj-rs and giving me a good idea!

obj-rs have two types. One is obj_rs::raw::RawObj. RawObj is one-to-one mapping of Wavefront OBJ types and Rust. And the other is obj_rs::Obj. Obj is transformed RawObj so that can be easily rendered to screen with OpenGL, Direct3D, Metal, or Vulkan.

I may have not tested all corner cases but AFAIK RawObj does support n-gons. And Obj cannot support n-gons since it's a format which should be rendered directly to the screen.

Maybe I can make some "n-gon Mesh to triangle Mesh" transformer as a separate crate but looks like it's not a trivial work.

About higher order surfaces... yes you are right. They are part of the spec of Wavefront OBJ and obj-rs currently do not support it. I definitely need to implement it.

from obj-rs.

virtualritz avatar virtualritz commented on September 17, 2024

TLDR;
If the crate is this specific, make it apparent in the description so people don't waste time with it when they need other features.

I would suggest to rename Obj to ObjAsTriangles or something like this to make it apparent that this is triangles only. Because this is not apparent. Nowhere in your crate description does it say "This crate is for reading OBJs for rendering on screenif the object is not made out of triangles it can not be read."

This is a new problem btw. If you had any library to read OBJs 10-20 years ago, it would always read the data as-is. I btw. predict that soon graphics cards will support subdivision surfaces. And then all the tools have to support quads and n-gons anyway. :)

RawObj seems to have what I need but then I have to write another bunch of code on top to get the data extracted nicely from that. It would still be great to have a simple API as the current one which does not convert to triangles and gives you an vertices_per_face vector/array.

from obj-rs.

virtualritz avatar virtualritz commented on September 17, 2024

At them moment I use the tobj crate. It has the same problem but it does read n-gons and converts them on the fly. Not ideal for me but I don't have to write code at least. :P

This is what I am using this for: https://github.com/virtualritz/rust-diffusion-limited-aggregation

If obj-rs ever supports n-gons I will switch to your crate.

from obj-rs.

simnalamburt avatar simnalamburt commented on September 17, 2024

I've changed the title to make this issue more clear! Thanks for your comment :)

from obj-rs.

virtualritz avatar virtualritz commented on September 17, 2024

Cool. If you support higher order surfaces, your lib will be outstanding. The only DCC apps that can read & write OBJs with NURBS or patches are Rhino3D and Maya, afaik.

from obj-rs.

virtualritz avatar virtualritz commented on September 17, 2024

Oh, and Blender, apparently!

from obj-rs.

simnalamburt avatar simnalamburt commented on September 17, 2024

5 years ago, I thought that hiding the low level RawObj type and presenting Obj type in the front page would be better. Since I thought that no one will want to mess around with the details of Obj type.

But now, I think it would be better to show the RawObj type to the front, and to show the Obj types separately as a helper. Wavefront OBJ is too complex format and there are so many corner cases that can't be abstracted with simple Obj type. And anyway, it's almost impossible to fully abstract the Wavefront OBJ type because of the MTL specification.

How do you think?

from obj-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.