-
Notifications
You must be signed in to change notification settings - Fork 153
nanovg Compositor + context.filter blur #1489
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
nanovg Compositor + context.filter blur #1489
Conversation
… into BNCanvasComposite # Conflicts: # Apps/Playground/Scripts/experience.js # Polyfills/Canvas/Source/Context.cpp # Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp
…nto BNCanvasComposite
1b849cf
to
13a3b8e
Compare
|
||
for (int i = 1; i <= 6; i++) | ||
{ | ||
vec2 offset = u_direction.xy * float(i); // TODO: normalize against u_viewSize.xy |
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.
Looks like I'm not setting u_viewSize
between filter passes. Or any uniforms for that matter (outside of the ones explicitly specified in setUniform
. Will fix.
EDIT: After abit more reading, I think I understand how to scale blur strength taking into account viewSize. WIP updated fragment shader.
Adds `filter` https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/filter This calls to BabylonNative as implemented in BabylonJS/BabylonNative#1489
e5cd68d
to
7ff2c0c
Compare
Have just pushed a couple of fixes. Notable changes/fixes include:
|
2d2dbd4
to
287ff01
Compare
I've just noticed that Gradient Text is broken in this branch. Have narrowed it down to sometime before the "filter stack PoC" commit. EDIT: Oh, it was just missing the 2nd texture in glnvg__triangles. Fixed! |
62c668f
to
d514391
Compare
Have pulled in |
FrameBufferPool
, enabling multi-pass composition innanovg_filterstack
context.filter
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/filterblur()
https://developer.mozilla.org/en-US/docs/Web/CSS/filter-function/blurThis PR takes over @CedricGuillemet's #1477
Comments from CedricGuillemet#9 addressed before opening this for review. Added comments for the ones which I haven't addressed.
RenderDoc shows filterstack correctly swapping between render targets for a 3-iterations (6 pass) blur.:

Will need to do abit of digging on weights to match how it looks on browser. Applying filter blur to couple of items in experience.js:

Also, on Babylon.js side, have raised a PR adding
filter
to context.BabylonJS/Babylon.js#16424