On sale: Cloth Fire (Unity)

Channel:
Subscribers:
506
Published on ● Video Link: https://www.youtube.com/watch?v=GD81tS7hBNo



Duration: 0:36
3,716 views
7


Effect and shader included in the Particle Dissolve Shader for $5:
https://www.assetstore.unity3d.com/en/#!/content/33631

Web player demo:
http://www.geocities.jp/ifurkend/unity/cloth_fire.html

The inspiration comes from the fake fire decoration in real life which has red/orange fabric waving upward by the fan beneath. But motion of real flame is totally different from waving cloth so it will look wonky when the initial position of the fire is being dragged rapidly (as shown in the web player demo). The whole point is just to use what Unity Personal/Free edition natively provides to create a less static fire in the unconventional way.

This is a relatively "expensive" way of doing real-time 3D fire and not meant for extensive use even on modern desktop or console platforms because the SetPass (Draw) call of the cloth mesh cannot be batched and you need high-polygon mesh for the cloth-fire to wave decently smoothly.

No animated texture is used. The flame texture is one single loopable raster image with background color removed by its grayscale as alpha channel in Photoshop. I used the free ScrollingUVs script from Unity wiki to scroll the flame texture upward.

The effect prefab, scene and the softrim shader which fades alpha value of each mesh triangle relative to the angle against the camera are included in our Particle Dissolve Shader Package for an extremely low price! Don't miss it~

If you have nothing similar on hand and not interested in my asset, particle/alpha blended shader is the closest thing you can use on the flame. Do NOT use additive shader (except for the glow particles) as the flame will look shallow and unrealistic.

Unity doc about cloth component:
http://docs.unity3d.com/Manual/class-Cloth.html

Step by step:
1) Add a sphere mesh.
2) Add the cloth component and Scrolling UVs script (X: 1, Y: -3) to the sphere prefab.
3) Remove the sphere collider component.
4) Load the sphere mesh and repeated fire material for the skinned mesh component. (The fire material has slightly higher X/Y tiling than 1.)
5) Add another sphere to be the same position of the first sphere (this new prefab can be put under the 1st sphere prefab for organization).
6) Remove the mesh filter and renderer of the 2nd sphere.
7) Reduce the radius of the 2nd sphere's sphere collider to around 0.3.
8) In the cloth component, load the 2nd sphere for the sphere collider.
9) Paint the bottom vertices of the cloth sphere to absolute constraint so it will never fly away from its initial position.
10) Have fun fiddling with the cloth parameters (which gave me blue screen of death at least thrice! Nice try, Unity.)
11) Add some particles (if you only have personal edition) or boom effect (if you have pro edition).

Cloth component values used in this scene:
http://www.geocities.jp/ifurkend/unity/unity_screenshot_cloth_fire_values.jpg

Source code of Scrolling UVs script:
http://wiki.unity3d.com/index.php?title=Scrolling_UVs
You will need to copy the code to a new text file (preferably in Notepad++) and save it to your Unity asset folder and name it "ScrollingUVs.cs".

In the ideal world I should make a new mesh which resembles real flame shape instead of using the built-in sphere mesh. Yeah, I'm just lazy. Also the softrim shader only supports 1 face, but maybe the mesh can be duplicated with reversed normals for 2 faces.







Tags:
Unity (Software)
Video Game Culture
flame
fire
3D Realms (Video Game Developer)
vfx
Burn
Visual Effects (Film Company Role Or Service)
Video Game (Industry)
Burning
Animation