-
-
Notifications
You must be signed in to change notification settings - Fork 124
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
Screen effects blending #316
base: master
Are you sure you want to change the base?
Conversation
I wonder if un-deprecating |
@@ -696,7 +743,14 @@ procedure TCastleScreenEffects.RenderOverChildren; | |||
AttribTexCoord.EnableArrayVector2(SizeOf(TScreenPoint), | |||
OffsetUInt(ScreenPoint[0].TexCoord, ScreenPoint[0])); | |||
|
|||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4); | |||
if Blending then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized that the condition for this should be if Blending and "this is the last effect, rendered on screen" then
...
I.e. the intermediate effects, that reuse FBOs, should not use blending (instead, they should rely on TCastleSimpleBackground
clearning the contents).
Please extend the RenderOneEffect
routine with additional parameter const RenderToScreen: Boolean
.
Then it should be used with false
in the loop, RenderOneEffect(GetScreenEffect(I), false);
And used with true
for final render, RenderOneEffect(GetScreenEffect(CurrentScreenEffectsCount - 1), true);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in bebc407 !
Going forward, I want to add similar
Yes, but I hesitate about the name. It was originally deprecated, because in almost all cases it is simpler to use |
Michalis, note there seems to be one more issue with the current approach https://discord.com/channels/389676745957310465/389676745957310467/862193035109466132 - it doesn't harm my usecase (monochrome effect) in any way, but may be unexpected for other users. TL;DR - incoming color in the shader has always alpha = 1 (i.e. the alpha from the unaltered image is discarded). |
1 - done in bebc407 2 - done in b0dfda8 3 - As in https://castle-engine.io/apidoc-unstable/html/CastleRenderContext.TRenderContext.html#Clear - I believe something like
|
|
|
Fix merge conflict # Conflicts: # examples/screen_effects/screen_effects_demo/screen_effects_demo_standalone.lpr # examples/screen_effects_demo/screen_effects_demo_standalone.dpr # examples/screen_effects_demo/screen_effects_demo_standalone.lpr # src/x3d/opengl/castlescreeneffects.pas
(fix merge conflict) # Conflicts: # .gitignore
Implement and example for Screen Effects Blending according to @michaliskambi suggestions at https://discord.com/channels/389676745957310465/389676745957310467/861898173034397697
Fixes #315