oFusion viewport affects 3ds Max's rotation?

Pendulum

20-09-2006 02:07:33

Hello,

I'm very new to oFusion and Ogre, and I'm slowly learning the export process. I'm using 3ds max 7, with only the oFusion tools installed. Ultimately I'd like to rig a character and export it to an Ogre app.

When I learn a new game engine, I tend to try little experiments as I do the tutorials and read the docs.

In this case, the first thing I did was export a textured mesh without animation. It showed up in the oFusion window, and it worked fine in the app.

Next, I tried adding a few rotate keys, just to pivot the mesh left and right. No bones or anything (not sure if that's right - I know some apps need at least one bone), just a mesh. I tried exporting this, being sure to set it up to export animation, and marking which frames I wanted to export. I didn't see any files export that looked like animation files, just the mesh and material exported.

I thought the problem might be with the mesh, so I restarted Max and started over with a new test. That's when I ran into this odd problem with rotation:

First I created a torus in the perspective viewport. Then, with Auto Key turned on, I animated the torus on its x axis so that it wobbled a bit: I rotated it -30 degrees at frame 20, then back 60 degrees at frame 40. So the X rotation keys read as: frame 0, 0 degrees; frame 20, -30 degrees; frame 40, 30 degrees. The torus animated fine, with the proper tweening, nice and smooth.

Then I went to the perspective window and set that to be the oFusion viewport. At that point the animation broke:

In the non-oFusion viewports, the torus rotates from 0 degrees on frame 0 to -150 degrees on frame 1. It stays at that rotation until frame 20, at which point it jumps to -30 degrees. Then it tweens properly for the rest of the animation.

In the oFusion viewport, the torus smoothly tweens between frame 0 and fame 20, only backwards: it's like it chooses the long way to get from 0 degrees to -30 degrees, flipping 150 degrees in the wrong direction. Then between frames 20 and 40 it seems to tween correctly.

It seems as if it doesn't like dealing with Max's negative rotation.

One thing that strikes me as weird is that the rotation is different between the two window types.

What's really troubling, however, is that this problem seems to change the way Max itself rotates objects. Even after I reset Max completely, and start over. If rotate an object after having this problem, even after resetting, and even without running the oFusion viewport, it rotates in this weird way. I have to shut down Max and restart to get it back to normal.

Like I said, I'm a newb, so sorry if I'm pointing out something everybody already knows. But I've got the latest tools, done some tutorials, got the hotfix to fix the tuts, dug through the forums and read the docs. I've not seen this problem addressed exactly.

If nothing else, this is a good case study of things a newb might run into =).

Incidentally (since it seems like a fix suggested for many rotation problems posted on this forum), I did try resetting Xforms. That didn't help, and anyway I wouldn't expect it to since I'm working with a freshly built object whose pivot is alligned with the world's.

Thanks!

Lioric

20-09-2006 02:59:59

See this article for the solution:

Animation Keyframes are modified after the preview viewport is activated

Pendulum

20-09-2006 04:35:09

Thanks for the quick reply, Lioric.

In the article it says:

Its adviced to set the Render System for the Preview Viewport to OpenGL

When I run the viewport in OpenGL, Max crashes as soon as the viewport is activated. That's actually why I switched to Direct3D in the first place, it was the only way I could get it to work.

Any thoughts as to why Max would crash? Unfortunately the crash doesn't give very much info: "Microsoft Visual C++ Runtime Library, Runtime Error!, Program: C:\3dsmax7\3dsmax.exe, This application has requested the Runtime to terminate in an unusual way. Please contact the application's support team for more information." And that's all she wrote.

Lioric

20-09-2006 16:47:31

Upgrade your video drivers

Change the driver used by Max in "Configuration/Viewports"

Pendulum

21-09-2006 03:49:07

I got the latest drivers: Radeon Omega Drivers 3.8.273 (Catalyst 6.7) for my card, which is a 128MB ATI Mobility Radeon X600. However, I'm still getting the crash.

There's a ton of things I can turn on or off in Max's driver options as well as in ATI's control panel in the OpenGL section. Can you suggest any changes I might make in those settings?

Thanks for the help.

Lioric

21-09-2006 16:30:48

Post your ogre.log file that is created (after the issue) in your max root folder

Pendulum

21-09-2006 22:13:44

Here's the log. This is if I start Max7, check that Max's viewport is set to OpenGL, check that oFusion's viewport is set to OpenGL, and then open the oFusion viewport:

14:05:18: Creating resource group General
14:05:18: Creating resource group Internal
14:05:18: Creating resource group Autodetect
14:05:18: Registering ResourceManager for type Material
14:05:18: Registering ResourceManager for type Mesh
14:05:18: Registering ResourceManager for type Skeleton
14:05:18: MovableObjectFactory for type 'ParticleSystem' registered.
14:05:18: Loading library OgrePlatform.dll
14:05:18: OverlayElementFactory for type Panel registered.
14:05:18: OverlayElementFactory for type BorderPanel registered.
14:05:18: OverlayElementFactory for type TextArea registered.
14:05:18: Registering ResourceManager for type Font
14:05:18: ArchiveFactory for archive type FileSystem registered.
14:05:18: ArchiveFactory for archive type Zip registered.
14:05:18: DevIL version: Developer's Image Library (DevIL) 1.6.7 Nov 9 2005
14:05:18: DevIL image formats: bmp dib cut dcx dds gif hdr ico cur jpg jpe jpeg lif mdl mng jng pcx pic pix png pbm pgm pnm ppm psd pdd psp pxr sgi bw rgb rgba tga vda icb vst tif tiff wal xpm raw
14:05:18: Registering ResourceManager for type HighLevelGpuProgram
14:05:18: Registering ResourceManager for type Compositor
14:05:18: MovableObjectFactory for type 'Entity' registered.
14:05:18: MovableObjectFactory for type 'Light' registered.
14:05:18: MovableObjectFactory for type 'BillboardSet' registered.
14:05:18: MovableObjectFactory for type 'ManualObject' registered.
14:05:18: MovableObjectFactory for type 'BillboardChain' registered.
14:05:18: MovableObjectFactory for type 'RibbonTrail' registered.
14:05:18: Loading library .\oFusion\RenderSystem_GL
14:05:18: OpenGL Rendering Subsystem created.
14:05:18: Loading library .\oFusion\RenderSystem_Direct3D9
14:05:18: D3D9 : Direct3D9 Rendering Subsystem created.
14:05:18: D3D9: Driver Detection Starts
14:05:18: D3D9: Driver Detection Ends
14:05:18: Loading library .\oFusion\Plugin_CgProgramManager
14:05:18: *-*-* OGRE Initialising
14:05:18: *-*-* Version 1.2.1 (Dagon)
14:05:18: Creating resource group Bootstrap
14:05:18: Added resource location '.\oFusion\Media\OgreCore.zip' of type 'Zip' to resource group 'Bootstrap'
14:05:18: Added resource location './oFusion/Media' of type 'FileSystem' to resource group 'General'
14:05:18: Added resource location './oFusion/Media/textures' of type 'FileSystem' to resource group 'General'
14:05:18: Added resource location './maps' of type 'FileSystem' to resource group 'General'
14:05:18: Added resource location './oFusion/Media/shaders' of type 'FileSystem' to resource group 'General'
14:05:18: *** Starting Win32GL Subsystem ***
14:05:18: ResourceBackgroundQueue - threading disabled
14:05:18: GLRenderSystem::createRenderWindow "OgreView", 100x100 windowed miscParams: externalWindowHandle=3802866
14:05:18: An exception has been thrown!

-----------------------------------
Details:
-----------------------------------
Error #: 0
Function: Win32Window::create
Description: selectPixelFormat failed.
File: ..\src\OgreWin32Window.cpp
Line: 253
Stack unwinding: <<beginning of stack>>

Lioric

21-09-2006 22:37:55

Did you tested with Max set to D3D9 and oFusion viewport set to OpenGL?

Pendulum

21-09-2006 23:15:23

Did you tested with Max set to D3D9 and oFusion viewport set to OpenGL?

I guess I must not have, because I just now tried that, and it seems to work! I did the exact same test I described at the start of the thread, animating the torus. That torus animates in the oFusion viewport nicely with Max viewports set to D3D9, and oFusion viewport set to OpenGL. Plus, it doesn't crash any more :).

Thanks for the help!

Pendulum

21-09-2006 23:46:22

Ack, I found a problem with this setup. With Max set to D3D9 and oFusion set to OpenGL, the character appears in the oFusion viewport without its texture. Instead, the character is bright yellow. The character is smooth shaded, but the shading becomes hard-edged along the UV seams. As if the normals aren't unified on the vertices that lie on UV seams.

If I switch the oFusion viewport to Direct3D, the texture appears. But that setup is the one that produces the animation problems.

As a workaround, I suppose I could do my texture work with oFusion set to D3D, and do the animation in a separate file that I view only in OpenGL.

Incidentally, is there an easy way to reinitialize the oFusion viewport? Easier than what I'm doing, anyway: I change the viewport from oFusion to perspective, and then I change it back again.

Pendulum

22-09-2006 11:00:57

Answered my own question:

Incidentally, is there an easy way to reinitialize the oFusion viewport? Easier than what I'm doing, anyway: I change the viewport from oFusion to perspective, and then I change it back again.

"Update" and "Update Sel" right up there on the top. Didn't get that those were for the viewport specifically, go figure.

Lioric

22-09-2006 16:39:30

You will need all the tools available in an accessible place (a toolbar), see the "Working with Scenes\Tools" page of the User's Guide for more details