We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › Edge-blended projectors using OGL
Page Index Toggle Pages: 1
Edge-blended projectors using OGL? (Read 1720 times)
Edge-blended projectors using OGL?
Mar 23rd, 2010, 10:38am
 
Hi all,

I'm just starting an app that will run on a dual-head projector and have been experimenting with whether I could easily implement edge-blending for this.  

I know how to do it in principle, and have done tests with the simple "copy()" comand, but obviously that's slow and tedious.  So I was wondering where to look for resources that can help me do it at a lower level, perhaps with OGL off-screen buffers or hardware remapping of screen coordinates?

Essentially I'd like my app to behave as though it is one large, continuous canvas (almost 2048x768) but anything rendered in the band from say 924 - 1024 would also automatically appear at 1024-1124, and the entire right hand side of the app would be shifted over by 100 pixels.  So if I had an object at coordinate 1500, it would actually show on the screen at 1600.  And an object drawn to 1000 would appear at both 1000 and 1100.

Any ideas would be helpful.  I will look into the available GL libraries   and maybe something there with off-screen buffers and array copying will help make this fast, low-level and automatic - I'm imagining it's something that gets done after the last command in my 'draw' loop.

Anyone have thoughts on this or know if it's been implemented already?

Thanks!
<M>
Re: Edge-blended projectors using OGL?
Reply #1 - Mar 23rd, 2010, 9:15pm
 
I don't know how to set it up and make it work from Java, but I'm thinking you could do it with a pixel shader (maybe using an extra texture).

Output 'looks like' this (single wide image, left side will go to left projector, right side will go to right projector)

AAAAAAAaaa|bbbBBBBBBB
AAAAAAAaaa|bbbBBBBBBB
AAAAAAAaaa|bbbBBBBBBB
AAAAAAAaaa|bbbBBBBBBB

A: source pixels displayed 'as-is'
a: source pixels 'fading out' (going to the right)
b: source pixels 'fading in' (going to the right)
B: source pixels displayed 'as-is'
b & B: source pixels displaced horizontally (grabbed from lesser x coordinate)

So, what do we need? Dimming and x-displacement. Easy enough. Create a texture that uses, say, red and green channels to indicate dimming and displacement, or perhaps some parameters to the shader which allow it to calculate for itself how much overlap to use and the falloff gradients - this is probably more practical, so you can adjust the overlap to match the projectors instead of the other way around!

I have a feeling it may be convenient to displace BOTH sides towards the centre (that is, displace the left display towards the right and the right display towards the left), especially if you are rendering 3D, else the vanishing point won't be in the middle.

You might have some problems with the falloff gradients - if you use a linear gradient, I'm guessing that won't account for brighter colours not being (visibly) linearly brighter than darker colours. Maybe it isn't so bad, and maybe you already have this problem sorted! (If so, do share.)

-spxl
Re: Edge-blended projectors using OGL?
Reply #2 - Mar 27th, 2010, 4:51am
 
Have a look here this explains the color calculations for the gradients.

http://local.wasp.uwa.edu.au/~pbourke/texture_colour/edgeblend/

For an implementation you can look into my creative computing lib, this implements the calculations inside a pixelshader including adjustments to the gradient and gamma correction. It is used in several projects and works really well.

edgeblender
http://code.google.com/p/creativecomputing/source/browse/trunk/cc.creativecomput...

test
http://code.google.com/p/creativecomputing/source/browse/trunk/cc.creativecomput...

shader
http://code.google.com/p/creativecomputing/source/browse/trunk/cc.creativecomput...

This is not a finished procesing sketch of course but hopefully gives you an idea. I am working on a processing version of creative computing right now. The code is already working in processing but needs more documentation an examples.
Re: Edge-blended projectors using OGL?
Reply #3 - Mar 27th, 2010, 5:54am
 
hey chris, this is pretty nice. didnt know CC was capable of edge blending.
Page Index Toggle Pages: 1