Gradient Color for whole model

Jan 27, 2016 at 12:20 PM
HI ,

This is very nice project.I am currently using 7delaunayWPF project.
Have a question here.
How to give gradient color to whole polygon.Instead of giving color to each tetrahedron.
I want to give gradient color(mixture of 2 or 3 colors) to whole polygon(model3dgroup).
I tried a lot to calculate points.But didnot worked.I want similar like this-

Thanks & Regards,
Jan 28, 2016 at 10:50 AM
Hi Bhupesh,

to my knowledge WPF 3D can't do "vertex colors" the way OpenGL or D3D can. As far as I know there are two options using WPF 3D:
  1. Generate a gradient texture that you will map to the geometry.
  2. Use a gradient brush -- something like should work.
Alternatively, you can use OpenGL in .NET as well where you can just assign vertex colors to each vertex and OpenGL will interpolate the colors for you. Or just write a simple vertex shader (which does not seem to be possible in WPF3D either).

Jan 28, 2016 at 1:17 PM
Hi DavecZ,

Thanks for replying.I have also tried this solution earlier.
But problem is,in this project each tetrahedrons are colored and combined.
So my question was-is there a way to color whole model3dgroup(combination of tetrahedrons).

What I mean is-
I want to keep color white for each tetarhedrons.After combining all tetrahedrons I want give a color to whole set of model3dgroup.

Thanks & Regards,
Jan 29, 2016 at 8:39 AM
Well I guess you just want to color the convex hull then. In that case, use the library to compute the convex hull of your points (or you can extract the triangles from the Delaunay triangulation -- these are the triangles that have no neighbors -- it's you leave out the vertex in a tetrahedron whose adjacency is set to null and you get the triangle). Then you apply the gradient brush to the hull model which you will only make visible when the geometry is collapsed.

Jan 30, 2016 at 2:31 PM
HI David,

Thanks again for replying.
I just want help for this line-

Then you apply the gradient brush to the hull model which you will only make visible when the geometry is collapsed.

Could you please give an example how to apply gradient brush to the hull model.
Feb 3, 2016 at 1:30 PM
Feb 5, 2016 at 8:48 AM
Thanks a lot David.Your previous reply worked.I calculated convex hull points of polygon and then applied gradient brush through texture co-ordinates.

Thanks Again,