Showing posts with label app. Show all posts
Showing posts with label app. Show all posts

Monday, January 14, 2013

P.R.O.B.E. 裡的六角世界


考慮了很久,文情並茂的記錄實在不是我的風格,所以還是決定用「非常簡潔」的方式來記錄描述六角形的數學。










我真是超懶的。

Friday, October 19, 2012

詭異的 iCloud

現在寫的 App 支援 iCloud,因為儲存的格式改變,得先把已存在 iCloud上的資料清除,然後上傳新的格式來對應新的改變(還在開發階段,所以沒有相容的問題)。鬼打牆了幾個小時後終於開始運作了。

測試的 device 分別是含iOS 5 的iPhone 4,和已經更新 iOS 6 的 new iPad。我遇到的問題是這樣:
  • 移除App後,用 iPad的Settings清掉iCloud的資料。(Settings -> iCloud -> Storage & Backup -> Manage Storage -> Your App under "Documents & Data")
  • 移除 iPhone 上的 App。
然後開始在 iPad 上測試,詭異的事情發生了,設定裡已經看不到舊的資料,但是執行程式時

[[NSFileManager defaultManager] isUbiquitousItemAtURL:url];

卻一直傳回TRUE,表示這個資料已經存在,而且還真的存在,會讀到舊的資料然後因為格式不符而執行異常。但是在 iPhone 上試的話則回傳 FALSE,因此 App 就做份新的資料並上傳。實在沒時間深究原因,最後就直接用 iPhone 上傳,然後再用 iPad測試,終於正常了。




iOS 5 的 iCloud 很怪,居然缺了最基本的功能,導致在 iOS 5 上需要至少一個檔案在 iCloud 上,然後監視這個檔案的狀態來做對應的處置(比如 user 登出iCloud)。雖然 iOS 6 解決了這個問題 (NSUbiquityIdentityDidChangeNotification of NSFileManager),但是我不想寫兩份code啊!

Wednesday, April 4, 2012

2d shadows with multiple light sources


On iPhone4 with retina, render 3 objects with 5 point light sources. To test the limitation of GPU, I achievement this by 4 passes:

  1. render every objects on a texture (shadow map).
  2. render background on the frame buffer.
  3. render point light one by one, multiple pixel color with alpha on shadow map (shifted coordinate).
  4. render all object again.
This scene can be rendered in 30+ fps. I think it can be better with more optimization, but the defer method seems not good on this platform.


當二維的場景需要影子時,大概都會直接貼圖搞定吧,這次碰到可能需要多光源的情況,就想試試 defer rendering   加 shadow map  的效果,雖然伙伴們說應該不會碰到這種情況,但是我手癢,所以就花了一天亂試,效果還不錯,但是效能上需要改善,主要的瓶頸大概是:

  • alpha blending 讓 tile based defer rendering 沒辦法加速。
  • fill rate,在我的 iPhone4上,5 個batch填 130x100x100x4 pixels, 差不多是60fps的極限(大約可以填滿八個retina 全螢幕)。
  • batch,defer shading 的大量光源需要大量的 batch。我用 40個batch畫 100x100x4 pixels,就開始不到 60fps了。