It took me some time to figure out how CubicVR works, but now I have a basic understanding of its workings and was able to create a 0.1 release that isn't completely worthless. The issue was that when a material was initialized with an opacity of 1.0, it could not because changed because the shader was already setup not to do alpha blending for performance reasons. Subsequently, material that started opaque could never change.
My development proceeded in three steps. First, I created a tester page to recreate the bug so that I could test to see if my solutions had fixed it or not. This tester can be found here. I simply displayed two boxes on screen with the camera spinning around it with controls at the top to adjust one of the box's material's opacity, which started at 1.0. This tester was partially based off of the Normal Mapping render tester that was already on the repo.
The second step was a very simple fix by forcing all opaque objects to having blending on them. This fixed the issue but at a needless cost, so I had no intention of considering it an actual fix.
The final step was the development of the fix submitted as the 0.1 release. This fix kept track of whether or not the material had blending enabled on it, while the system was rendering the materials if it came across a material with blending not enable and an opacity below 1.0, the shader would be cast aside and a new one generated on the spot. Its obviously not the best solution, but it seems to work well enough for the time being.
Thursday, September 29, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment