objects render in wrong order ???
objects render in wrong order ???
objects render in wrong order ???
objects render in wrong order ???
objects render in wrong order ???
objects render in wrong order ??? objects render in wrong order ??? objects render in wrong order ??? objects render in wrong order ??? objects render in wrong order ??? objects render in wrong order ??? objects render in wrong order ??? objects render in wrong order ???
objects render in wrong order ??? objects render in wrong order ???
objects render in wrong order ???
Go Back  Xtreme Visual Basic Talk > > > > objects render in wrong order ???


Reply
 
Thread Tools Display Modes
  #1  
Old 03-14-2009, 06:50 PM
Chris Ara Chris Ara is offline
Centurion
 
Join Date: Feb 2005
Posts: 176
Question objects render in wrong order ???


I'm loading a mesh of a simple plain with some cubes and spheres on it. It's a .x file type as well if that helps any. The problem is when I render my mesh it will draw the plane on top of cubes and spheres even though the cubes and spheres are above the plain. Any time one of the cube or spheres clips with the plane the plane is drawn over it. I'm sure this is some parameter to be set somewhere to fix this problem I just can't remember where or what.
Reply With Quote
  #2  
Old 03-20-2009, 02:06 PM
Leade's Avatar
Leade Leade is offline
Junior Contributor
 
Join Date: Jul 2005
Location: Wherever i fall over
Posts: 222
Default

I had this very same problem just now and have fixed it. it was drving me up the wall too. I rewrote the code several times and every time put the error back each time.

1) check you have created a depth buffer surface during creation of the d3d device, best thing to do is set Autodepthbuffer to 16 bit.

2) Enable Z buffer drawing, some video cards require W-buffer so you may need to enable that too. This can be done when setting the renderstate.

when enabling Z buffer you can follow the folowing example

Code:
    if (Z_Mode == true)
    {
        Dx9Device3D.RenderState.UseWBuffer = true;
        Dx9Device3D.RenderState.ZBufferEnable = true;
        Dx9Device3D.RenderState.ZBufferFunction = Compare.LessEqual;
        Dx9Device3D.RenderState.ZBufferWriteEnable = true;
    }
    else
    {
        Dx9Device3D.RenderState.UseWBuffer = false;
        Dx9Device3D.RenderState.ZBufferEnable = false;
        Dx9Device3D.RenderState.ZBufferFunction = Compare.Never;
        Dx9Device3D.RenderState.ZBufferWriteEnable = false;
    }
***The line in bold is what you need to fix the problem.

what u probly done was set the ZFunction to Always which means it will draw the face as they come, meaning the last face draw will always be the top.

3) (you've probably done this but i'll let you know anyway) when starting a new scene to draw objects, be sure to have the backbuffer cleared as well as the target surface when starting a new drawing scene. otherwise the screen May become garbled. If its fine without this change, then just ignore this step.

Hope that helps.
__________________
Fact: The best ideas come when your smashed of your face. So drink beer and be merry!!!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
objects render in wrong order ???
objects render in wrong order ???
objects render in wrong order ??? objects render in wrong order ???
objects render in wrong order ???
objects render in wrong order ???
objects render in wrong order ??? objects render in wrong order ??? objects render in wrong order ??? objects render in wrong order ??? objects render in wrong order ??? objects render in wrong order ??? objects render in wrong order ???
objects render in wrong order ???
objects render in wrong order ???
 
objects render in wrong order ???
objects render in wrong order ???
 
-->