-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vertex colouring #1
Comments
@alexobviously Thank you, I'm happy you liked the package. |
@alexobviously there currently isn't any support for that flavor of specifying colors in the object file. However there is support for multiple materials which can be used to color sets of vertices independently. |
Hey, thanks for replying so quickly and sorry it took me a while to get back to you, I was working on another project. I've had a look at the parsing code for vertex and I'm sure I can easily add the ability to parse vertex colours without affecting the normal behaviour at all. For rendering, I'm not 100% sure that it will be trivial, but I see that the Vertices class in flutter has this definition:
so I'm fairly sure it'll be possible.
Yeah, in the official .obj definition it doesn't exist, and I'd maybe even also say it's not a very good way to do it, but it is relatively common (there is even support by default in OSX quicklook). In my case, I'm working with a long and complicated tool chain starting with 3D cameras that generate these vertices with colour in that way by default. |
@alexobviously it should be pretty easy to implement the parsing as you mentioned as long as I can keep compatibility with the spec unambiguously. I have some time this week, I'll try to submit a PR if that's okay with you @nythrox. |
I've tried to implement this here: https://github.com/alexobviously/vertex It sort of works - colours are getting parsed and assigned but they're not the right colours. The actual colours should be quite dark but I'm getting very bright whites and blues, and it looks like only some of the faces are being rendered. I replaced the movable star in example01 with a vertex coloured model. If either of you can figure out what's going wrong here I'd appreciate the help 👍 |
@alexobviously I think there is a base lighting added to the vertices, maybe it could be that? |
Here in this block of code https://github.com/alexobviously/vertex/blob/master/lib/mesh.dart#L151 |
Lighting sounds like about the right thing here, but I'm not sure that anything in that bit of code would affect it? |
I've updated my version of the repository with an 'example03' to make it simpler to compare. This is what I get at the moment. There seems to be two problems. Firstly, some of the faces seem to be invisible. I'm not sure what's going on there. Can either of you see anything wrong? The other problem is that actually the colours are backwards! When I set red to 0, for example, I get a totally red model. (This is also useful for seeing how some of the faces are not getting drawn). |
@alexobviously sorry man... I really have no idea what could be causing the problem, maybe you could try reaching out to the gskinner team but it's a long shot |
Are the faces in your mesh triangulated? It's not just the colors that are off from what I can tell in your screen shots, the geometry is also incorrect. Currently the obj loader only supported triangulated faces. |
Hi! Firstly, great package you have here. The control/scene system is really good and solves a lot of problems I've been having with other packages.
So I was just wondering if you had any plans to implement vertex colouring for obj files? (Or if it's already there and I haven't found it?)
If you aren't aware, there is a flavour of obj that allows for vertex definitions like:
v 1220.094482 -572.500000 177.713943 0.984314 0.764706 1.000000
where the last three parameters are RGB.
It's not part of the official specification, but there are some applications (in my case, a Unity exporter plugin) that export in this format.
The text was updated successfully, but these errors were encountered: