@Sterling_Blake wrote:
I'm encountering a problem drawing a procedurally generated TriangleList. The symptom is that at certain camera angles some of the triangles which should be drawn are not (or possibly are drawn over by triangles behind them). The missing triangles are drawn at other view angles however. A visual sample of the symptom is below:
Rotated slightly, the area in the top, right is now drawn correctly instead of the triangles behind being drawn on top, but toward the bottom left, the white sections drawn within the green area are really on the back side of this isohedron and the green facets on the camera's side are either not drawn or drawn over by the triangles behind them.The triangles list itself does not seem to be the problem, as OpenGL draws this same isohedron correctly at all rotations:
Likewise, I've simplified down to an octohedron and inspected the coordinates of each triangle to confirm they match between the MonoGame and OpenGL programs and the MonoGame still draws the figure not in the expected way in all rotations.The drawing behavior is identical in MonoGame whether using DrawUserPrimitives or filling and drawing from the VertexBuffer.
I am new to MonoGame and it is likely that I am missing some important parameter related to draw order or culling. The relevant source code parts at Draw time:
graphics.GraphicsDevice.Clear (Color.Black); effect.World = Matrix.CreateTranslation (0, 0, 0);; effect.View = camera.ViewMatrix;; effect.Projection = camera.ProjectionMatrix; effect.VertexColorEnabled = true; RasterizerState rasterizerState = new RasterizerState (); rasterizerState.CullMode = CullMode.None; GraphicsDevice.RasterizerState = rasterizerState; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply (); GraphicsDevice.DrawUserPrimitives (PrimitiveType.TriangleList, vpcTestVertexPerformance, 0, intFacetCount); }Any suggestions for correcting this are greatly appreciated!
UPDATE: If the camera is far outside the X, Y, and Z range of the isohedron the problem goes away. In the examples above, the camera is well outside the figure itself, but closer to the X-axis than the outer range of the figure. Is this a limitation of the MonoGame graphics engine or an oversight in my coding?
Posts: 2
Participants: 2