#### Archived

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

# 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.

## 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 on other sites
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 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 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 howevercar->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 on other sites
Yes, i am applying each matrix for each object after rendering.

  SetupMatricesSettransform matCarrender CarSettransform matTrack ''or MultiplyTransform?render Track

##### 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 on other sites
how do i attach a screenshot?

[edited by - Jim Adams on September 4, 2002 9:41:33 PM]

##### 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 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 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

1. 1
2. 2
Rutin
18
3. 3
4. 4
5. 5
frob
13

• 11
• 9
• 30
• 16
• 9
• ### Forum Statistics

• Total Topics
632611
• Total Posts
3007417

×