### 9.6.4 How do Moray UDOs work?

(Answer by Johannes Hubert)

UDOs are User Defined Objects. A UDO file can contain several such objects, but for the sake of this answer let's assume that there is one object in the UDO.

Actually you will always have a pair of files: One UDO file and one INC file. Both are supplied by you (if you write them by hand) or some application that can export to Moray UDO format. They are not generated by Moray.

The UDO file contains a description of how the object should look in Moray. It is essentially a bunch of vertices and lines connecting them, telling Moray how to render the wireframe of the object. In Moray you can scale, rotate, translate and texture this "object" as you wish.

When exporting from Moray, the second file, the INC file, comes into play: It contains the description of the same object in POV-Ray scriptlanguage. It can contain *everything* POV-Ray understands. At the place in the scene where you used the UDO, Moray simply exports an include-statement for this INC file, and then applies all the transformations you did to the object.

A problem many beginners have with UDOs, is the filename of this INC file:

Let's say that you have a car-object, defined by a UDO (exported for example with sPatch). You call the object "car", and when exporting you get the filepair "car.udo" and "car.inc". You now want to look at your car and therefor create a simple Moray scene which you call "car.mdl". This is where the trouble comes from: When exporting, Moray creates a file "car.pov" and a file "car.inc" (and probably some other files). Thus the "car.inc" from Moray overwrites the "car.inc" that was exported with the UDO.

The solution: Give your UDO a filename different fromt the MDL! For example: car_udo.udo, car_udo.inc and car.mdl.