Help with overlaying textures using Screen('DrawTexture') so they have equal alpha/luminance
1 view (last 30 days)
Show older comments
I need to present 4 seperate oriented gratings (vert, hoz, diag left, diag right), each presented at the same location, overlayed over one another such that the final image has each orientation's luminance equal. They can't be combined into one single blended image, as I need to present each grating at different timings, but at points they overlap, and when they do I need them to be presenting equal luminance across the 4 textures.
So in short, I need to draw 4 textures, one over the top of the other, but can't find how I should set each one's alpha based on their order of drawing such that the final image has each texture's luminance equally presented.
I am using Screen(expScreen,'BlendFunction',GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
And Screen('DrawTexture')
I assume that if the first grating drawn has a globalAlpha set at 1, the second drawn on top should have globalAlpha set at 0.5. Thus the two textures have equal luminance presented. Where I am confused is what to set the third and fourth textures' alphas?
Code for reference is:
Screen('FillRect', expScreen, background_colour, originalrect);
Screen('DrawTexture', expScreen, grat_text_hh,[0 0 stimW stimW], pos_grat, vert_ang,[],1);
Screen('DrawTexture', expScreen, grat_text_hh,[0 0 stimW stimW], pos_grat, hor_ang,[],0.5);
Screen('DrawTexture', expScreen, grat_text_hh,[0 0 stimW stimW], pos_grat, dgl_ang,[],?);
Screen('DrawTexture', expScreen, grat_text_hh,[0 0 stimW stimW], pos_grat, dgr_ang,[],?);
Is there a formula for setting globalAlphas such that each texture drawn in the same location end up with equal luminance depending on the order that they are drawn/coded in?
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!