Not logged inOpenClonk Forum
Up Topic 3D mesh rendering

This board is threaded (i.e. has a tree structure). Please use the Reply button of the specific post you are referring to, not just any random button. If you want to reply to the topic in general, use the Post button near the top and bottom of the page.

Post Reply
In Response to Clonk-Karl
I have pushed a branch called "mesh" with support for loading and rendering 3D meshes in the Ogre XML format. It also contains a Monster object that I used to test the functionality. This is not necessarily supposed to become an official object though. Some options such as lighting have been chosen so that this test object looks halfway good. Maybe others don't. We probably need more objects to choose sane defaults, or make things such as light sources scriptable.

How to create an object using a mesh

To see your mesh in the game, you have to do the following:

  1. Create the mesh in Blender. The Y/Z-plane is the one that will be rendered parallel to the screen, the X axis goes inside the screen. You can probably use other modeling tools as well as long as they allow exporting to Ogre (XML or binary) format.

  2. Close Blender. Install the OGRE exporter following the instructions on the OGRE wiki. Or install an OGRE exporter for your other modeling tool, if it does not ship with one.

  3. In Blender, select the mesh in object mode, then go to Scripts Window->Scripts->Export->Ogre Meshes (If this does not exist, then the exporter was not installed properly). Select the mesh in the combobox, and add all the animations you want to export in the list below. Make sure that the "Export materials" button is pressed, and that the "OgreXMLConverter" button is pressed. Hit "Export".

  4. The process will create at least 3 files. Put all generated files in your Clonk object. Rename the file ending on .mesh to Graphics.mesh. Keep the names of the other files as the exporter generated them.

  5. To set an animation for an action, use Animation="Something" in the ActMap, where "Something" is the animation name as defined in the modeling tool. Set that Action via SetAction in the script. The Animation has Length*Delay frames, and these are mapped equidistantly to the animation length specified in the modeling tool.

  6. Check out the "mesh" branch, and compile the engine. Find someone to compile it for your platform if you are unable to. If you use Windows, make sure to use OpenGL. Your object should then be rendered ingame. If it does not work, have a look at the log file, or maybe at the Monster test object.



Known Issues

There are a few known issues:

  • Meshes flicker when there is an explosion somewhere on the map. This might have something to do with the depth buffer. Need to investigate.

  • I think this has been fixed with this patch.
  • Support for textures is not yet fully implemented. Textures are only supported in .png format. In fact, it would be good if someone could create a test object which uses a texture, so I can test this when implementing it.
    With this patch textures can have all supported image formats (png,jpg,bmp).

  • I am not sure the Vertex positions to query the ClrModMap are computed correctly. It looks strange when a mesh is moving near the FoW borders. But maybe the problem is only with the resolution of the ClrModMap.

  • There is much room for optimizations to the current code.

  • We probably also want to support the OGRE Binary format later. If the data structures are the same as in the XML format, it should be fairly straight-forward to get support for this in. Done.

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill