Set per-vertex colour
See original GitHub issueApologies 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:
- No textures are used;
- No textures hence no big dial with materials as they will only set the colour;
- Performance is a big dial, we work with a grid of 720 rows on 1016 columns;
- 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:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
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?
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.