Project Showcase: Ocado Warehouse Visualisation

WarehouseJim

02-09-2011 16:21:23

At long last a video of what I have been working on for almost 3 years now:

http://www.youtube.com/watch?v=OD6TG6ngYuM

You'll have to excuse the fact that the video's trying to recruit you and skip to the bits with glorious Mogre 3D graphics.

The project is a 3D model of our highly automated warehouse, over which you can play back the results of our simulation, or you can see what's happening live in our warehouse for diagnosing problems. It has not only helped us improve the current warehouse, but also allowed people to better understand our not-yet-built second warehouse.

It uses Miyagi for 2D user interface / heads up display but with custom skinning and standard Mogre. In general Mogre has worked well out of the box, but we had to write some custom code to help render the several thousand shopping baskets going round using instancing... although we haven't really got it quite right as frame rate's still ~20fps and CPU limited.

I used Blender to create and animate the (not great looking) people, which use skeletal animation. The rest of the meshes are created in program using ManualObject.

A big thank you to the whole Mogre community. You may not be large in numbers, but you've been very helpful and responsive in the forums when we've needed help and by maintaining Mogre, you have provided us with a great graphics library.

Beauty

07-09-2011 14:49:40

Thanks for your detailed report, the video link and credits.
It's a very interesing project and I'm happy that our small Mogre (sub)community could help.
Also you gave us support by writing your comprehensive WarehouseJims MOGRE HOWTO. :D

It would be fine if you add an entry to the wiki page Projects using OGRE. (Unfortunately there only less non-game projects.)
Additionally you could re-post your post on the "official" Ogre showcase. So many other users will see the sweet result.

we had to write some custom code to help render the several thousand shopping baskets
I'm interested in more details.
Did you add more Mogre wrapped functions/classes to the Mogre wrapper?
... Perhaps some of your code could be useful for the Mogre community or the core code?

How do you save all the information of the scene / SceneGraph?
... Do you load everything from a data base? Or store it in a "scene file"?

How do you apply changes?
... In Blender? By a self written scene editor? (graphical or by database/file entries?)

How big was your "visualisation team"?
... Just you or more team mates?

Did you find bugs in Mogre or miss wrapped functions/classes?
If so, please add it to our Mogre bugtracker.

Could you provide some screenshots for this forum post and the Ogre gallery?

WarehouseJim

08-09-2011 10:54:23

[For the thousands of shopping baskets] Did you add more Mogre wrapped functions/classes to the Mogre wrapper?
... Perhaps some of your code could be useful for the Mogre community or the core code?


We only programmed in C# and some GLSL and HLSL. The implementation isn't really a generalised solution, but I will look into whether there is code that is worth sharing with the community.

The basic idea of the implementation is that you fill a texture with the position, orientation and colour of lots of shopping baskets and then send it to the graphics card where a shader interprets the texture and renders all the shopping baskets. The current implementation uses a large mesh of lots of shopping baskets and uses a vertex shader to translate relevant parts of that mesh. A better implementation would use "hardware instancing" where the graphics card duplicates a mesh for an individual shopping basket.

We actually use a similar technique of one large texture for colouring all the fixed meshes (which are merged together in StaticGeometry objects i.e. created as individual meshes and turned into one large one by Ogre). In this case, all you do is give each object's vertices texture coordinates that correspond to the pixel of the texture that you want to use as its colour. So in our case the texture coordinates of conveyor 1 point to pixel 1 of the texture, which is coloured red. The benefit of this system is that you can create a large static geometry object -> fewer batches -> better frame rate yet retain the ability to change the colour every frame just by sending a relatively small texture to the graphics card each frame.

There has been talk about better instancing support in Ogre and I'm not up to date with the current status. In particular, there was talk about better implementing of instancing with skeletal animation which would allow us to use instancing for rendering all the people wandering around.

How do you apply changes [to meshes]?

We only use blender for the people. All the other meshes are built up using ManualObject from data stored in a database. The basic idea of the system is that we have lots of inter-connected conveyors and they can be represented in the database by the coordinates of their connections and the orientation of the inputs and outputs (which is the same as the input to the next component). From this information you can build a nice straight or curved mesh. Not all components look the same, so it's a bit more complex, but that's the idea. When you build up the mesh data, you also build up the information necessary for the animation of the shopping baskets.

A very big part of the project was actually how to store everything in the database, accessing it, comparing different models etc. But that's more about the specific project and the workings of the business rather than Mogre.

Building your own meshes in program isn't conceptually that difficult, but I have found it quite laborious. There are lots of edge cases and it requires some vector maths that while I am capable of, I'm not used to using on a regular basis, so you make a few more mistakes. Having said that, we have several thousand conveyors and drawing them all in Blender would create issues as well. It was laborious enough as it is, although we have worked with our suppliers to make it easier with new builds.

One thing that I didn't expect is that graphics cards are actually really happy to draw endless triangles we render ~550,000 triangles and with them all in front of the camera, you can still get >>100fps (if the shopping baskets aren't moving).

How big was your "visualisation team"?

Just me full time plus we have had two 6 month industrial placement students from Imperial College (a top London University) one last year, and the other is coming to the end of his time now. I am also about to stop working on the project but I am in the process of handing over, so the project will continue. I expect that we'll try to get another intern for the coming year as well. Submit your applications now!

We're actually tacked on to the Simulation Team and I have only been working on it part time, but the interns have tended to be focused just on this project. The Simulation is a separate project which pre-dates the visualisation. There is a lot of overlap though as data for the Simulation is downloaded from this project and the results of the Simulation can be viewed here.

Did you find bugs in Mogre or miss wrapped functions/classes?
In general I found Mogre pretty bug free. The only comment I would have is that you can get some crashes where you have no idea what caused them. That's really an Ogre issue rather than specifically a Mogre issue though.

Miyagi definitely has had some bugs, but as smiley80 has been so responsive at fixing them, we'll forgive them.

Could you provide some screenshots
There's that risk of getting into company bureaucracy on this, but I'll see what I can do.

Beauty

08-09-2011 16:55:19

Very interesting - Thanks for your detailed answer. :D

To build almost everything by MOs from a database makes me smiling. I also use dynamic creation by ManualObjects and I like it. Also I had the need of normal vector calculation to get nice looking MOs.

The idea to use shader calculations to display all the baskets sounds impressive.
Unfortunately I have no shader knowledge. A few months ago an Ogre user wrotes the extensive JaJDoo Shader Guide. One day I want to read and learn from it.