Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shader Error #10

Open
lucas-jones opened this issue Feb 7, 2021 · 3 comments
Open

Shader Error #10

lucas-jones opened this issue Feb 7, 2021 · 3 comments

Comments

@lucas-jones
Copy link

Trying to use this library but happen to get this error:

ERROR: 0:1552: '[]' : array index out of range
ERROR: 0:1552: '[]' : array index out of range
ERROR: 0:1556: '[]' : array index out of range
ERROR: 0:1556: '[]' : array index out of range

Shader code on them lines:

1539: 
1540: 		#endif
1541: 
1542: 		if(linearDepth >= CSM_cascades[3].x && (linearDepth < CSM_cascades[3].y || 3 == CSM_CASCADES - 1)) RE_Direct( directLight, geometry, material, reflectedLight );
1543: 
1544: 	
1545: 
1546: 		directionalLight = directionalLights[ 4 ];
1547: 		getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );
1548: 
1549: 		#if defined( USE_SHADOWMAP ) && ( 4 < 5 )
1550: 
1551: 		directionalLightShadow = directionalLightShadows[ 4 ];
1552: 		if(linearDepth >= CSM_cascades[4].x && linearDepth < CSM_cascades[4].y) directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ 4 ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ 4 ] ) : 1.0;
1553: 
1554: 		#endif
1555: 
1556: 		if(linearDepth >= CSM_cascades[4].x && (linearDepth < CSM_cascades[4].y || 4 == CSM_CASCADES - 1)) RE_Direct( directLight, geometry, material, reflectedLight );
1557: 
1558: 	
1559: 
1560: 	#endif
1561: 
1562: #endif

Instantiating like this:

let csm = new CSM({
    fov: 80,
    maxFar: camera.far,
    lightIntensity: 0.2,
    cascades: 4,
    shadowMapSize: 2048,
    camera: camera,
    parent: scene,
});

Any ideas?

@gonuit
Copy link

gonuit commented Mar 14, 2021

Same here, @vhawk any ideas? 😅

@gonuit
Copy link

gonuit commented Mar 18, 2021

I found that it could be caused by other light sources that also cast shadows, removing them resolves the issue.

@StrandedKitty
Copy link
Owner

It wasn't supposed to work with other light sources with shadows and I never tested such cases. It would be nice if it did actually work, but I don't think I'm going to implement it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants