-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add another VBO for selected aircraft to draw them after water #3965
base: master
Are you sure you want to change the base?
Conversation
Can confirm this works as expected. |
…r and we want to avoid distortion at the cost of some slight color tinting of aircraft
I tested it and works, but I see you say the depth test seems not to work, but if you add PolygonOffset you can see it actually affects the lines. line 136 selectShader:SetUniform("iconDistance", 99999) -- pass
+ gl.PolygonOffset( 150 , 150 ) line 161 glTexture(0, false)
+ gl.PolygonOffset(false)
Just set 150, 150 so seemed to have some effect btw, no idea how that works :D |
What I meant is that depth test in the DrawWorldPreUnit pass does not seem to work. As terrian does not occlude selection circles (which I am OK with) |
Right, the gl.DepthFunc must have been set to something special, trying gl.DepthTest(GL.LEQUAL) makes them occlude. I think it also has DepthMask disabled. |
Anyways, don't you think the fact with this PR selection draw on top of the air units is a problem? I believe selection should be drawn below units. With DrawWorldPreUnit they get drawn before units, so the selection can be drawn without really checking the depth buffer or even writing to it. With DrawWorld this can't be done, so air unit wings, at least with figs, go below the selection that looks a bit weird imo. Ie, like the "no offset" image above. I think PolygonOffset, or maybe something like Regarding PolygonOffset I'm not sure what's the right values to pass, with the shader I'm also not sure if that's the right way to offset the depth fragment, but testing that seems to give a good balance of drawing selection below wings but also looking ok when looking at air units from the front. With this it can look more like the "offset" image that imo is better if you can manage to get the right parameters. |
Polygonoffset is considered deprecated, note how the lua api now has a ZPULL define for this exact role. Ty for the depthtest tip though! |
Work done
Aircraft, due to often being much higher up in Z, are now drawn in DrawWorld instead of DrawWorldPreUnit to prevent water distortion from affecting them. Note that this causes subtle other rendering problems later, but meh.
BEFORE:
AFTER:
@bcdrme pls