Author Topic: Depth buffer texture  (Read 49740 times)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Depth buffer texture
« Reply #30 on: July 04, 2012, 07:39:37 pm »
This never worked...at least on my phone. It always caused to phone to hang, so i gave up on it.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Depth buffer texture
« Reply #31 on: July 04, 2012, 09:02:57 pm »
No, wait...this might not be entirely true. I think i'm not using FBOs for render targets in jPCT-AE...most likely because there is no support for it in ES 1.x. I'll look into ES 2.0 again to see if it's supported there...
must...recalibrate...brain...i'm already using render buffers when in OpenGL ES 2.0 mode. I just completely forgot about it. It might be possible to improve render buffer management when using multiple buffers in one frame though. I'll look at it and report back...
« Last Edit: July 04, 2012, 09:35:42 pm by EgonOlsen »

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Depth buffer texture
« Reply #32 on: July 04, 2012, 09:14:44 pm »
Ok, thanks. Now I'm doing UV's for monastery ;)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Depth buffer texture
« Reply #33 on: July 04, 2012, 09:47:37 pm »
I've updated the jpct_ae.jar. The new version should handle multiple buffers faster and is also able to deal with color=null. Please give it a try.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Depth buffer texture
« Reply #34 on: July 05, 2012, 12:27:09 pm »
You do miracles, render depth texture takes 6ms, render scene 4ms (I don't call method renderScene() again), DOF effect 0.3ms :) But fps is 26... Do you know when render thread sleep for vsync? Is it fb.display()?
« Last Edit: July 05, 2012, 12:35:04 pm by Thomas. »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Depth buffer texture
« Reply #35 on: July 05, 2012, 12:43:56 pm »
I would expect vsync to kick in after onDrawFrame(). FrameBuffer.display() doesn't do this in jPCT-AE (it does so in the desktop version). The frame switching is solely handled by Android itself. I don't have any influence on that.

Keep in mind that the GPU can delay tasks, i.e. the call may already have returned but the GPU is still drawing things.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Depth buffer texture
« Reply #36 on: July 05, 2012, 09:39:33 pm »
The jar has been updated again. I've added a static factory method to Texture to create nPot-textures (public static Texture creatNPotTexture(int width, int height, RGBColor col)).

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Depth buffer texture
« Reply #37 on: July 05, 2012, 10:44:06 pm »
It's working ;) I'm going to look for some optimization...

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Depth buffer texture
« Reply #38 on: July 06, 2012, 10:07:33 am »
It's working ;) I'm going to look for some optimization...
It's time for a screen shot then... ;)

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Depth buffer texture
« Reply #39 on: July 06, 2012, 10:15:21 am »
I just save my map and models to OBJ file and export to SER, this afternoon here will be ;)

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Depth buffer texture
« Reply #40 on: July 06, 2012, 04:53:31 pm »
The most expensive is DOF effect. If I render depth buffer and scene, game running 56fps (from 60), but with applied DOF effect, fps drop down to 23... Now I take 16 samples of surrounding pixels. It is 16.5 million times of reading color from texture. I'll try to reduce this number to minimum.

Here it is, but without textures it is bad...

« Last Edit: July 06, 2012, 05:32:50 pm by Thomas. »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Depth buffer texture
« Reply #41 on: July 06, 2012, 08:21:01 pm »
Looks nice. Why are you doing everything without texture btw? I've never seen a screen shot of that game with textures...or have i?

I do understand that the color buffer target has to have screen size, but does the depth buffer target has to have it? Isn't it sufficient to render it at a quarter of the screen resolution and save some fill rate that way?

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Depth buffer texture
« Reply #42 on: July 06, 2012, 08:40:33 pm »
Before, I'm was lazy to do textures, but if I didn't them immediately, I don't ever :D So, every new model what I do has texture, these models are more than year old. Yes, I'll try it, it'll be definitely faster. And it seems, that anti-aliasing is not applied on the render target...

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Depth buffer texture
« Reply #43 on: July 06, 2012, 09:58:43 pm »
And it seems, that anti-aliasing is not applied on the render target...
Yes. Because that's not possible.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Depth buffer texture
« Reply #44 on: July 06, 2012, 10:25:20 pm »
And it seems, that anti-aliasing is not applied on the render target...
Yes. Because that's not possible.

Could you explain it? I reduce depth resolution to quarter, it brought 3fps. And also reduce samples from 16 to 8 and fps is now 55, satisfaction 8)

edit: Accumulation buffer, which is needed for anti-aliasing, is not defined in FBO.
« Last Edit: July 06, 2012, 10:42:17 pm by Thomas. »