Copy link to clipboard
Copied
Hi!
I'm quite used to expressions, scripting, and pixel bender, but I don't know about programming (yet...).
I have a bunch of pixel bender plugins that I'd like to be native Plugins. And I don't really know how to start...
I figured out how to set my parameters and controls, compile into .aex.
But I still don't understand how to get my pixels coordinates, transform them (with a matrix or simple operations) and then render them...
for example, in pixel bender, I would have:
float2x2 myMatrix = some matrix value...
float2 pos = outCoord();
pos = pos*myMatrix;
dst = sampleLinear(src,pos);
can I do it, for example, in the skeleton file?
I saw the "put your interesting code here"... but don't know how to write that code!
If anyone can tell me, just on that example, it would be great!!
Thanx
PS: or is there somewhere an example of something similar to the Geometry effect?
1 Correct answer
i'm not too familiar with pixel bender, but from what i can gather you want to push values into arbitrary pixels.
it can be done with the c++ api, but more easily you could pull values.
take a look at the "shifter" sample.
it iterates through the output samples, and pulls input values from other locations.
if you can to see how to push values to random pixels , checkout the "CCU" sample project.
it shows how to access a buffer pixel directly in RAM.
you can't however, push subpixel values to 4 adjacen
...Copy link to clipboard
Copied
i'm not too familiar with pixel bender, but from what i can gather you want to push values into arbitrary pixels.
it can be done with the c++ api, but more easily you could pull values.
take a look at the "shifter" sample.
it iterates through the output samples, and pulls input values from other locations.
if you can to see how to push values to random pixels , checkout the "CCU" sample project.
it shows how to access a buffer pixel directly in RAM.
you can't however, push subpixel values to 4 adjacent pixels.
not that it's impossible, i just don't know of any suite that does that.
Copy link to clipboard
Copied
Hi!
Thanx for your reply! I'll have a look at it. Also I just saw the next post, and I understand more the Effect/AEGP difference.
Copy link to clipboard
Copied
Hi!
I tried to dig into the SDK for a while now, and i think the GLator is the best base for me, as it is GPU accelerated.
But i have a few questions:
How do you switch the context from/to openGL and to/from AE?
Do you have a concrete example on how to do a black and white ramp from left to right?
For sure, rgb*colorDepth = x_coordinates/width, but how do you acces coordinates?
I saw examples on how to do it by rows/columns, but i think accessing coordinates directly is more efficient for what i need.
Any help will be highly appreciated! 🙂
Cheers,
Francois
Copy link to clipboard
Copied
i think this thread has some info on that:
http://forums.adobe.com/message/4674493
look for the messages by gutsblow.
Copy link to clipboard
Copied
Hi Shachar,
thanx for your answer.
I already tried to follow the instructions in this discussion, but i'm missing something in the beginning:
I cannot find where we define the context.
Let me precise:
it seems DaveProx's way is :
[[myOpenglView openGLContext] makeCurrentContext];
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
glShadeModel(GL_SMOOTH);
glEnable(GL_BLEND);
draw_scene();
glFlush();
But i can't find the place to put it in the whole code, cos' i couldn't guess where AE defines it's own context.
Can you help?
Or do you have a working framework for PC?
Thanx for your help!
Francois
Copy link to clipboard
Copied
sorry man, i never did any openGL coding.
post your question on said thread, hopefully the people with the answers
are still subscribed to it.
Copy link to clipboard
Copied
OK, thanx anyway!

Copy link to clipboard
Copied
Hi jkhgsruigh.
What Shachar wrote works fine.
I just create a hidden window and do all the opengl settings, then set my opengl context (I set it in objective c, but I think it should work both on windows and mac with proper code) like this:
(myOpenglView is an NSOpenglView object)
[[myOpenglView openGLContext] makeCurrentContext];
Then I do all my opengl drawings and flush the scene:
glFlush();
After that I use glReadPixels to grab the pixels and mix them with the input in AE - that works perfectly.
Remember, don't use global variables, beacuse your plugin won't use multithreading render properly - I had to rewrite mine...
The tricky part comes with the Premiere Pro. Because it crashes everytime when I use opengl code. I had to write my stand alone application which is my renderer, but it's slow
It works, but I want my plugin to work as fast as in After Effects.
That's why I try to find a way to switch/change/freeze AE/Premier context for the time of the opengl drawings - maybe that's the way to do opengl in Premiere Pro. I don't know.
I even started this thread couple weeks ago:
http://forums.adobe.com/thread/1102663?tstart=0
But noone could answer me. Maybe I'll find the answer in this thread
Hope this helps
Copy link to clipboard
Copied
Hi Dave,
thanx a lot for these infos. I have to go deeper into the openGL itself.
I think i took bad habits from Pixel Bender, where coding is soooooo simple...
About Premiere, i can only wish you good luck
Cheers,
Francois ("jkhgsruigh" isn't my real name

Copy link to clipboard
Copied
That's not your real name? Damn...
Hope, I'll find all the answers here.
Good luck Francois aka jkhgsruigh
Copy link to clipboard
Copied
Is it not easier and faster to use Render to Texture + Render buffers? no offence but glReadPixels is a little 90s!

Copy link to clipboard
Copied
I like 90s
No worries, it'll be changed, I'm in the thesting moment right now.
Btw thanks for the tip
Copy link to clipboard
Copied
Hi again!
I've been trying to understand how the GLator works, but something's still going wrong...
I could switch the context (thanx Dave!) but i still got a problem with the texture coordinates:
glBegin(GL_QUADS); //input frame
glTexCoord2f(0.0f,0.0f); glVertex3f(-0.5f * aspectF,-0.5f + yOffsetF,0.0f);
glTexCoord2f(0.7f,0.0f); glVertex3f(0.5f * aspectF,-0.5f + yOffsetF,0.0f);
glTexCoord2f(0.7f,0.46f); glVertex3f(0.5f * aspectF,0.5f + yOffsetF,0.0f);
glTexCoord2f(0.0f,0.46f); glVertex3f(-0.5f * aspectF,0.5f + yOffsetF,0.0f);
glEnd();
where do the TexCoord2f values come from? why 0.7 and 0.46? I tried to change thoses values to 1.0, 0.5, disabled the perpective, but i can't make the texture match the quad...
Any help?
Sorry for such a beginner's question...
Thanx,
François

