{"action":"created","issue":{"url":"https://api.github.com/repos/jdolan/quetoo/issues/237","repository_url":"https://api.github.com/repos/jdolan/quetoo","labels_url":"https://api.github.com/repos/jdolan/quetoo/issues/237/labels{/name}","comments_url":"https://api.github.com/repos/jdolan/quetoo/issues/237/comments","events_url":"https://api.github.com/repos/jdolan/quetoo/issues/237/events","html_url":"https://github.com/jdolan/quetoo/issues/237","id":181683378,"number":237,"title":"Bug fix / potential optimization for r_shadows 2","user":{"login":"jdolan","id":643118,"avatar_url":"https://avatars.githubusercontent.com/u/643118?v=3","gravatar_id":"","url":"https://api.github.com/users/jdolan","html_url":"https://github.com/jdolan","followers_url":"https://api.github.com/users/jdolan/followers","following_url":"https://api.github.com/users/jdolan/following{/other_user}","gists_url":"https://api.github.com/users/jdolan/gists{/gist_id}","starred_url":"https://api.github.com/users/jdolan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdolan/subscriptions","organizations_url":"https://api.github.com/users/jdolan/orgs","repos_url":"https://api.github.com/users/jdolan/repos","events_url":"https://api.github.com/users/jdolan/events{/privacy}","received_events_url":"https://api.github.com/users/jdolan/received_events","type":"User","site_admin":false},"labels":[{"id":37974277,"url":"https://api.github.com/repos/jdolan/quetoo/labels/enhancement:medium","name":"enhancement:medium","color":"207de5","default":false}],"state":"open","locked":false,"assignee":{"login":"Paril","id":1224734,"avatar_url":"https://avatars.githubusercontent.com/u/1224734?v=3","gravatar_id":"","url":"https://api.github.com/users/Paril","html_url":"https://github.com/Paril","followers_url":"https://api.github.com/users/Paril/followers","following_url":"https://api.github.com/users/Paril/following{/other_user}","gists_url":"https://api.github.com/users/Paril/gists{/gist_id}","starred_url":"https://api.github.com/users/Paril/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Paril/subscriptions","organizations_url":"https://api.github.com/users/Paril/orgs","repos_url":"https://api.github.com/users/Paril/repos","events_url":"https://api.github.com/users/Paril/events{/privacy}","received_events_url":"https://api.github.com/users/Paril/received_events","type":"User","site_admin":false},"assignees":[{"login":"Paril","id":1224734,"avatar_url":"https://avatars.githubusercontent.com/u/1224734?v=3","gravatar_id":"","url":"https://api.github.com/users/Paril","html_url":"https://github.com/Paril","followers_url":"https://api.github.com/users/Paril/followers","following_url":"https://api.github.com/users/Paril/following{/other_user}","gists_url":"https://api.github.com/users/Paril/gists{/gist_id}","starred_url":"https://api.github.com/users/Paril/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Paril/subscriptions","organizations_url":"https://api.github.com/users/Paril/orgs","repos_url":"https://api.github.com/users/Paril/repos","events_url":"https://api.github.com/users/Paril/events{/privacy}","received_events_url":"https://api.github.com/users/Paril/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/jdolan/quetoo/milestones/3","html_url":"https://github.com/jdolan/quetoo/milestones/1.0%20release","labels_url":"https://api.github.com/repos/jdolan/quetoo/milestones/3/labels","id":370139,"number":3,"title":"1.0 release","description":"1.0 release will include all 8 q2dmX remakes by Pan, new menus, and a generally stable, playable experience.","creator":{"login":"jdolan","id":643118,"avatar_url":"https://avatars.githubusercontent.com/u/643118?v=3","gravatar_id":"","url":"https://api.github.com/users/jdolan","html_url":"https://github.com/jdolan","followers_url":"https://api.github.com/users/jdolan/followers","following_url":"https://api.github.com/users/jdolan/following{/other_user}","gists_url":"https://api.github.com/users/jdolan/gists{/gist_id}","starred_url":"https://api.github.com/users/jdolan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdolan/subscriptions","organizations_url":"https://api.github.com/users/jdolan/orgs","repos_url":"https://api.github.com/users/jdolan/repos","events_url":"https://api.github.com/users/jdolan/events{/privacy}","received_events_url":"https://api.github.com/users/jdolan/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":112,"state":"open","created_at":"2013-07-03T23:35:45Z","updated_at":"2016-11-12T21:38:34Z","due_on":"2017-01-01T00:00:00Z","closed_at":null},"comments":0,"created_at":"2016-10-07T14:28:32Z","updated_at":"2016-11-12T22:00:18Z","closed_at":null,"body":"The planar shadows make extensive use of the stencil buffer. Each surface is rendered with a stencil value derived from its plane number. When shadows impact a plane, we draw that shadow with the stencil test for that plane number. The stencil buffer is only 8 bits, which leaves a maximum number of unique stencil values of 255. In fact, I think the way this worked out, I was only able to use 127 unique values:\n\n```\n    glStencilFunc(GL_ALWAYS, (surf->plane->num % 0xff) + 1, ~0);\n```\n\nThis results in shadows sometimes hitting a false positive for surfaces (planes) across the map. If you've ever seen a stray, nonsensical shadow, this is why. Exiting the water on Edge is an easy way to see this.\n\nSo.. what if we flipped a reserved bit on `surf->flags` whenever a shadow impacts that plane, and then check that reserved bit before applying glStencilFunc? For surfaces that are not impacted by a shadow, we would write `0` to the stencil buffer (or we could even disable the stencil buffer, if that yields a performance boost). We would have to add a simple loop in R_MarkBspSurfaces to reset this flag every frame.\n\nThis should fix the stray shadows, and maybe even provide a small framerate boost.\n"},"comment":{"url":"https://api.github.com/repos/jdolan/quetoo/issues/comments/260151251","html_url":"https://github.com/jdolan/quetoo/issues/237#issuecomment-260151251","issue_url":"https://api.github.com/repos/jdolan/quetoo/issues/237","id":260151251,"user":{"login":"jdolan","id":643118,"avatar_url":"https://avatars.githubusercontent.com/u/643118?v=3","gravatar_id":"","url":"https://api.github.com/users/jdolan","html_url":"https://github.com/jdolan","followers_url":"https://api.github.com/users/jdolan/followers","following_url":"https://api.github.com/users/jdolan/following{/other_user}","gists_url":"https://api.github.com/users/jdolan/gists{/gist_id}","starred_url":"https://api.github.com/users/jdolan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdolan/subscriptions","organizations_url":"https://api.github.com/users/jdolan/orgs","repos_url":"https://api.github.com/users/jdolan/repos","events_url":"https://api.github.com/users/jdolan/events{/privacy}","received_events_url":"https://api.github.com/users/jdolan/received_events","type":"User","site_admin":false},"created_at":"2016-11-12T22:00:18Z","updated_at":"2016-11-12T22:00:18Z","body":"The tricky part here is, in the shadow code, when a trace yields a shadow, you must mark the _renderer's_ copy of the impacted plane, so that the renderer can easily check the plane when drawing surfaces.\r\n\r\nWe currently do not have a `r_bsp_plane_t` type, but I would add one, that is essentially a `cm_bsp_plane_t` with a bit mask field for renderer state / flags such as this."}}
{"actor":{"display_login":"jdolan"}}