~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to source/blender/gpu/shaders/gpu_shader_vsm_store_frag.glsl

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * This fragment shader was initially found at http://fabiensanglard.net/shadowmappingVSM/index.php
 
3
 */
 
4
 
 
5
varying vec4 v_position;
 
6
 
 
7
void main()
 
8
{
 
9
        float depth = v_position.z / v_position.w;
 
10
        depth = depth * 0.5 + 0.5;
 
11
 
 
12
        float moment1 = depth;
 
13
        float moment2 = depth * depth;
 
14
 
 
15
        // Adjusting moments using partial derivative
 
16
        float dx = dFdx(depth);
 
17
        float dy = dFdy(depth);
 
18
        moment2 += 0.25*(dx*dx+dy*dy);
 
19
 
 
20
        gl_FragColor = vec4(moment1, moment2, 0.0, 0.0);
 
21
}