Create new depth buffer from LUA

Create new depth buffer from LUA

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
sanguinariojoe
Posts: 26
Joined: 19 Apr 2016, 21:11

Create new depth buffer from LUA

Post 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
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Create new depth buffer from LUA

Post 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.
Super Mario
Posts: 823
Joined: 21 Oct 2008, 02:54

Re: Create new depth buffer from LUA

Post by Super Mario »

Kloot wrote:
not currently possible.
wat
sanguinariojoe
Posts: 26
Joined: 19 Apr 2016, 21:11

Re: Create new depth buffer from LUA

Post by sanguinariojoe »

Finally I used gl.CopyToTexture, which is working like a charm.
Is there an equivalent way to get the smoothed normals map?
User avatar
The Yak
Posts: 351
Joined: 20 May 2012, 05:36

Re: Create new depth buffer from LUA

Post by The Yak »

$model_gbuffer_normtex or $map_gbuffer_normtex perhaps?

See the gl.texture section of https://springrts.com/wiki/Lua_OpenGL_Api
sanguinariojoe
Posts: 26
Joined: 19 Apr 2016, 21:11

Re: Create new depth buffer from LUA

Post 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)
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Create new depth buffer from LUA

Post 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.
sanguinariojoe
Posts: 26
Joined: 19 Apr 2016, 21:11

Re: Create new depth buffer from LUA

Post 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...
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Create new depth buffer from LUA

Post 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.
sanguinariojoe
Posts: 26
Joined: 19 Apr 2016, 21:11

Re: Create new depth buffer from LUA

Post by sanguinariojoe »

Thanks man! I'll try ASAP
Post Reply

Return to “Game Development”