Sunday, October 5, 2014

Creating a destroyable tube light for CRYENGINE using Blender

My game development walkthrough series - Part 5
                             This tutorial will show you how to create destroyable tube light for CRYENGINE using blender. In here we are going to use two different models, one is for light cover(destroyable light) and another one is for the main light(static geometry) which is going to stick with ceiling after destroying. If you are going to create another type of light(single light model eg: lamp) you can use this procedure and you only have to do the destroyable light part.

                   First create your tube light and texture it. This is my light cover and the main light(I didn't create the tube part).

                   Now separate the main light and the light cover and save them under two different file names.
eg - light03(static geometry)
       light03broken(destroyable light)

Exporting main light

                    This is the model we are going to use as the main light(static geometry). You can do this in a single file having different cryexport nodes, But I thought it would be better to use multiple files so you can understand the procedure clearly.
                   Open the light03. Create a proxy(you can use simple cube). Create a cryexport node and export it. Make sure to use suitable material names(one for light and other one for proxy). We are going to use one texture and one material for both main light and the light cover(light03broken).

Main light material - light03__01__metal__physNone
proxy material -        light03__03__proxy__physProxyNoDraw
                  (we have reserved material slot two for the glow material)

                 Join the proxy to its main object and Apply smooth shade. Apply Rotation, Location and Scale before export.

Exporting light cover

                  Open the second file(light03broken). Duplicate the light cover and move it to another layer, so we can work on it without any problems. Then add some edge loops on the duplicated model and use the knife tool to cut pieces. Separate the pieces and make faces along the sides of the cut(if you are creating the tube, do the same thing). These are my pieces.( I have moved them for previewing purpose).

                    Create proxies for the broken pieces as well as for the light cover. Join the proxies to particular pieces. Go to first layer and rename the object(light cover) to 'main'. Then go to the second layer and rename the broken pieces 'remain_01', 'remain_02', 'remain_03' (my light model has three broken pieces). Move all objects to the first layer.
                    Now we are going to use previous materials for the pieces.
pieces material - light03__01__metal__physNone
proxy material - light03__03__proxy__physProxyNoDraw.

                   Create another material for light cover. We are going to use this as glow material. Use same proxy material for light cover proxy.

                    This is my final model(destroyable light).

                   Add 'mass' and 'entity' UDP settings to the pieces. Set the mass value. Create a cryexport node for all objects(light03broken). Select all the pieces and the main object and export them. Make sure to apply smooth shade before exporting.
                    Tweak the metal and glass material. Reduce the opacity of the glass material if you are using 'Illum' shader. Increase the glow amount of the glass material.

                       Place the main light as a brush. Place a destroyable light and change the default model. Then group both objects. This is my final light(glow value 0). Shoot at the light cover. It will eventually break.

No comments:

Post a Comment