Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Best

Problem with .x models

This topic is 5859 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

First, i have to apologised for my bad english.... i´m using VB5 and directx 8.1 Here is my problem: First, i intialice everything(d3d,z-buffer,etc).Then I load two meshes to the memory (a car and a circuit race). I apply the respectives matrix maths for each of them and then render. When i run the program and move the car, it seems to don´t have a depth, like there isn´t any z-buffer. I move the car down, but it looks like it´s ALWAYS on the circuit race, when it´s behind it. I hope you could undertund it, and help me... thanks to all

Share this post


Link to post
Share on other sites
Advertisement
Hmmm...I can only think of 2 things.

1. You don''t have a depth buffer (I often forget to do do that and then get really scared ), or you turned off the Z_ENABLE render state, or you arent clearing your depth buffer.

2. You have only one matrix for both the car and the track, so when you move the car, the track moves with it. Try applying an identity matrix before rendering the track.

If I misunderstood anything, sorry :\

Share this post


Link to post
Share on other sites
quote:
Original post by Sheep
Hmmm...I can only think of 2 things.

1. You don''t have a depth buffer (I often forget to do do that and then get really scared ), or you turned off the Z_ENABLE render state, or you arent clearing your depth buffer.

2. You have only one matrix for both the car and the track, so when you move the car, the track moves with it. Try applying an identity matrix before rendering the track.

If I misunderstood anything, sorry :\


1. Yes i have a z-buffer, it´s on and i clear it every frame.
2. I apply a different matrix for each thing, the car and the matrix.

One thing that can be wrong is that after rendering i put Settransform to apply de matrix to the car and after rendering the track i put Settransform again, ís it wrong?

Share this post


Link to post
Share on other sites
Are you applying the world matrices for each obect after rendering? You should actually apply the matrices before rendering. It should actually look something like this (psuedo-code):


      
transform(car_matrix); // rotation*translation or however

car->render();

set_to_indentity(track_matrix);
tranform(track_matrix);
track->render();


Apply the transformation matrices before rendering.

[edited by - Sheep on September 3, 2002 4:46:49 PM]

[edited by - Sheep on September 3, 2002 8:01:34 PM]

Share this post


Link to post
Share on other sites
Yes, i am applying each matrix for each object after rendering.


  
SetupMatrices

Settransform matCar
render Car
Settransform matTrack ''or MultiplyTransform?
render Track

Share this post


Link to post
Share on other sites
Actually, you are applying the matrices before rendering the models. Could you maybe post some screenshots? Maybe I am not visualizing this correctly.

Share this post


Link to post
Share on other sites
See if Direct3DDevice8.GetDepthStencilSurface() actually returns a surface just to make sure that you really do have the Z buffer working. If so, try moving your car really far back - this may sound silly but are you sure that your cars wheels are actually touching the ground? A small car floating in the air would give the illusion shown in the screenshots.

Share this post


Link to post
Share on other sites
quote:
Original post by bazee
See if Direct3DDevice8.GetDepthStencilSurface() actually returns a surface just to make sure that you really do have the Z buffer working. If so, try moving your car really far back - this may sound silly but are you sure that your cars wheels are actually touching the ground? A small car floating in the air would give the illusion shown in the screenshots.


Yes it returns a surface, and the screenshot aren´t a ilusion, anywhere you see, you see the car first and then de track...

Share this post


Link to post
Share on other sites
Fair enough, it''s just that caught me out once when I made a similar program, my cars wheels weren''t touching the ground because the car was too small. I can''t really think of anything else, sorry

Share this post


Link to post
Share on other sites

  • 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!