{"action":"created","issue":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/6263","labels_url":"https://api.github.com/repos/mrdoob/three.js/issues/6263/labels{/name}","comments_url":"https://api.github.com/repos/mrdoob/three.js/issues/6263/comments","events_url":"https://api.github.com/repos/mrdoob/three.js/issues/6263/events","html_url":"https://github.com/mrdoob/three.js/pull/6263","id":63080506,"number":6263,"title":"Modification of LightMap and addition of AOMap to Materials.","user":{"login":"bhouston","id":588541,"avatar_url":"https://avatars.githubusercontent.com/u/588541?v=3","gravatar_id":"","url":"https://api.github.com/users/bhouston","html_url":"https://github.com/bhouston","followers_url":"https://api.github.com/users/bhouston/followers","following_url":"https://api.github.com/users/bhouston/following{/other_user}","gists_url":"https://api.github.com/users/bhouston/gists{/gist_id}","starred_url":"https://api.github.com/users/bhouston/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhouston/subscriptions","organizations_url":"https://api.github.com/users/bhouston/orgs","repos_url":"https://api.github.com/users/bhouston/repos","events_url":"https://api.github.com/users/bhouston/events{/privacy}","received_events_url":"https://api.github.com/users/bhouston/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":23,"created_at":"2015-03-19T20:10:59Z","updated_at":"2015-03-26T21:53:34Z","closed_at":"2015-03-26T21:53:29Z","pull_request":{"url":"https://api.github.com/repos/mrdoob/three.js/pulls/6263","html_url":"https://github.com/mrdoob/three.js/pull/6263","diff_url":"https://github.com/mrdoob/three.js/pull/6263.diff","patch_url":"https://github.com/mrdoob/three.js/pull/6263.patch"},"body":"This PR requires some discussion I believe.\r\n\r\nPreviously we were treating lightMap as something that modulates the outgoingLight from a surface.  This is not the normal definition of a lightMap as treated in other game engines.  Usually a lightMap contributes outgoing light from a surface via being modulated with the surface color.  Thus I have made this change.\r\n\r\nBut to accommodate the previous use case of lightMap (where it modulated the outgoingLight), I've added ambientOcclusionMap which does directly modulate the outgoingLight from a surface.  I have added an ambientOcclusionScale as well that varies the degree to which the light is modulated by the ambientOcclusionMap - where 0 is no darkening, while 1 is full darkening based on the map.  Values greater than 1 are allowed but could lead to non-physical results.\r\n\r\nTo be specific, the way that ambientOcclusionMap has been implemented is that it modulates the outgoingLight after the main lighting equation, thus it modulates both diffuse and specular and emissive contributions.  It is arguable whether this is fully correct, but it does minimic exactly the previous implementation for the outgoingLight modulating lightMap.\r\n\r\nWith this change ThreeJS treats both lightMaps and ambientOcclusionMaps in a similar fashion to other game engines.\r\n\r\nWhile doing this change I have pulled apart the handling of both UV and UV2 varyings in the fragment and vertex shaders.  They are no longer part of map and the lightmap glsl shaders pieces, but rather are the own pieces.  This is clearer  but these two variables (UV and UV2) are really shared varyings, not tied to a specific map.\r\n\r\n/ping @WestLangley "},"comment":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/comments/86731524","html_url":"https://github.com/mrdoob/three.js/pull/6263#issuecomment-86731524","issue_url":"https://api.github.com/repos/mrdoob/three.js/issues/6263","id":86731524,"user":{"login":"mrdoob","id":97088,"avatar_url":"https://avatars.githubusercontent.com/u/97088?v=3","gravatar_id":"","url":"https://api.github.com/users/mrdoob","html_url":"https://github.com/mrdoob","followers_url":"https://api.github.com/users/mrdoob/followers","following_url":"https://api.github.com/users/mrdoob/following{/other_user}","gists_url":"https://api.github.com/users/mrdoob/gists{/gist_id}","starred_url":"https://api.github.com/users/mrdoob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrdoob/subscriptions","organizations_url":"https://api.github.com/users/mrdoob/orgs","repos_url":"https://api.github.com/users/mrdoob/repos","events_url":"https://api.github.com/users/mrdoob/events{/privacy}","received_events_url":"https://api.github.com/users/mrdoob/received_events","type":"User","site_admin":false},"created_at":"2015-03-26T21:53:34Z","updated_at":"2015-03-26T21:53:34Z","body":"Nice! Thanks!"}}