NPOTTexture limitation?

Started by kkl, March 05, 2016, 05:51:15 PM

Previous topic - Next topic

kkl

Hi Egon,

I would like to make a depth of field effect by using post proccessing. It requires rendering the object z buffer in 1st render pass, then combine with main scene with a custom dof shader set to the framebuffer for post processing. To render the z buffer, we need to render the scene on a texture match with the screen width and height. I'm thinking of using NPOTTexture, but you mentioned in doc saying NPOTTexture is preferred to be in power of 2 as it's not supported in some devices. How should we do in this case? I worry if we create a power of 2 NPOTTexture and it does not match to screen width and height, we might have some texture size ratio problem. Please advise, thanks.

EgonOlsen

No, that's not what the docs meant...maybe my wording wasn't clear here. It means that power of 2 textures are prefered in general. But if you can't or don't want to use them, that's what NPOTTextures are for. So you are fine to use them with whatever resolution you like.
Current devices support them with no problems at all. I'm using them in my game too and I never got any feedback that they wouldn't work. It was a problem on older devices though, hence the comment in the docs.
Just remember that jPCT-AE doesn't render depthmaps directly (because I couldn't get them to work reliable across devices). You have to encode the depth data in a color map to make use of it.

kkl

Seems like I misunderstood the doc. Yup ok I'll manually render a color map the depth map and start combining main render with generated color map. By the way, you mentioned if we need to combine 2 textures, we should use blitting from framebuffer class. How is the performance for the blitting? Is it GPU accelerated or just CPU? Do you have any example to apply color map to main render display? I tried finding through the forum but i can find some guidance in verbal form only. Are you planning to put an example in wiki?

EgonOlsen

Blitting is OpenGL accelerated rendering as well. I'm not sure about your actual question. Where did I state anything about using blitting to combine textures? In which context?

kkl

Not sure where I saw it in the forum. Just wanna confirm with you if blitting is the correct flow to create depth of field effect by combining depth map (manual color map) and the main scene.

EgonOlsen


kkl

Open source game~ cool. I'll check it out when i got the time. Thanks alot egon