More Unity3D to flash conversions

February 17th, 2012 by Slav

I recently downloaded the latest version of Unity 3D 3.5 demo – release candidate 1 to further test the flash export capabilities. I have to say I was impressed and it’s certainly a big step forward – long list of bugfixes and some new implemented features speaks for itself.

To test the flash conversion I made the 2 demos.

Click on the images to play demos.

Car demo

First it’s just a very simple demo with high poly car model, plane , camera and one directional light. I wanted to see how the dynamic shadows would be rendered and whether the high poly model would cause any performance issues. It’s using standard fps controler and a mouse look for the camera. To get reasonable looking dynamic shadows shadow resolution had to be “Very high Resolution” and also Shadow distance in Quality settings had to be increased to 300. Otherwise shadow started to disappear if you moved even slightly away from the car with the camera.

PROs:

Model renders smoothly and fast enough (as expected if you have good GPU).

Lens flare effect on the light now renders correctly

CONs

There’s a banding effect on the shadowed area both on the floor texture or inside of the car

Some materials were not correctly transferred from the max files

Car racing tutorial demo

NOTE : PLEASE DRIVE SLOWLY OTHERWISE SCENE WILL STOP RENDERING!

This was the conversion of a racing game tutorial . This is of course much more complex example and there were multiple issues with this conversion. Quite a lot of issues had to do with terrain object, which is currently not supported for flash platform build target. Removing Terrain, solved about a half of the compiler errors, but I had to remove also parts of code that referenced it, and with it also code that check the rendering and hiding the objects that don’t need to be rendered.

There were compiler errors that had to do with classes of the same name being defined twice. For example SoundControler was a class in C sharp but also in Javascript. Or Skidmarks was defined as a C sharp class but existed also as a shader under the same name.

I think it’s a pity that Terrain object isn’t supported as it brings a lot of convenience to the environment creation. I think there already must be an algorithm to converted it to mesh and apply textures ? As GPU can only work with polygons ? Why not do that for flash conversion as well and have a settings to how much detail would terrain have?

Ok, so here are some cons and pros

PROs

car runs pretty smoothly all the physics and lightning works quite nicely

lens flare now works fine as well

CONs

the same banding effect on the shadowed areas

no car sound effects only when collision occurs

for some reason if you speed up with the car it will stop rendering scene (ok this one might have to do with me disabling some parts of the script to get rid of compiler bugs : – ) )

there’s a slight space between the shadow and an object casting that shadow (you can notice that on the wheels for example)

10 Responses

I Think it is good news for Flash platform that other engines such Unreal goes to export Accelerated GPU Flash.
one of limitation of unity export is that it does not stream the swf based on levels, means it does not produce swf for every scene or level so final swf file getting big .

Farid, that’s quite easily fixable actually. What you can do with Unity, is to divide your game into different scenes. Then you can export each scene to a separate swf movie.
Then you can create a flash loader / wrapper that will load each scene separately.
In my next post I will write about possibilities of communicating of unity scene with such flash wrapper and communicating of flash wrapper with unity scene.

Excellent post. I was checking constantly this blog and I am impressed!
Extremely useful information particularly the last part I care for such info a lot.
I was looking for this certain information for a very long time.
Thank you and good luck.

I just want to point out I am newbie to blogging and actually beloved
this world wide web-internet site. Very possible I’m probably to bookmark your blog
site . You essentially occur with advantageous stories.