Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF 3D Gradientbrush problem
    text
    copied!<p>The main problem is in LinearGradientBrush. It fills triangle in solid red. What's wrong? I have tried almost the same code with 2d shapes. It worked perfectly.</p> <pre><code>&lt;Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="215" Width="336"&gt; &lt;Grid Height="146" Width="232"&gt; &lt;Viewport3D Name="myViewPort" ClipToBounds="False"&gt; &lt;Viewport3D.Camera&gt; &lt;PerspectiveCamera x:Name="myCamera" Position="10,10,10" UpDirection="0,1,0" LookDirection="-10,-10,-10" FieldOfView="10"/&gt; &lt;/Viewport3D.Camera&gt; &lt;ModelVisual3D&gt; &lt;ModelVisual3D.Content&gt; &lt;GeometryModel3D&gt; &lt;GeometryModel3D.Geometry&gt; &lt;MeshGeometry3D Positions="-1,0,0 0,1,0 1,0,0" TriangleIndices="0,2,1" /&gt; &lt;/GeometryModel3D.Geometry&gt; &lt;GeometryModel3D.Material&gt; &lt;DiffuseMaterial&gt; &lt;DiffuseMaterial.Brush&gt; &lt;LinearGradientBrush StartPoint="0,0" EndPoint="1,1"&gt; &lt;GradientStop Color="Black" Offset="0"&gt;&lt;/GradientStop&gt; &lt;GradientStop Color="Red" Offset="0.6"&gt;&lt;/GradientStop&gt; &lt;/LinearGradientBrush&gt; &lt;/DiffuseMaterial.Brush&gt; &lt;/DiffuseMaterial&gt; &lt;/GeometryModel3D.Material&gt; &lt;/GeometryModel3D&gt; &lt;/ModelVisual3D.Content&gt; &lt;/ModelVisual3D&gt; &lt;ModelVisual3D&gt; &lt;ModelVisual3D.Content&gt; &lt;AmbientLight&gt;&lt;/AmbientLight&gt; &lt;/ModelVisual3D.Content&gt; &lt;/ModelVisual3D&gt; &lt;/Viewport3D&gt; &lt;/Grid&gt; </code></pre> <p></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload