How can I simulate a flashlight when jme3 doesn't have cone light?


I noticed that jme3 only have directional (no position set) light, pointlight and ambitient light.

Im making a l4d looking game and cone light is of moste importance.

Can I simulate a conelight or can I help you guys build a conelight for jme3?

Use PointLight, you can set its position at player + player.getForward().

However it will have round shape instead of cone.

Ah yea, using that now.

Problem is, it would take loads of them to simulate a cone…


You should look into projective texture mapping. It’s what games like l4d/2 use for their flashlights.

I’m still pretty new to actually working with jME, so i’m not sure if there is an example that includes projected textures. Even if there isn’t, it shouldn’t be too hard to implement.


Ahh yea, those effects I am also looking for. But atm its more of a cone formed light rather

than the shadow effect. I can skip the shadow effect produced by it now, but I would still need a

light that lights the way forward…

This technique is commonly used as a base for spotlights, which is essentially what you’re looking for.

You project the texture as a dynamic light (Ex. env_projectedtecture from post-Ep2 source games). The shadows effects are merely a bonus.

If I can get some time, I may actually try to work on this.



Sounds great! Would be really happy if you found a solution :slight_smile:

Its not a real emergency atm tho, I can kill zombies in daylight in my game, but its still an inevidable obstacle.

I love l4d :). I’m curious to see a jme version of l4d :roll:.