简体   繁体   中英

LibGDX: light up the objects, that drop shadows

guys. I have a procedurally generated dungeon, that looks like this (tmp art):

在此处输入图片说明

With simple lighting, I can get this result:

在此处输入图片说明

It looks almost perfect (tho, the colors are a bit strange :X). But is there any way for the walls to get some light also? Like this:

在此处输入图片说明

this.light = new RayHandler(this.world);
this.light.setBlurNum(1);
this.light.setAmbientLight(0f);
this.point = new PointLight(this.light, 128, new Color(1, 1, 0.8f, 0.8f), 512, 300, 300);

Thanks a bunch 🙂 PS I know, that I can draw walls on top of the shadows, but how do I query the darkness, then?

It looks like you are using Box2dLights. If that is the case each light can have it's softness and distance set with the code below:

    light.setDistance(size); // how far the light goes
    light.setSoftnessLength(soft); // how deep it penetrates objects

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM