{"action":"created","issue":{"url":"https://api.github.com/repos/AnalyticalGraphicsInc/gltf-pipeline/issues/113","repository_url":"https://api.github.com/repos/AnalyticalGraphicsInc/gltf-pipeline","labels_url":"https://api.github.com/repos/AnalyticalGraphicsInc/gltf-pipeline/issues/113/labels{/name}","comments_url":"https://api.github.com/repos/AnalyticalGraphicsInc/gltf-pipeline/issues/113/comments","events_url":"https://api.github.com/repos/AnalyticalGraphicsInc/gltf-pipeline/issues/113/events","html_url":"https://github.com/AnalyticalGraphicsInc/gltf-pipeline/pull/113","id":162538230,"number":113,"title":"Added option to bake AO to vertices","user":{"login":"likangning93","id":5395255,"avatar_url":"https://avatars.githubusercontent.com/u/5395255?v=3","gravatar_id":"","url":"https://api.github.com/users/likangning93","html_url":"https://github.com/likangning93","followers_url":"https://api.github.com/users/likangning93/followers","following_url":"https://api.github.com/users/likangning93/following{/other_user}","gists_url":"https://api.github.com/users/likangning93/gists{/gist_id}","starred_url":"https://api.github.com/users/likangning93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/likangning93/subscriptions","organizations_url":"https://api.github.com/users/likangning93/orgs","repos_url":"https://api.github.com/users/likangning93/repos","events_url":"https://api.github.com/users/likangning93/events{/privacy}","received_events_url":"https://api.github.com/users/likangning93/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":42,"created_at":"2016-06-27T20:16:08Z","updated_at":"2016-07-05T17:43:43Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/AnalyticalGraphicsInc/gltf-pipeline/pulls/113","html_url":"https://github.com/AnalyticalGraphicsInc/gltf-pipeline/pull/113","diff_url":"https://github.com/AnalyticalGraphicsInc/gltf-pipeline/pull/113.diff","patch_url":"https://github.com/AnalyticalGraphicsInc/gltf-pipeline/pull/113.patch"},"body":"I added an option to bake AO to vertices! After a lot of experimentation, I ended up with this approach:\r\n\r\nBy default AO is computed at each triangle center, adding the contribution to each of the triangle's vertices, and then averaging the contribution in each vertex over the number of samples that contributed to it.\r\n\r\nTo produce better results over models with low tesselation, the triangles can be supersampled on a grid. Basically, each triangle gets \"rasterized\" into its own plane in model space, and then each \"pixel\" in the triangle gets raytraced. I think this is actually superior to naive tesselation since many building models will have triangles of varying sizes, and this kind of enforces a uniform number of samples per unit area. It also conveniently lets us use a lot of the existing code for baking AO to textures.\r\n\r\nHere's the straight AO for a building model with a resolution of 5 sample points per unit area and 16 rays per sample point.\r\n\r\n![building_reso_5](https://cloud.githubusercontent.com/assets/5395255/16394117/99ab43a4-3c81-11e6-841c-081c6b24fd72.PNG)\r\n\r\nIt took almost 4 hours to bake because the building is quite big in model space (so lots of sample points), but hopefully speeding up intersection tests will get that down to something reasonable. Also, a version with just 1 sample point per unit area rendered in around 8 minutes and doesn't look too different unless you flip between identical images of the two. Blended with dynamic lighting, the difference would probably be pretty low on this model. When things are faster we should do some experiments to assess the runtime/quality tradeoff.\r\n\r\n![building_reso_2](https://cloud.githubusercontent.com/assets/5395255/16394131/ad1c5126-3c81-11e6-8e77-b4075f9f2379.PNG)\r\n"},"comment":{"url":"https://api.github.com/repos/AnalyticalGraphicsInc/gltf-pipeline/issues/comments/230549532","html_url":"https://github.com/AnalyticalGraphicsInc/gltf-pipeline/pull/113#issuecomment-230549532","issue_url":"https://api.github.com/repos/AnalyticalGraphicsInc/gltf-pipeline/issues/113","id":230549532,"user":{"login":"likangning93","id":5395255,"avatar_url":"https://avatars.githubusercontent.com/u/5395255?v=3","gravatar_id":"","url":"https://api.github.com/users/likangning93","html_url":"https://github.com/likangning93","followers_url":"https://api.github.com/users/likangning93/followers","following_url":"https://api.github.com/users/likangning93/following{/other_user}","gists_url":"https://api.github.com/users/likangning93/gists{/gist_id}","starred_url":"https://api.github.com/users/likangning93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/likangning93/subscriptions","organizations_url":"https://api.github.com/users/likangning93/orgs","repos_url":"https://api.github.com/users/likangning93/repos","events_url":"https://api.github.com/users/likangning93/events{/privacy}","received_events_url":"https://api.github.com/users/likangning93/received_events","type":"User","site_admin":false},"created_at":"2016-07-05T17:43:43Z","updated_at":"2016-07-05T17:43:43Z","body":"Updated!"}}
{"actor":{"display_login":"likangning93"}}