November 18, 2016

[Update x] Some random things.

Hello once again!

In this post I wont talk about just a single topic (thats why the title) I will just log some thing I´ve been doing this week.

First, I started to implement deferred in the sponza scene as it will be the next exercise for the university. Right now I implemented the G-buffer generation (with normals,positions and albedo). I also added a "Rect" to debug the content of the G-buffer in the screen.



*The red background is the albedo rect at fullscreen.

It was easier to implement than I thought. Lets see some pseudocode:
// Creation
// GBuffer,positions,normals,albedo,depth/stencil ids
int id,pid,nid,aid,did;

createFbo(id);

// positions
createTexture(pid);
linkTextureFbo(id,pid);

// normals
createTexture(nid);
linkTextureFbo(id,nid);

// albedo
createTexture(aid);
linkTextureFbo(id,aid);

// depth stencil
// Note that I´m using a render buffer
createRenderBuffer(did);
linkRenderFbo(id,did);

// ... assign color attachments ...

// ... check status ...

// Done!

// Resizing
// Just remember to resize all the buffers if the screen size changes!

texture(nSize,pid);
texture(nSize,nid);
texture(nSize,aid);
rendertarget(nsize,did);


*OpenGL thing.
Also remember to output the positions,normals and albedo in the fragment shader (using layout(location = x) out vec3 name). And that is basically it for the deferred thing.

I also have been working a lot on the terrain rendering engine in dx12. First I improved a lot the noise generation and moved it to the GPU. I´m using the perlin noise implementation by IQ. I use this noise in a ridged fractal. Now just the visible chunks are sent to the GPU (frustum culling) and finally I´m working on tesselation but I´m having some problems with the normals. Maybe I will make a compute shader that generates a heightmap and then sample it on the other shaders.Here the last video.




Hope you liked it!