02
Feb
08

GLSL Discard, Z-Fighting, Supersampling

I’ve eliminated z-fighting issues in the transparent areas of my shader by using the ‘discard’ keyword in the Fragment Shader to throw away the transparent areas. One side-effect of this is that there’s now no point using the smoothstep function to create the stripes, so I can do something much simpler. The downside is that I loose all antialiasing.

To fix this, I’ve decided to render the GLSL patch inside a Render In Image macro at twice the output size, then resized it back down again. The technique is apparently called ‘Supersampling’. It’s not as smooth as my smoothstep antialiassing, but it does a pretty good job.

The idea here is to produce an alternative, more solid-looking version of the shader.

The first screenshot shows the effect os supersampling on the edges the the mesh. It’s not perfect, but it’s gone a long way towards smoothing out the jaggies.

Vertex Noise Edit 020208 Supersample 01Vertex Noise Edit 020208 Supersample 02
Vertex Noise Edit 020208 Supersample 03Vertex Noise Edit 020208 Supersample 04

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Twitter

February 2008
M T W T F S S
« Jan   Mar »
 123
45678910
11121314151617
18192021222324
2526272829  

Links

Blog Stats

  • 471,196 hits

%d bloggers like this: