question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Set per-vertex colour

See original GitHub issue

Apologies if same question already exists, could not find one. So I have a hex grid where hex is an object. So grid is made of hex objects (models). The goal is to have hexes have different initial colours set not through materials but through vertex colours (that’s due to feature to change hex colour on mouse click on that hex). It should work sorta like this:

You load in few images, based on those images tool “compiles” a hex grid map whereas each hex has a pre-calculated colour. I know this can be done with material but the point is, user should be able to change the hex colour by picking the colour he wants and clicking on the hex to change it’s colour.

This is where I want to write hex colour changing code. Material does not work because none of sender or event args provide a set-able material property but instead - Color property.

private void OnHexPressed_Mouse3DDown(object sender, MouseDown3DEventArgs e) { }

Additional info:

  1. No textures are used;
  2. No textures hence no big dial with materials as they will only set the colour;
  3. Performance is a big dial, we work with a grid of 720 rows on 1016 columns;
  4. Hex Grid is only a set of hex objects (a model made of 6 vertices with no TexCoords or anything else but vertex positions)

I’m looking forward to any alternative approaches if vertex colour is not a solution here.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
holancecommented, Jan 11, 2019

Are you using HelixToolkit.WPF or SharpDX version?

In sharpdx version, you can use MeshGeometry3D.Colors to set per vertex color, then use VertColorMaterial to display per vertex color. Maybe you can attach some image about the grid you are talking about and what kind of effect you want to achieve?

0reactions
MrJoxcommented, Jan 12, 2019

I no longer use BatchedGeometryModel3D. Instead I use MeshGeometryModel3D just as you suggested. The only reason it seems to work properly is because I do not remove duplicated vertices.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I set and get the vertex color property?
Behind the scenes the Vertex Colors are not stored in the data per vertex but in a Vertex Color layer, which stores vertex...
Read more >
Mesh:setVertexColors - LOVE
Mesh:setVertexColors ... Sets whether per-vertex colors are used instead of the constant color when drawing the Mesh (constant color being love.
Read more >
Multiple Vertex Color Sets
Hi guys, I am planning to use multiple vertex colour sets for different ... Unity's mesh format only supports a single color per...
Read more >
Using Vertex Colors - YouTube
In Autodesk Maya, rendering with Mental Ray. This video addresses painting Vertex Colors on a Mesh and rendering them.
Read more >
ios - SceneKit per vertex color
I've been playing with SceneKit, but I can't figure how to create a per vertex color geometry. So to be more precise, I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found