Skip to content

Commit 221062a

Browse files
committed
shaders: Add GLSL port of accum_volumetric.
1 parent e82c4b0 commit 221062a

21 files changed

+136
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include "common.h"
2+
#include "iostructs\v_volume.h"
3+
4+
//////////////////////////////////////////////////////////////////////////////////////////
5+
uniform float4x4 m_texgen;
6+
#ifdef USE_SJITTER
7+
uniform float4x4 m_texgen_J;
8+
#endif
9+
10+
//////////////////////////////////////////////////////////////////////////////////////////
11+
// Vertex
12+
v2p_volume _main ( float4 P )
13+
{
14+
v2p_volume O;
15+
O.hpos = mul( m_WVP, P );
16+
O.tc = mul( m_texgen, P );
17+
#ifdef USE_SJITTER
18+
O.tcJ = mul( m_texgen_J, P );
19+
#endif
20+
return O;
21+
}
2.15 KB
Binary file not shown.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include "common.h"
2+
#include "iostructs\v_volumetric.h"
3+
4+
//cbuffer VolumetricLights
5+
//{
6+
uniform float3 vMinBounds;
7+
uniform float3 vMaxBounds;
8+
uniform float4 FrustumClipPlane[6];
9+
//}
10+
11+
v2p _main ( float3 P )
12+
{
13+
v2p o;
14+
float4 vPos;
15+
vPos.xyz = lerp( vMinBounds, vMaxBounds, P); // Position in camera space
16+
vPos.w = 1;
17+
o.hpos = mul (m_P, vPos); // xform, input in camera coordinates
18+
19+
o.lightToPos = vPos.xyz - Ldynamic_pos.xyz;
20+
o.vPos = vPos.xyz;
21+
22+
// o.fDensity = (vMaxBounds.z-vMinBounds.z)/2000.0f;
23+
// o.fDensity = (vMaxBounds.z-vMinBounds.z)/2000.0f*2;
24+
o.fDensity = 1.0f/40.0f;
25+
// o.fDensity = 1.0f/20.0f;
26+
27+
for (int i=0; i<3; ++i)
28+
{
29+
o.clip0[i] = dot( o.hpos, FrustumClipPlane[i]);
30+
o.clip1[i] = dot( o.hpos, FrustumClipPlane[i+3]);
31+
}
32+
33+
return o;
34+
}
31 Bytes
Binary file not shown.
56 Bytes
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "accum_volumetric.vs"
2.71 KB
Binary file not shown.
57 Bytes
Binary file not shown.
34 Bytes
Binary file not shown.
53 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)