In this small tutorial we will learn how to create boxes for CDs and DVDs using Demoniak3D.
Once created, these boxes may be used, for example, to show the packaging of a new software.
We often find this kind of illustrations on websites that sell software or in computer magazines.
But very often, we see boxes featuring 3D rendering mistakes, such as incoherent vanishing points
or side images incorrectly deformed. One reason is that the cg artist does not use 3D software
to create the box: instead, a simple 2D vectorial drawing software is used letting the artist the
responsibility to deform his own way the 2D box to get the desired 3D result.
The method explained hereafter will lead to a nice realistic result only in few minutes:
Fig. 1 - The DVD box done with the DVD_Box_Maker_with_reflection.xml script.
The main advantage of this method is that everything is handled in real 3D. Once the box
created, one can make screenshots from any point of view, change the camera field of
view (fov), apply lighting and reflection effects. It is also possible to use vertex and pixel
shaders in order to get the appropriate result.
The box creation is quite simple. All we need is:
- the images (or textures) to map on the box sides
- the Demoniak3D XML script
In this tutorial, we are going to use 3 textures we will map on the front, the left and the
back sides of the box:
Fig. 2 - The three textures used for the box creation
The XML scritp for Demoniak3D is located in the zip archive available for download at the end of
this page. Actually, there are two scripts:
- DVD_Box_Maker.xml: this script displays the textured DVD box alone
- DVD_Box_Maker_with_reflection.xml: this script adds a reflection on the floor .
In each script, the user has just to replace the demo's textures by his own:
<texture name="front_tex" filename="data/dvd_front.jpg" function_type="REPLACE" />
<texture name="back_tex" filename="data/dvd_back.jpg" function_type="REPLACE" />
<texture name="left_tex" filename="data/dvd_left.jpg" function_type="REPLACE" />
<texture name="right_tex" filename="data/void_map.jpg" function_type="REPLACE" />
<texture name="top_tex" filename="data/void_map.jpg" function_type="REPLACE" />
<texture name="bottom_tex" filename="data/void_map.jpg" function_type="REPLACE" />
All textures are located in the data/ directory. The first three textures (dvd_front.jpg, dvd_back.jpg and
dvd_left.jpg) are the 3 textures of the figure 2. The fourth and the last texture (void_map.jpg) is a
texture to map on the other faces that are less important for the final result.
Fig. 3 - the DVD_Box_Maker.xml script in action
The DVD_Box_Maker_with_reflection.xml script allows adding a ground with partial reflection.
This partial reflection is achieved using a gloss-map that looks like:
Fig. 4 - the gloss map used for reflection
The gloss map is just a texture that encodes high reflection areas in white and non-reflecting ones in black.
Fig. 5 - the DVD_Box_Maker_with_reflection.xml script
The camera is controled by the 4 direction keys (UP and DOWN: camera forward and backward - RIGHT
and LEFT: right and left camera strafe). To place the camera, you can also use the [Ctrl] button + mouse
left button: that allows translations in the camera's XY plane.
<background_color r="1.0" g="1.0" b="1.0" />
Fig. 6 - the DVD_Box_Maker_with_reflection_v2.xml script without the Demoniak3D's logo
The only thing you have to do, is to make a screenshot and use your favorite image processing
software to finalize the job!