2013年3月12日 星期二

Upgrade NME and Haxe3

After alias nme
sudo haxelib run nme setup

Got this error:
Called from native/media/SoundChannel.hx line 138
Called from native/Loader.hx line 63
Called from C:\Program Files (x86)\HaxeFoundation\haxe/std/neko/Lib.hx line 30
Uncaught exception - load.c(357) : Primitive not found : /usr/lib/haxe/lib/nmedev/3,6,0//ndll/Mac/nme@nme_sound_channel_set_position(2)

You need to rebuild native library to fixed it.
sudo haxelib run nme rebuild mac

2012年12月10日 星期一

Stage3D: 2D Particle Random Motion [optimized]

I just updated some code of my last demo and optimized it by reducing draw calls.
Now it can render over large number of particle(500,000+).

Here are some optimization:
  • reduce draw call
  • upload minimum of constants

2012年11月21日 星期三

Stage3D Limitation and Optimization

Stage3D AGAL Limitation:
  • The VertexBuffer is limited to 65535 vertex.
  • The IndexBuffer is limited to 983040 index.
  • In theory, you could have up to 983040/3 = 327680 triangle in one draw call.
  • In particle(using quads), you could have up to 65535/4 = 16383 particle max per draw call.
  • Shaders length can only contain a maximum of 200 opcodes.
  • The drawTriangles limited to 32768 calls per present call.

Optimization:
  • reduce draw call.
  • reuse material and batch rendering.
  • upload minimum number of constants.