Jump to content
  • Advertisement
Sign in to follow this  
xsirxx

Moved from World coord objects to Local coord objects, now no Zdepth?

This topic is 4857 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I recently changed how I do all my rendering and changed my importing of models. Now all of a sudden the same models I imported with world space, after I made the move to local(object space) they all show up behind each other. So I can see everything on the screen all the time even if behind an object... Is there something I need to flag to have this work correctly after making the move that I forgot? Figured this hasta be a common problem as it shouldnt be too difficult of a reason. Does DirectX not distinguish between each? So if I render 5 buffers, it wont not render one if it is still behind another from another buffer? Thanks much, Brad

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Now all of a sudden the same models I imported with world space, after I made the move to local(object space)


Uhh, what on earth does that mean?

Just what are you doing?

Share this post


Link to post
Share on other sites
Quote:
Original post by Drakex
Quote:
Now all of a sudden the same models I imported with world space, after I made the move to local(object space)


Uhh, what on earth does that mean?

Just what are you doing?


I imported my models in world space and used them in world space. NOW I import them in object space and use them in object space.

Meaning I take a the verts of an object in local space(relative to the object's origin) and then multiply it against a world matrix. Pushing it to world space( relative to the world origin(0,0,0) ).

So instead of rending the objects normally without having to multiply them against a matrix, I now in my shaders have to multiply them against a ToWorld matrix to give them world coordinates.


That being said, I am trying to render my world without objects seeing through each other. Dont get me wrong they render perfectly. Just EVERYTHING renders perfectly. I only want to see whats in the front, not what im not suspose to see in the rear being blocked. I have turned on ZENABLE and ZWRITEENABLE. Neither of these help.


EDIT: Does DirectX sort even if you use different buffers? Meaning you do a DIP(..) call then do another right after it. Will it still z sort correctly or do they hafta be in the same buffer?

[Edited by - xsirxx on July 25, 2005 5:58:31 PM]

Share this post


Link to post
Share on other sites
Quote:
So instead of rending the objects normally without having to multiply them against a matrix, I now in my shaders have to multiply them against a ToWorld matrix to give them world coordinates.


That's a completely normal procedure.. I don't know how you did anything before!

Yes, ZBuffering works per-frame and not per-buffer. It would be next to useless otherwise. I would assume two things: one, that you're creating a device with a proper ZBuffer format, and two, that you're properly clearing the ZBuffer each frame with a call to IDirect3DDevice9::Clear.

Share this post


Link to post
Share on other sites
Quote:

Yes, ZBuffering works per-frame and not per-buffer. It would be next to useless otherwise. I would assume two things: one, that you're creating a device with a proper ZBuffer format, and two, that you're properly clearing the ZBuffer each frame with a call to IDirect3DDevice9::Clear.


I clear the zbuffer every frame yes, and I have the proper format, the HRESULT says so :). All my render targets are cleared each frame too, as well as the backbuffer -- depthbuffer. As I said this all worked before. My Ztest and zenable are both on during my object render call. Turned off later when doing my deferred shading. but turned back on at beginning of my objects.

Share this post


Link to post
Share on other sites
I don't know what to tell you. You're doing something that sounds completely normal and you're getting a weird result.

Are you absolutely sure that you haven't missed some call that's changing the ZBuffer status?

Share this post


Link to post
Share on other sites
Quote:
Original post by Drakex
Are you absolutely sure that you haven't missed some call that's changing the ZBuffer status?


Well this seemed to be exactly what I thought. I searched for all the different state changes, even went after ZFunc to make sure. Still nothing. Im completely lost on it... culling is correct that didnt change either. Just plain weird.

Share this post


Link to post
Share on other sites
I assume you are creating the depth buffer automatically in the Present Parameters for the primary render target. Are you creating ones and specifically clearing them for the new render targets? Can you show the code?

Share this post


Link to post
Share on other sites
Also, keep in mind that your z-buffer must be as large or larger than your render targets (in terms of dimensions) or you could get some weird results.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!