Jump to content
  • Advertisement
lucky6969b

Rendering and compositing G-buffers.

Recommended Posts

When I directly render to the primary surface using the z-buffer on, the particles do go behind the buildings. However, when I turn on the z-buffer while rendering on the g-buffer (render targets) then composite the surfaces using z-buffer off, then the z-buffer properties are gone, and the particles are in front of the buildings. How come?

thanks

Jack

Share this post


Link to post
Share on other sites
Advertisement
Posted (edited)

Dear all,

I am wondering when I output a stencil value on a float2, and I got an additional sampler. Assuming I output color2 to a texture or some kind without leaving the shader, how does the sampler got knowledge about the stencil texture?

 

	sampler depthSampler;
//--------------------------------------------------------------------------------------
// Render particle information into the particle buffer
//--------------------------------------------------------------------------------------
struct PBUFFER_OUTPUT
{
    float4 color0 : COLOR0;
    float4 color1 : COLOR1;
    float4 color2 : COLOR2;  // depth buffer
};
	

thanks

Jack

Edited by lucky6969b

Share this post


Link to post
Share on other sites
Posted (edited)

COLOR2 isn't a depth buffer. It's just a colour buffer on slot 2.

What does mean "output a stencil value on a float2"? What samplers are you talking about?

On the OUTPUT of a pixel shader, there's 0-1 depth-stencil target and 0-8 colour render targets. Stencil and depth are implicit, i.e. depend on the fragment position and external stencil settings, i.e. you cannot set them manually in your pixel shader, there's specialised HW handling them; the colours are explicit and you must calculate them in the pixel shader.

On the INPUT to any shader, there's 0-128 of textures (I'm simplifying). Some of those textures can be the same memory as your render targets or depth-stencil targets.

A sampler is a recipe to sample the neighbourhood (neighbouring pixels and neighbouring mipmaps) at a UV coordinate on your texture to fetch you a colour. Any texture can be sampled with any sampler. Example samplers are: point, bilinear, anisotropic, etc.

The definition of a sampler in GLSL (texture + recipe) and in HLSL (recipe only) is fundamentally different, watch out.

Edited by pcmaster

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!