{"action":"created","issue":{"url":"https://api.github.com/repos/gonetz/GLideN64/issues/970","repository_url":"https://api.github.com/repos/gonetz/GLideN64","labels_url":"https://api.github.com/repos/gonetz/GLideN64/issues/970/labels{/name}","comments_url":"https://api.github.com/repos/gonetz/GLideN64/issues/970/comments","events_url":"https://api.github.com/repos/gonetz/GLideN64/issues/970/events","html_url":"https://github.com/gonetz/GLideN64/issues/970","id":150666347,"number":970,"title":"N64 blending emulation","user":{"login":"gonetz","id":8983092,"avatar_url":"https://avatars.githubusercontent.com/u/8983092?v=3","gravatar_id":"","url":"https://api.github.com/users/gonetz","html_url":"https://github.com/gonetz","followers_url":"https://api.github.com/users/gonetz/followers","following_url":"https://api.github.com/users/gonetz/following{/other_user}","gists_url":"https://api.github.com/users/gonetz/gists{/gist_id}","starred_url":"https://api.github.com/users/gonetz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonetz/subscriptions","organizations_url":"https://api.github.com/users/gonetz/orgs","repos_url":"https://api.github.com/users/gonetz/repos","events_url":"https://api.github.com/users/gonetz/events{/privacy}","received_events_url":"https://api.github.com/users/gonetz/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":88,"created_at":"2016-04-24T14:28:55Z","updated_at":"2016-05-05T11:51:44Z","closed_at":"2016-05-05T11:51:44Z","body":"Goal: implement emulation of N64 blending modes with minimal hacks and heuristics.\r\n\r\nExplanation:\r\n\r\nBlending is a part of pixel pipeline. Color of incoming pixel interpolated with color of pixel in buffer to achieve various effects, mainly transparency.\r\nBlending process on N64 also blends incoming and stored colors, but not only that. N64 blending also can mix incoming color with two constant colors: fog color and blend color. This is used mainly to apply fog, but creative programmers used that option as additional stage of color combiner. Standard OpenGL blending is good enough to blend pixel and memory colors, but when it is first necessary to mix input color with constant colors, it fails.\r\n\r\nOpenGL blending is part of fixed functionality. Shaders cannot use blending. There are GL extensions, which actually allowed blending in shaders, but only when several conditions met. Shader-based blending is hardly possible with N64 emulation. Thus, currently GLideN64 uses legacy glN64 blending method. The correspondence between N64 blending modes and OpenGL ones is hardcoded. If blending mode mixes input color with constant colors, it is emulated in shader with special code.\r\n\r\nNew blending uses general method of blending emulation. No more hardcoded blending modes. All special code in shaders replaced by general blending functions. Note that it is not true “shader blending”. New method uses standard one-pass OpenGL blending with no extensions. It will work on all supported hardware without performance sacrifices. From the other side, shader can’t blend input color with memory color. Usually it is not necessary because standard blending will do the job. However, some crazy blend modes will _probably_ left unemulated.\r\n\r\nNew blending resides in experimental_blend feature branch. Binary to test:\r\nhttps://drive.google.com/file/d/0B0YqMPjGo3B2azZuTG9jX3pEaEU/view?usp=sharing\r\nVisually there should be no difference with master in 99.9% of cases. Please report about regressions in that ticket, not open a new one.\r\n"},"comment":{"url":"https://api.github.com/repos/gonetz/GLideN64/issues/comments/217135120","html_url":"https://github.com/gonetz/GLideN64/issues/970#issuecomment-217135120","issue_url":"https://api.github.com/repos/gonetz/GLideN64/issues/970","id":217135120,"user":{"login":"gonetz","id":8983092,"avatar_url":"https://avatars.githubusercontent.com/u/8983092?v=3","gravatar_id":"","url":"https://api.github.com/users/gonetz","html_url":"https://github.com/gonetz","followers_url":"https://api.github.com/users/gonetz/followers","following_url":"https://api.github.com/users/gonetz/following{/other_user}","gists_url":"https://api.github.com/users/gonetz/gists{/gist_id}","starred_url":"https://api.github.com/users/gonetz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonetz/subscriptions","organizations_url":"https://api.github.com/users/gonetz/orgs","repos_url":"https://api.github.com/users/gonetz/repos","events_url":"https://api.github.com/users/gonetz/events{/privacy}","received_events_url":"https://api.github.com/users/gonetz/received_events","type":"User","site_admin":false},"created_at":"2016-05-05T11:51:44Z","updated_at":"2016-05-05T11:51:44Z","body":"Merged to master"}}