Page 1 of 1
Create new depth buffer from LUA
Posted: 12 Apr 2017, 16:13
by sanguinariojoe
Hey guys!
I'm implementing SSAO for s44, and I'm having some troubles...
First, is that I have a map depth buffer, and a model depth buffer, so I should blend both to generate the global depth buffer. Even worst, there are some "features" which are not never drawn in such buffers, like trees. Do you know how could I get the depth buffer of the "final rendered image" from LUA?
Second, I have a lot of z-fighting. Do you know a way to control the near/far camera parameters at the time of producing the depth buffer?
Thanks!
Pepe
Re: Create new depth buffer from LUA
Posted: 12 Apr 2017, 21:12
by Kloot
how could I get the depth buffer of the "final rendered image" from LUA?
gl.CopyToTexture or (in 103+, pass nil to read from the default fb) gl.BlitFBO in DrawWorld.
control the near/far camera parameters
not currently possible.
Re: Create new depth buffer from LUA
Posted: 12 Apr 2017, 21:45
by Super Mario
Kloot wrote:
not currently possible.
wat
Re: Create new depth buffer from LUA
Posted: 29 May 2017, 12:51
by sanguinariojoe
Finally I used gl.CopyToTexture, which is working like a charm.
Is there an equivalent way to get the smoothed normals map?
Re: Create new depth buffer from LUA
Posted: 29 May 2017, 13:22
by The Yak
$model_gbuffer_normtex or $map_gbuffer_normtex perhaps?
See the gl.texture section of
https://springrts.com/wiki/Lua_OpenGL_Api
Re: Create new depth buffer from LUA
Posted: 29 May 2017, 13:27
by sanguinariojoe
I'm already using those... However:
* They should be blended, wasting time and resources
* Depending whether you are using a custom shader or not, some object may not be included
* I have problems with some drivers (e.g. NVidia Quadro 2000, Ubuntu 16.04)
Re: Create new depth buffer from LUA
Posted: 29 May 2017, 17:14
by Kloot
If by "custom shader" you mean a custom unit or feature shader within the COS framework used by S44, those can write to the model g-buffer too.
There is no callout to combine the map and model buffer components into one, mostly due to lack of demand.
Re: Create new depth buffer from LUA
Posted: 29 May 2017, 21:30
by sanguinariojoe
those can write to the model g-buffer too.
Where may I find an example? because I'm failing miserably
There is no callout to combine the map and model buffer components into one, mostly due to lack of demand.
That's a pity...
Re: Create new depth buffer from LUA
Posted: 29 May 2017, 22:37
by Kloot
look at the lines containing 'deferred' in
http://imolarpg.dyndns.org/trac/balates ... apping.lua
also, wrt controlling the near/far parameters: these shaders can easily be passed a custom uniform projection matrix.
Re: Create new depth buffer from LUA
Posted: 30 May 2017, 09:00
by sanguinariojoe
Thanks man! I'll try ASAP