Skip to content
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

more efficient glow - single render #292

Open
jeromeetienne opened this issue Apr 26, 2013 · 0 comments
Open

more efficient glow - single render #292

jeromeetienne opened this issue Apr 26, 2013 · 0 comments

Comments

@jeromeetienne
Copy link
Owner

TODO to do a single render, which output color + depth + stencil. in this render, i fill stencil with the pixel which should glow, then i do a pass with this output to do the blur, get i merge with the original color texture ?

lmg: renderer.clear() has 3 flags
[3:55pm] lmg: .clear( color, depth, stencil )
[3:55pm] jetienne: https://github.com/mrdoob/three.js/blob/master/src/renderers/WebGLRenderTarget.js#L32 <- 'this.shareDepthFrom = null;' it looks like it may be possible to share depth
[3:55pm] jetienne: lmg: got it
[3:55pm] jetienne: (btw i dunno stencil either) 
[3:55pm] lmg: it might be just what you need, stencil
[3:56pm] lmg: if you manage to fill it in render1
[3:56pm] lmg: unfortunatly I don't know enough about threejs' internals to be of real help here 
[3:57pm] lmg: prolly only used for shadows.
[3:57pm] jetienne: describe the process, i will try to do the three.js support part later 
[3:57pm] jetienne: thinking bokeh may have stuff like that… is it crazy
[3:57pm] lmg: well it's much like lighting, just the other way round
[3:58pm] lmg: every glowing face that is visible from the camera needs to set its stencilbuffer "pixel" to, say, white
[4:00pm] jetienne: ok
[4:00pm] • jetienne is searching the web to find an 'stencil buffer' intro 
[4:02pm] jetienne: http://en.wikibooks.org/wiki/OpenGL_Programming/Stencil_buffer seems cool
[4:05pm] jetienne: this is a very good page even
[4:06pm] jetienne: oh i think i get it
[4:07pm] jetienne: lmg: you want me to do a single render, which output color + depth + stencil. in this render, i fill stencil with the pixel which should glow, then i do a pass with this output to do the blur, get i merge with the original color texture ?
[4:07pm] lmg: exactly, saving you the extra render
[4:07pm] jetienne: thus i do only one pass of rendering geometry
[4:07pm] • lmg nods
[4:07pm] jetienne: lmg: cool! i got it 
[4:07pm] jetienne: thanks a bunch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant