Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef _SHADOW_MAPPING_FRAG_
#define _SHADOW_MAPPING_FRAG_

layout(binding = SHADOW_SINGLE_MAP_ARRAY)  uniform sampler2DArrayShadow    texDepthMapFromLight;
layout(binding = SHADOW_CUBE_MAP_ARRAY)    uniform samplerCubeArrayShadow  texDepthMapFromLightCube;
layout(binding = SHADOW_LAYERED_MAP_ARRAY) uniform sampler2DArray          texDepthMapFromLightArray;


#if defined(_DEBUG)
#define DEBUG_SHADOWMAPPING
//#define DEBUG_SHADOWSPLITS
// set this to whatever (current cascade, current depth comparison result, anything)
int _shadowTempInt = -2;
#endif

#include "shadow_directional.frag"
#include "shadow_point.frag"
#include "shadow_spot.frag"

float getShadowFactor(int lightIndex) {
    Light light = dvd_LightSource[lightIndex];

    switch (light._options.x) {
        case LIGHT_DIRECTIONAL     : return applyShadowDirectional(light._options.z, light._options.w);
        //case LIGHT_OMNIDIRECTIONAL : return applyShadowPoint(light._options.z);
        //case LIGHT_SPOT            : return applyShadowSpot(light._options.z); 
    }
}

float shadow_loop(){
    if (!dvd_shadowsEnabled()) {
        return 1.0;
    }

    float shadow = 1.0;
    int offset = 0;
    int shadowLights = 0;
    for (int i = 0; i < MAX_LIGHT_TYPES; ++i) {
        for (int j = 0; j < int(dvd_lightCountPerType[i]); ++j) {
            int lightIndex = j + offset;
            if (shadowLights < MAX_SHADOW_CASTING_LIGHTS && 
                dvd_LightSource[lightIndex]._options.y == 1) {
                shadow *= getShadowFactor(lightIndex);
                shadowLights++;
            }
        }
        offset += int(dvd_lightCountPerType[i]);
    }

    return clamp(shadow, 0.05, 1.0);
}
#endif //_SHADOW_MAPPING_FRAG_

Commits for Divide-Framework/trunk/assets/shaders/GLSL/fragmentAtoms/shadowMapping.frag

Diff revisions: vs.
Revision Author Commited Message
727 Diff Diff IonutCava picture IonutCava Tue 14 Jun, 2016 16:01:38 +0000

[IonutCava]
- Remove node and cmd buffers from GFXDevice and add them as a new BufferData struct to RenderPass class.
— Each render pass holds its own buffers
- Improvements / fixes to the CSM code
- Added a global toggle to enable/disable custom memory allocators

716 Diff Diff IonutCava picture IonutCava Tue 31 May, 2016 16:08:29 +0000

[IonutCava]
- Multithreaded scene load/unload fixes:
— Added postLoadMainThread call for scenes for thread sensitive loading steps
— GUI element adding is a thread sensitive loading step (a fast one) because CEGUI doesn’t handle threading
- Added REALTIME_WITH_CALLBACK task priority for tasks that need an immediate callback when they complete instead of using the flushCallbackQueue system.
- Some work on shadow mapping for getting it to work again
- ShaderPrograms that fail to load can cause a LockManager infinite wait. Delete the lockManager if the shader didn’t load to avoid waiting on commands that never get called.

614 Diff Diff IonutCava picture IonutCava Mon 21 Dec, 2015 17:07:48 +0000

[IonutCava]
- Framebuffer attachment corrections
- SSAO corrections

609 Diff Diff IonutCava picture IonutCava Fri 18 Dec, 2015 13:05:06 +0000

[IonutCava]
- Postprocessing improvements
- Shadowmapping warning fix (non-depth texture bound to depth sampler)

601 Diff Diff IonutCava picture IonutCava Wed 09 Dec, 2015 17:12:38 +0000

[IonutCava]
- Shadow mapping system improvements:
— Point and spot light support
— Variable number of debug preview planes
- Light impostor rendering fix and update:
— Displays coloured icons for point and spot lights
- Camera system improvement:
— Camera manager is the only class allowed to instantiate new cameras
- Initial dual paraboloid rendering code
- Remove discard statements from shader code (should use blending if visual artefacts are encountered)

591 Diff Diff IonutCava picture IonutCava Wed 02 Dec, 2015 17:17:23 +0000

[IonutCava]
- More work on the ForwardPlus renderer
- Singleton cleanup
- First steps for reducing scope of GFXDevice class

587 Diff Diff IonutCava picture IonutCava Fri 27 Nov, 2015 17:00:25 +0000

[IonutCava]
- Finished multi-light rendering:
— Proper position/distance transform (homogeneous trans for positions / non-homogeneous trans for directions)
-— Point lights with range based attenuation
-— Spot lights with inner and outer cones for smooth falloff
-— Directional lights same as before
- Added a basic Flashlight system: spot light at the camera’s position facing forward (toggled with L key)
- WarScene updated:
— 16 point lights moving around the scene with random colours

576 Diff Diff IonutCava picture IonutCava Fri 20 Nov, 2015 11:54:22 +0000

[IonutCava]
- C++ based Interface block generation for GLSL

573 Diff Diff IonutCava picture IonutCava Wed 18 Nov, 2015 21:27:33 +0000

[IonutCava]
- AMD specific corrections for the previous commit
- Removed RenderingComponent’s impostorBox as it wasn’t used

572 IonutCava picture IonutCava Wed 18 Nov, 2015 17:15:43 +0000

[Ionut]
- Attempt to pack all shadowmaps in Shadowmap arrays
- Cleanup lighting and material info
- Fix light impostor rendering