UltiMaker uses functional, analytical and tracking cookies. Tracking cookies enhance your experience on our website and may also collect your personal data outside of Ultimaker websites. If you agree with the use of tracking cookies, click “I agree, continue browsing”. You can withdraw your consent at any time. If you do not consent with the use of tracking cookies, click “Refuse”. You can find more information about cookies on our Privacy and Cookie Policy page.
Support for rendering color gradients on mesh and/or slice preview
Posted
(edited)
· Support for rendering color gradients on mesh and/or slice preview
Hey, late reply but good news. What you want to do is exactly how Cura works behind the scenes. When adding a triangle (or quad, or line...), Cura uses setVertexColor() on each of its 3 vertices, but uses the same color so there's no gradient.
What you can do is first create your mesh with your primitives, and afterwards go vertex by vertex changing the color.
For example, I tested it on this cube I built for a project of mine. It's made up of 10x10x10 quads. Mind you, quads are actually just a pair of triangles:
Then I used this code to randomize the color of every vertex:
def PrepareMeshBuilder(self):
...
[Here goes code to add primitives (tris, quads...), calculate normals, etc.]
...
import random
for vIndex,_ in enumerate(self.mb.getVertices()):
r = random.randint(0, 255)
g = random.randint(0, 255)
b = random.randint(0, 255)
self.mb.setVertexColor(vIndex, Color(r, g, b, 255))
And got this:
Edit:
If I were you, I would override or create a custom addFace() method that took 3 colors instead of 1 and applied them directly. This way you could create your triangles and paint them at the same time.
🚀 Help Shape the Future of Cura and Digital Factory – Join Our Power User Research Program!
We’re looking for active users of Cura and Digital Factory — across professional and educational use cases — to help us improve the next generation of our tools.
Our Power User Research Program kicks off with a quick 15-minute interview to learn about your setup and workflows. If selected, you’ll be invited into a small group of users who get early access to features and help us shape the future of 3D printing software.
🧪 What to Expect:
A short 15-minute kickoff interview to help us get to know you If selected, bi-monthly research sessions (15–30 minutes) where we’ll test features, review workflows, or gather feedback Occasional invites to try out early prototypes or vote on upcoming improvements
🎁 What You’ll Get:
Selected participants receive a free 1-year Studio or Classroom license Early access to new features and tools A direct voice in what we build next
👉 Interested? Please fill out this quick form
Your feedback helps us make Cura Cloud more powerful, more intuitive, and more aligned with how you actually print and manage your workflow.
Thanks for being part of the community,
The full stable release of Cura 5.10 has arrived, and it brings support for the new Ultimaker S8, as well as new materials and profiles for previously supported UltiMaker printers. Additionally, you can now control your models in Cura using a 3D SpaceMouse and more!
Recommended Posts
Tyronnosaurus 7
Hey, late reply but good news. What you want to do is exactly how Cura works behind the scenes. When adding a triangle (or quad, or line...), Cura uses setVertexColor() on each of its 3 vertices, but uses the same color so there's no gradient.
What you can do is first create your mesh with your primitives, and afterwards go vertex by vertex changing the color.
For example, I tested it on this cube I built for a project of mine. It's made up of 10x10x10 quads. Mind you, quads are actually just a pair of triangles:
Then I used this code to randomize the color of every vertex:
And got this:
Edit:
If I were you, I would override or create a custom addFace() method that took 3 colors instead of 1 and applied them directly. This way you could create your triangles and paint them at the same time.
Link to post
Share on other sites
odd08 0
This is great! Thank you.
Link to post
Share on other sites