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

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

0 Members and 1 Guest are viewing this topic.

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #285 on: November 12, 2013, 01:30:33 pm »
Ill try again.. When I said "add sources" it means adding the LTBL sources to your project, so they can compile. This means the .cpp files in your project tree / makefile... Nothing to do with #includes..

zachprinz

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #286 on: November 16, 2013, 01:50:25 am »
Views seem really wonky.



I'm getting this. It's the same problem everyone else was having quite a few pages ago.

The only time I can see lights is if I set the view the the default view of the panel. But then I can't see lights anywhere else.

You can see the light trailing up into the top right hand corner of the darkened area.

Anyone know a fix?


   view.setCenter();
   panel.setView(view);
        Draw(panel);
   panel.setView(panel.getDefaultView());
   lightSystem.SetView(panel.getDefaultView());
   lightSystem.RenderLights();
   lightSystem.RenderLightTexture();
   lightSystem.DebugRender();
« Last Edit: November 16, 2013, 02:55:44 am by zachprinz »

zachprinz

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #287 on: November 18, 2013, 09:35:45 pm »
My solution to the problem I posted above was to create the sf::RenderTexture window I have the sprite panel on at the size of the quad tree for ltbl.

Then I just set a view on the sprite panel and keep the light systems view to the whole 4096x4096 map.

This is resulting in very poor performance when you add in more than a few lights.

I've added checks to see if the lights are contained in the visible part of the map but it doesn't help much, about a 35 fps drop when there are 5 lights on screen.

Any thoughts would be appreciated.

emplace

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #288 on: November 27, 2013, 04:05:04 pm »
Anyone got a working sample of this ?

Daffern

  • Newbie
  • *
  • Posts: 25
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #289 on: December 02, 2013, 07:32:01 pm »
When im setting the m_intensity to lower than 1.0 no light is shown at all when m_useBloom is true.

The light works when m_useBloom is false, however m_intensity doesnt affect the intensity of the light at all ???

Anyone know why this happens?

Estivo

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #290 on: December 02, 2013, 07:57:43 pm »
Mess in code. Set intensity to 2.0, manipulate attentuation.

Daffern

  • Newbie
  • *
  • Posts: 25
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #291 on: December 02, 2013, 10:27:28 pm »
Okey! Thanks for the quick answer

polkom21

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #292 on: December 18, 2013, 11:23:45 pm »
Hello everybody!

I have problem with y-axis because I want flip this axis and I don't know how to do it. Help me!

EDIT:
Ok. I know how to do it. Now I have a problem with rotation ConvexHull. Whether is something function who sets angle?
« Last Edit: December 20, 2013, 12:33:25 am by polkom21 »

Daffern

  • Newbie
  • *
  • Posts: 25
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #293 on: December 21, 2013, 03:39:29 pm »
No, there is no such function. However you can get each point from a sf::Shape by using getPoint(int). Example:

hull->m_vertices.clear();
int count = dRect.rect.getPointCount();
         for (int i = count; i>0 ; i--){
            sf::Vector2f point =  rect.getTransform().transformPoint(rect.getPoint(i));
            hull->m_vertices.push_back(Vec2f(point.x,options.screenHeight-point.y));
         }

You probably have to fit it to your code, but this was how i did it ;)
« Last Edit: December 21, 2013, 03:50:40 pm by Daffern »

polkom21

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #294 on: December 21, 2013, 05:46:20 pm »
Thanks for the idea. I have another problem. When I set light point position like static position all it's ok how I set position from object position light isn't rendered.

polkom21

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #295 on: December 27, 2013, 11:55:01 pm »
Ok. I repaired it. How to change position convexHull?

Daffern

  • Newbie
  • *
  • Posts: 25
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #296 on: December 28, 2013, 03:01:46 am »
Use the same code as above

polkom21

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #297 on: January 15, 2014, 11:13:30 pm »
Hi everybody.

I come back to writing my game and I have next problem with lights. Why penumbra isn't rendered as it should be?

And next problem. Why when I set m_renderLightOverHull on false  shadow looks like:


The Illusionist Mirage

  • Full Member
  • ***
  • Posts: 115
  • My Life = Linux, C++ & Computers
    • View Profile
    • fleptic
    • Email
Re: SFML Light System - Let There Be Light
« Reply #298 on: January 16, 2014, 12:16:12 pm »
I get this when I try to follow the walk through:



eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10821
    • View Profile
    • development blog
    • Email
Re: SFML Light System - Let There Be Light
« Reply #299 on: January 16, 2014, 01:11:29 pm »
I get this when I try to follow the walk through
What walk through?

ltbl::Light is, as the compiler says, an abstract class and thus can't be instantiated. You most likely want to use ltbl::Ligh_Point instead, as shown in the example file. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything