0

strange behavior when i put two RectangleVisual3D nearly

Anonymous 5 years ago 0
This discussion was imported from CodePlex

qjt wrote at 2014-03-05 03:14:

Hi,when i am using your toolkit.A strange thing occurred. i put two RectangleVisual3D of different color (one of them is RED ,the other is BLUE) closely, one RectangleVisual3d looked like dissolve into another RectangleVisual3d just like the picture below:Image
Image
the code:
 <t:RectangleVisual3D Length="100" Width="100" Origin="0,0,1" Fill="#FFF50404" >
            </t:RectangleVisual3D>
            <t:RectangleVisual3D Length="100" Width="100" Origin="0,0,1.0001" Fill="#FF0611FB">
            </t:RectangleVisual3D>

qjt wrote at 2014-03-05 03:17:

another picture:
Image

Lolipedobear wrote at 2014-03-05 11:53:

Did you set NearPlaneDistance in Camera? Had the same problem when NearPlaneDistance was 0.

qjt wrote at 2014-03-06 03:40:

Thank you for your help,but it can't solve the problem.The code:
 this.Position = camera.Position;
            this.LookDirection = camera.LookDirection;
            this.UpDirection = camera.UpDirection;
            //this.NearPlaneDistance = camera.NearPlaneDistance;
            this.NearPlaneDistance = 0;
            this.FarPlaneDistance = camera.FarPlaneDistance;

Lolipedobear wrote at 2014-03-06 06:05:

Set value different from 0. Chosen value is depends on situation - if scene is large value can be 10 or more, if it is a small scene then value can be 0.1. I set 15 to NearPlaneDistance and it resolved problem on 1500x1500 units scene. Parts of the scene closer to camera than value in NearPlaneDistance property won't be displayed. As far as i know this problem is connected with floating point rounding when renderer is trying to determine which object is closer to camera.
<PerspectiveCamera Position="0, 600, 525" LookDirection="0, -600, -525" UpDirection="0,1,0" NearPlaneDistance="15"/>