Skip to main content
igorr60572095
Inspiring
August 2, 2018
Answered

Why is rendering layer different between GPU mode and Software mode during preview?

  • August 2, 2018
  • 1 reply
  • 1354 views

Hi, everyone.

I have strange problem on GPU mode.

I am creating a gpu accelerated plugin But I can not complete the plugin because of the problem.

PROBLEM:

Please take a look to following screenshot in detail. they are layers  when during preview(it is being played) on gpu mode and software mode.

As you can see, there are black pixels on the edge which has opacity on gpu mode. (there is big different with software mode).

I am not sure how premiere core works on gpu mode and software mode.

Would you let me know in detail? Can I get layer on gpu mode which is same as software mode?

Regards,

Igor.

This topic has been closed for replies.
Correct answer kylep76948477

thanks for your replay.

I understood what you mean.

I'd like to explain with gpu code in detail.

prSuiteError Render(

const PrGPUFilterRenderParams* inRenderParams,

const PPixHand* inFrames,

csSDK_size_t inFrameCount,

PPixHand* outFrame)

{

     ...

}

As you know, I read pixel data from inFrames and apply some effects and put it to outFrame.

But I cannot apply some effects that I want because there is the problem when I read pixel data from inFrames. .

This is when during preview.

This is when not previewed.

I detect edges of the layer and expand it to specific direction to specific length. (Longshadow plugin).

But it is detected black pixels with high opacity not white color which is main color of the layer. (during preview).

How can I fix this problem?

Regards,

Igor.


While it's possible that there is some underlying Premiere bug here, to me it looks like this is just a natural result of what you're trying to do...

My guess is you're scaling some straight alpha text cutout which is likely black where alpha = 0. That's causing the interpolated pixels along the text edge in the new image to be partly black/alpha filled. (the pixels will be a weighted average of white + 100% alpha with black + 0% alpha..)

The scaling premiere uses when rendering (or when selecting High Quality Playback) will be more sophisticated and more sensitive to not blurring edges than the one during regular preview playback - but I suspect in both cases you will have this effect to an extent. (It does look like you still have some amount of this black-border effect in the original images you provided running in software mode). The GPU non-high-quality case is probably the worst just because it uses a basic bi-linear scalar (which is very fast for GPU rendering)


The solution would be to use an image with premulitplied alpha, or to set the RGB values of your entire text image to white, leaving only the areas with text to have alpha (although I suspect that might break your edge detection algorithm if it's relying on RGB values - which is not correct for an alpha image either..)

If you're not familiar here's some more material covering the issues with straight (non-premultiplied) alpha:

Premultiplied alpha – Shawn Hargreaves Blog

Texture filtering: alpha cutouts – Shawn Hargreaves Blog

Alpha Blending: To Pre or Not To Pre | NVIDIA Developer

Kyle

1 reply

Bruce Bullis
Community Manager
Community Manager
August 3, 2018

The source layers/media are the same, either mode.

Different rendering methods produce different results.

The GPU one is likely faster.

Sorry, that sounds a bit pedantic; but I'm not sure how else to answer the question...

igorr60572095
Inspiring
August 3, 2018

Hi, Bruce.

Thanks for your response.

I don't think I understand your response.

As you can see on above screenshot, there are black pixels with high opacity around letters on gpu mode(cuda, opencl and metal).

But on software mode, the pixel's opacity is much lower than gpu mode.

Please take a look at the pixels around letters in detail.

This issue appears only when during preview.

Regards,

Anthonie.

Bruce Bullis
Community Manager
Community Manager
August 3, 2018
This issue appears only when during preview.

Yes, that's what I meant by 'different rendering methods produce different results'.