Skip to content
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

Color the faces directly #20

Open
robinenrico opened this issue Feb 8, 2021 · 8 comments
Open

Color the faces directly #20

robinenrico opened this issue Feb 8, 2021 · 8 comments

Comments

@robinenrico
Copy link

Thanks again for this really fast ray tracing package.

I was wondering if there is a way to color the faces directly instead of coloring via the vertices.
In other words, we can update the color of the mesh by running:
rt.update_mesh(c=np.array(n, 3))

However, this requires an array of colors for the vertices, is there a similar approach where c is a color for each face id?

@robertsulej
Copy link
Member

Hi,

If you need only a flat shading then you can use the face index buffer and display it with a color palette, like here.

If you need one of the shaded materials, then I would need to add shaders with a slightly modified logic, that takes color from the face index and applies it instead of interpolated colors from vertex indices.

Let me know what is your use case.

@robinenrico
Copy link
Author

Thanks for your fast reply!
I indeed looked into that particular example.

If I'm correct, this will create a 2D image with a color palette based on the face ids.
However, I'm looking into coloring the mesh. This will make sure that the mesh is colored during the 3D rendering.

@robertsulej
Copy link
Member

OK. I'll prepare the next release soon. Will try to include there also the modified shading of meshes. Stay tuned ;)

@robinenrico
Copy link
Author

Thanks a lot Robert, that would really help!
Without trying to rush you, do you have any idea on when you plan the next release?

@robertsulej
Copy link
Member

1-2 weeks, I think. :)

@robertsulej
Copy link
Member

I have to make a minor release tomorrow, but did not manage to include new shaders. Sorry for delay! I'll push updates for you in the next release, which should be again in 1~2 weeks.

@robinenrico
Copy link
Author

Hi Rober, did you already find the time to look into the new shaders?

@robertsulej
Copy link
Member

I was working on that code for a while - changes in the shaders and in the Python API are minimal, but... there is a problem in between. Color buffer size now follows the number of the geometry primitives. For meshes, wireframes and curves it is the number of vertices/nodes. A mesh with some fixed number of vertices can have any number of faces - this does not fit the design of the mesh geometry code. I don't think repeating the whole structure with only differently managed color buffer is the best option, so I still need to figure out how to implement this request.

Sorry, it is a bit more than I thought at the beginning!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants