开发者

C# 3D wpf gradient colour depending Z

C#

I want to t ouse the LinearGradientBrush with absolute cordi开发者_开发百科nates so the pixel colour of each objects reflactes the height but I do not understand how to use the LinearGradientBrush.

But how is this applied to "only" the Z value of each object.

In my example I want the colour to shade from blue to read from cordinates -100 to 100

LinearGradientBrush myG= new LinearGradientBrush();
myG.MappingMode = BrushMappingMode.Absolute;
myG.StartPoint = new Point(0, -100);
myG.EndPoint = new Point(0, 100);
myG.GradientStops.Add(new GradientStop(Colors.Blue, 0));
myG.GradientStops.Add(new GradientStop(Colors.Red, 1));

Material material = new DiffuseMaterial(myG);

Regards Stefan

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜