Conversation
Rectangle2D supports a second set of normals. Fixed world space corner calculation for head to eye matrices.
|
At a first glance it looks ok! I still have to look in depth and test it myself though (and also some cosmetic changes like using spaces instead of tabs)
I have yet to understand what it is doing, was the 3.5f found by trial and error or a mathematically correct value? Update: Oh I see, IIRC you're using that line to "hide" the second instance? |
|
The 3.5f was a number which needed to be high enough to hide the second instance. It doesn't have to be that value. Edit: If there are comments lacking, please point those places out. I'll add them. |
Write them down and tell me so we add comments to those places. Indeed that is a problem and I often document internal code when someone mentions it
That wouldn't be your fault, nor a shader language feature either. We in Ogre force instances to be x2 for stereo rendering (aka instanced viewport). That way we can send everything to both eyes with a single CPU pass (vertices still get processed twice though, but with better cache friendliness) |
|
OK so I took a deeper look. Overall very good! I can't believe how I missed all these simple little things. I need to make a couple small fixes and merge it manually. If I don't do it by next week ping me again, I may forget. Regarding the "TODO" hack... I've been thinking. Fixing it "properly" would involve a more complex fix, because either
Given that this looks like an edge case where... 8 extra vertices are being rendered (that's literally nothing to a GPU), I think it's the best solution to just send them offscreen like you're doing so they don't burn pixel shader time. |
;-) |
3904aa1 to
da6dbf9
Compare
76d820e to
03fbfb6
Compare
2ee1c83 to
8b3ddcc
Compare
49c451d to
84c07a0
Compare
a3c7671 to
67f9fdd
Compare
Rectangle2D supports a second set of normals.
Fixed world space corner calculation for head to eye matrices.
Also tested without instancing. Still works without OpenVR projects.
One thing: There is a TODO in the shader code which must still be fixed. But currently I have the feeling that you do know more about this.