Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


ginkgo

Member Since 05 Sep 2009
Offline Last Active Jul 16 2013 08:37 AM

#5014642 Emulating Render to Texture

Posted by ginkgo on 27 December 2012 - 02:36 AM

If z = 0, then you have a problem with your perspective. A vertex is located on the eye-plane.

 

This division by zero problem can't happen in regular graphics pipelines because the depth-division happens after near-clipping.

 

I guess my first attempt for avoiding this problem would simply be adding a very small bias value to z if it's 0.




#5014410 Emulating Render to Texture

Posted by ginkgo on 26 December 2012 - 08:51 AM

You can do perspective correction yourself by interpolating iz=1/z and iuv=uv/z as varyings and reconstructing uv in the fragment shader as iuv/iz.




#4993057 Displaying Transparent Voxels

Posted by ginkgo on 23 October 2012 - 05:21 AM

Take a look at this:

http://www.iquilezle.../volumesort.htm

This uses different indices for different view directions. This should work pretty well for your problem. You can reduce the amount of necessary index data by using instancing or something like that.


#4949700 Particles with DOF

Posted by ginkgo on 15 June 2012 - 08:07 PM

If you have a way to sort the particles from back to front you can use the particle depth to scale and blur them according to their circle of confusion and mix them all together with alpha blending. You could do the scaling of the bilboards in the geometry shader.

The DoF particles wouldn't really interact with the DoF of the rest of the scene but this shouldn't be too apparent depending on how the particles are used.


#4920865 Bloom Fail

Posted by ginkgo on 10 March 2012 - 03:42 AM

Those black artifacts are often indicative of NaN Pixels which get drawn as black on most GPUs.

NaN mostly results from divisions by 0. One typical example being 0/0.

Since any operation with a NaN value results in a NaN, you then get those black block artifacts when applying a filter.

You can test this in GLSL at the end of you shader with this code snippet:

if (any(isnan(color))) {
    color = vec4(1,0,0,1);
}

This will set NaN pixels to red.


#4773468 Transparency Blocks

Posted by ginkgo on 12 February 2011 - 07:42 PM

As far as I understand, the approach for rendering transparent blocks in Minecraft is the following:

First, all opaque and alpha-tested blocks like glass or leaves are rendered. This initializes the color buffer and the depth-buffer with the correct values.

Then, the transparent blocks are rendered in two passes:

Render the blocks with color-write disabled, but depth-testing and depth-write enabled. This modifies the depth-buffer without changing the color-buffer.

Next, enable alpha-blending and color-write and draw the transparent blocks once more. (Keep depth-testing enabled)

Because they have already been written to the depth-buffer once, only the polygons nearest to the camera are rendered. This gives convincing results, while being cheap and pretty simple to implement.

Just make sure that the compare function for the depth test is less-or-equal. glDepthFunc(GL_LEQUAL);


PARTNERS