Gradient Color for whole model

Jan 27, 2016 at 1: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-

https://www.google.co.in/imgres?imgurl=http://www.openprocessing.org/sketch/thumbnail/180760/cache/2015-01-13%25252006:50:46&imgrefurl=http://www.openprocessing.org/collection/2234&h=100&w=100&tbnid=gBViK7XshqnQeM:&docid=68Yc1S_PCLnRZM&ei=FcGoVqfeHsS3uQSptb-gBw&tbm=isch&ved=0ahUKEwjnvOnhh8rKAhXEW44KHanaD3QQMwhIKCIwIg

Thanks & Regards,
Bhupesh
Developer
Jan 28, 2016 at 11: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 http://stackoverflow.com/questions/10296582/absolute-scaling-a-lineargradientbrush-texture-in-wpf-3d 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).

David
Jan 28, 2016 at 2: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,
Bhupesh
Developer
Jan 29, 2016 at 9: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.

David
Jan 30, 2016 at 3: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.
Developer
Feb 3, 2016 at 2:30 PM
Feb 5, 2016 at 9: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,

Bhupesh