Models warping with rotation

Started by
2 comments, last by xavstone 9 years, 1 month ago

Hi,

I have built a rudimentary 3d engine. All was going well until I implemented a clip frame. Now when I rotate objects im getting some strange warping effects.

I thought I would post some videos to see if anyone had any idea what was happening before posting code.

The model in the video is a torus (believe it or not). Camera set in the middle of it. The torus should rotate around the camera. Half of it off scene - Im clipping triangles if any vertex has a point outside the clipping area.

Here are the clips:

Rotating around bank (z) preserves the geometry for a little while:

Similarly to pitch (x):

Rotating around all Euler Angles:

I'm hoping someone has encountered similar and can point me in the right direction.

Many thanks in advance.

Advertisement
I wrote a wire frame renderer in assembly language for a comp Sci course in 1995 that behaved a lot like that. My rotation code was all fouled up, though I no longer remember the exact nature of the foulness. You will probably have to post some code to get an answer.

1) Check you didn't typo the name of any axis.

2) If you aren't using a matrix for the rotation, make sure that you're using the old coordinates when computing the new position. Something I tend to forget is that modifying the first axis will change the value used for the computation in the other axis. Moving the old coordinates to a temporary variable and then using that for the computations solves the issue.

But yeah, just throwing away some ideas, no idea what's going on in your code to tell for sure. I'd strongly suggest to check for #1 though, since I have a feeling that it may be something like that.

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

Thank you both for responses.

Turns out you were right Sik. I was calculating new position of each axis and using the value in the next. Using a temporary variable as you suggested fixed the problem (if slowing the frame rate somewhat).

I still have some perspective issues which I suspect are related to my clip matrix. I will post these further problems in a different thread.

Many thanks once again :-)

This topic is closed to new replies.

Advertisement