• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

layers Z-Buffer/Depth-Buffer

U

Ukko

Guest
Hi
is there a way to retrieve a kind of Z-buffer of the rendered layers, based on layers depth? in a surface for exemple, I need to pass it to a shader.
 

Binsk

Member
As far as I know we don't have direct access to the depth buffer, you could always generate your own. I made a 3D engine way back w/ GameMaker and ended up having to do that. It's a bit of a pain since GameMaker only supports RGBA surfaces so you have to split your depth data into the four channels and reconstruct them when you want to use the buffer. That said, totally doable.
 
U

Ukko

Guest
Thanks Binsk for the reply,
Basicaly I don't have so much layers, about 5, so it can be easilly store in one color channel (L1 depht=20, L2 depth=40, L3 depth=60 ...), I just need to find an efficient way to render the layer depth to a surface.
 

GMWolf

aka fel666
Thanks Binsk for the reply,
Basicaly I don't have so much layers, about 5, so it can be easilly store in one color channel (L1 depht=20, L2 depth=40, L3 depth=60 ...), I just need to find an efficient way to render the layer depth to a surface.
Use the layer script begin/end functions to set a surface and shader.

Remember that you only have 8bits of precision per channel, that's not much.
 
Top