开发者

C# 3D wpf gradient colour depending Z

开发者 https://www.devze.com 2023-04-07 16:16 出处:网络
C# I want to t ouse the LinearGradientBrush with absolute cordi开发者_开发百科nates so the pixel colour

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

精彩评论

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