I am trying to achieve some kind of night effect with enemies carrying flashlights.
To do so, I have basically 2 layers of my level, one in front for the night, and one beneath it for the day. Then, I would like to carve holes in the night layer by using clipping nodes. So the day layer could appear were there is supposed to be light.
Here is my hierarchy :
| |-Scenery node 1
| |-Scenery node 2
| |-Scenery node 3
|-ClippingNode (lightedArea 1 - the light circle minus the shadows)
| |-DrawNode (Flashlight white soft aliased complete ring)
|-DrawNode (cast shadow raytracing)
The thing is, the Night ClippingNode never gets clipped. It appears on the entire screen... If I add the LightedArea nodes to the Night node content instead of the stencil, it appears that white illuminated areas are computed just as I expect them to be.
Here are 2 screenshots.
- On the first one, lightedAreas are added as children of the night Stencil, and when I do so, the Night clippingNode doesn't get carved (that is my issue)
On the second one, I added the exact same lightedAreas directly as content of the ClippingNode I use for the night.
I was expected the white areas visible on screenshot 2 to carve holes in my Night ClippingNode (clipping is reverted). Why doesn't it behave like this ? Am I expecting too much from the ClippingNode or am I doing something wrong ?
WallGridz - 480x320 - 1.png (68.3 KB)
WallGridz - 480x320 - 2.png (67.8 KB)