Author Topic: NPOTTexture limitation?  (Read 3442 times)

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
NPOTTexture limitation?
« on: March 05, 2016, 05:51:15 pm »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: NPOTTexture limitation?
« Reply #1 on: March 05, 2016, 09:59:56 pm »
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.

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Re: NPOTTexture limitation?
« Reply #2 on: March 07, 2016, 04:14:26 pm »
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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: NPOTTexture limitation?
« Reply #3 on: March 07, 2016, 06:30:44 pm »
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?

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Re: NPOTTexture limitation?
« Reply #4 on: March 08, 2016, 11:20:54 am »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: NPOTTexture limitation?
« Reply #5 on: March 08, 2016, 12:43:26 pm »
No idea...you should be able to find example sources for dof here: http://www.jpct.net/wiki/index.php?title=Open_sourced_projects_from_Thomas

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Re: NPOTTexture limitation?
« Reply #6 on: March 08, 2016, 01:31:48 pm »
Open source game~ cool. I'll check it out when i got the time. Thanks alot egon