Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML Light System - Let There Be Light  (Read 257732 times)

0 Members and 4 Guests are viewing this topic.

Estivo

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #255 on: September 11, 2013, 10:35:46 pm »
are you talking about penumbra?

Nutomic

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #256 on: September 11, 2013, 10:59:48 pm »
Yeah right, I see you mentioned that (I didn't change any color/transparency settings in my code though).

Do you have any idea how I could fix this?

Edit: It definitely has nothing to do with those changes, I reverted them and still have the same problem:


The directional light has the following values:
mPlayerDirectionLight->m_radius = 500.0f;
        mPlayerDirectionLight->m_size = 50.0f;
        mPlayerDirectionLight->m_softSpreadAngle = 0.1f * M_PI;
        mPlayerDirectionLight->m_spreadAngle = 0.5f * M_PI;
        mPlayerDirectionLight->m_intensity = 1.5f;
        mPlayerDirectionLight->m_bleed = 0;
        mPlayerDirectionLight->m_color =  Color3f(1, 0.95, 0.40);

So softspread should work no problem, but it only does sometimes after waiting.
« Last Edit: September 12, 2013, 12:14:49 am by Nutomic »

Daffern

  • Newbie
  • *
  • Posts: 25
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #257 on: September 12, 2013, 12:25:40 am »
Have you tried turning the bloom off?

Estivo

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #258 on: September 12, 2013, 08:22:21 am »
ConvexHull parameters please ;)

Nutomic

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #259 on: September 12, 2013, 10:17:40 am »
Have you tried turning the bloom off?

That didn't solve it, but now the light/shadows look much more like I want, thanks :D

ConvexHull parameters please ;)

I didn't have any hulls in there yet. Now I just inserted some, and it seems the penumbra effect only works from the moment the light hits a ConvexHull. Obviously a bug, but for now, I can work around it.


Estivo

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #260 on: September 12, 2013, 11:40:50 am »
Hmm I think I know about what are you talking. Try to set position to 0,0 and then to position that you want.

ThreeDumps

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #261 on: September 15, 2013, 02:48:08 pm »
Awww... Still have problems ;)



Does anyone have an idea what to do to get situation from second image instead from first? And situation from third is actual but not satisfactory.

First is when
hull->m_renderLightOverHull = true;

Third is when
hull->m_renderLightOverHull = false;

Of course I can redraw all walls but then I will have all walls visible, also in chambers next to.


Estivo

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #262 on: September 15, 2013, 04:08:12 pm »
Disable render over hull and set hull transparency to 0.5f

ThreeDumps

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #263 on: September 16, 2013, 12:40:01 am »
@Estivo, not exactly does it work the way I wanted.

I give bigger framgnet map and more situations.



1. m_renderLightOverHull false, m_transparency 0, redrawing walls.
Bad: Whole labrinth can be seen, all walls have same brightness.

2. m_renderLightOverHull true, m_transparency 0. 
Bad: Shadows on walls.

3. m_renderLightOverHull true, m_transparency 0.5.
Bad: Shadows on walls, light in separated chamber. 

4. m_renderLightOverHull false, m_transparency 0.
Bad: Walls are unlighted.

5. m_renderLightOverHull false, m_transparency 0.5.
Bad: Walls are unlighted, light in separated chamber.

I'm trying to get situation from picture number 2, but without shadows on wall but still have darkens out of room.

Daffern

  • Newbie
  • *
  • Posts: 25
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #264 on: September 16, 2013, 01:54:31 am »
You could try render the tiles on top of the shadows

Estivo

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #265 on: September 16, 2013, 05:31:01 pm »
I think that the easiest way to do it is only to make wide line and make it transparent with rendering over hull.

ThreeDumps

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #266 on: September 16, 2013, 07:01:55 pm »
@Daffren, I'm rendering tiles on top of shadows in first case.

@Estivo, this would have worked if the whole labyrinth was one shape but it must be build using convex shapes. It will still makeing bad looking shadows on convex shapes contacting each other.

Nutomic

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #267 on: September 20, 2013, 02:55:13 pm »
I created a Github repository for this project, where I patched it for the latest SFML version and added CMake.

Link

Feel free to open pull requests or issues.

Awww... Still have problems ;)



Does anyone have an idea what to do to get situation from second image instead from first? And situation from third is actual but not satisfactory.

First is when
hull->m_renderLightOverHull = true;

Third is when
hull->m_renderLightOverHull = false;

Of course I can redraw all walls but then I will have all walls visible, also in chambers next to.

I would be very interested in this as well, but I suppose it requires editing the library.

Maybe I'll get around to have a look at the shadow rendering code.

Estivo

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #268 on: September 20, 2013, 06:48:43 pm »
It's not LTBL fault. You have to make one big shape.

Daffern

  • Newbie
  • *
  • Posts: 25
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #269 on: September 22, 2013, 02:03:39 am »

I don't know if there is a fix for this, but is there any way to make the shadow fill where it's supposed to fill below the ground rectangle?

Make black texture ? What do you want at all?

As you can see in the picture the light penetrates the hull. This seems to happen when the hulls shape is too long in one direction compared to the other direction, because it works perfect with a square hull. I was wondering if there was a fix for this or if i have to split the hull up into several smaller hulls. The blue part is the hull and there are two lights at the player. Some of the shadow is drawn bellow the hull(the black line directly bellow the hull).
« Last Edit: September 22, 2013, 02:17:28 am by Daffern »