Problem with .x models

Started by
17 comments, last by Best 21 years, 7 months ago
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
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 :\
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?
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]
Yes, i am applying each matrix for each object after rendering.


  SetupMatricesSettransform matCarrender CarSettransform matTrack ''or MultiplyTransform?render Track  
Actually, you are applying the matrices before rendering the models. Could you maybe post some screenshots? Maybe I am not visualizing this correctly.
how do i attach a screenshot?





[edited by - Jim Adams on September 4, 2002 9:41:33 PM]
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.
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...

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

This topic is closed to new replies.

Advertisement