I am using A7 - stencil_shadows set to 2 - Z-Fail Stencil Shadows

They need to be set before level_load.

This is what I call before loading, or reloading my levels:

Quote:

shadow_stencil = 2; // activate z-fail accelerated stencil shadows
stencil_blur(1); // activate blurred shadows
mat_shadow.alpha = shadow_alpha;
shadow_range = 10;


Right now, to avoid shadow artifacts coming back to the spaceship level, which does not use stancil shadows, I call:

Quote:

ssView.material = NULL;
camera.stage = NULL;
shadow_stencil = -1; // deactivate z-fail accelerated stencil shadows
stencil_blur(0); // deactivate blurred shadows
mat_shadow.alpha = 0;
shadow_range = 0;


Going back to the ship uses a game_load function, but landing on the planet uses my own reloading function.

Right now, if I land on a planet, then return to the ship, everything is fine. However, if I return to the planet again, there appears to be two versions of the stencil_shadows. One is blurred and one is not, and they are at slightly different angles, as if there are two light sources casting shadows. Also, there are self shadows cast of objects that are not even assigned the "shadow" flag.

To make things more interesting, if I leave the game, and then come back and reload the planet, the shadows work fine.