{"action":"created","issue":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/10093","repository_url":"https://api.github.com/repos/mrdoob/three.js","labels_url":"https://api.github.com/repos/mrdoob/three.js/issues/10093/labels{/name}","comments_url":"https://api.github.com/repos/mrdoob/three.js/issues/10093/comments","events_url":"https://api.github.com/repos/mrdoob/three.js/issues/10093/events","html_url":"https://github.com/mrdoob/three.js/pull/10093","id":188592394,"number":10093,"title":"Automatic Geometry instancing","user":{"login":"Benjamin-Dobell","id":482276,"avatar_url":"https://avatars.githubusercontent.com/u/482276?v=3","gravatar_id":"","url":"https://api.github.com/users/Benjamin-Dobell","html_url":"https://github.com/Benjamin-Dobell","followers_url":"https://api.github.com/users/Benjamin-Dobell/followers","following_url":"https://api.github.com/users/Benjamin-Dobell/following{/other_user}","gists_url":"https://api.github.com/users/Benjamin-Dobell/gists{/gist_id}","starred_url":"https://api.github.com/users/Benjamin-Dobell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Benjamin-Dobell/subscriptions","organizations_url":"https://api.github.com/users/Benjamin-Dobell/orgs","repos_url":"https://api.github.com/users/Benjamin-Dobell/repos","events_url":"https://api.github.com/users/Benjamin-Dobell/events{/privacy}","received_events_url":"https://api.github.com/users/Benjamin-Dobell/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-10T19:10:25Z","updated_at":"2016-11-10T19:15:22Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mrdoob/three.js/pulls/10093","html_url":"https://github.com/mrdoob/three.js/pull/10093","diff_url":"https://github.com/mrdoob/three.js/pull/10093.diff","patch_url":"https://github.com/mrdoob/three.js/pull/10093.patch"},"body":"When I first started using three.js I read that it supported instancing. It wasn't until I'd been using it for a while that I realised that you were supposed to use `InstancedBufferGeometry` to enable instancing. However, the issue with that is that your instances aren't actually part of the scene, it's pretty complicated for most users.\r\n\r\nThis on the other hand is turned on by default. Geometry will be batched and submitted to the GPU in one go as long as a browser supports the necessary extensions. An \"instancing texture\" is used (world and normal matrices encoded) when floating point vertex-shader accessible textures are available. On systems that don't support this, then the number of available uniforms will be detected and the necessary matrices will be pushed as arrays.\r\n\r\nI've tried to be careful not to break backwards compatibility. The only slight issue will be for those whom are using their own shaders. They'll want to add:\r\n\r\n```\r\n#include <common_vertex>\r\n```\r\n\r\nto the top their vertex shader. This has been done already for all built-in shaders.\r\n\r\nInstancing is turned on by default for opaque objects, but off for transparent ones. This is because in-order to effectively batch geometry you don't want to worry about z-sorting. Batching can be enabled for transparent objects if desired.\r\n\r\nPerformance can be tweaked by increases the instancing texture size (`setInstancingTextureSize( size )`. By default it's 64x64, which gives you batches of size 585. Bumping it to 128x128 will use ever so slightly more VRAM, but will allow for 2340 instances per batch.\r\n\r\nThe increase VRAM is pretty negligible, but pushing a larger texture can itself be less performant than a smaller one if most of your geometry only has a few instances. For this reason, there's `minInstancingBatchSize` which will cause geometry to be rendered without batching (no texture pushing) if there's less than `minInstancingBatchSize` instances viewable in a given frame.\r\n\r\nThese properties can be changed safely between rendering frames if desired.\r\n\r\nSensible defaults have been chosen, \r\n\r\nOf course, instancing can be disabled altogether by setting `autoInstancing` to `false`."},"comment":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/comments/259780451","html_url":"https://github.com/mrdoob/three.js/pull/10093#issuecomment-259780451","issue_url":"https://api.github.com/repos/mrdoob/three.js/issues/10093","id":259780451,"user":{"login":"Benjamin-Dobell","id":482276,"avatar_url":"https://avatars.githubusercontent.com/u/482276?v=3","gravatar_id":"","url":"https://api.github.com/users/Benjamin-Dobell","html_url":"https://github.com/Benjamin-Dobell","followers_url":"https://api.github.com/users/Benjamin-Dobell/followers","following_url":"https://api.github.com/users/Benjamin-Dobell/following{/other_user}","gists_url":"https://api.github.com/users/Benjamin-Dobell/gists{/gist_id}","starred_url":"https://api.github.com/users/Benjamin-Dobell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Benjamin-Dobell/subscriptions","organizations_url":"https://api.github.com/users/Benjamin-Dobell/orgs","repos_url":"https://api.github.com/users/Benjamin-Dobell/repos","events_url":"https://api.github.com/users/Benjamin-Dobell/events{/privacy}","received_events_url":"https://api.github.com/users/Benjamin-Dobell/received_events","type":"User","site_admin":false},"created_at":"2016-11-10T19:15:22Z","updated_at":"2016-11-10T19:15:22Z","body":"Oh, `drawMode` has been moved from `Object` to `Geometry` for the same reason... it didn't really make too much sense per object anyway."}}
{"actor":{"display_login":"Benjamin-Dobell"}}