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

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

0 Members and 5 Guests are viewing this topic.

bmn

  • Newbie
  • *
  • Posts: 18
    • View Profile
SFML Light System - Let There Be Light
« Reply #15 on: January 06, 2012, 06:27:08 pm »
Also works for me now.

I'm wondering how you fixed this because I have a project that does the same thing, but only on my dev computer.

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
SFML Light System - Let There Be Light
« Reply #16 on: January 07, 2012, 01:38:57 am »
I just made sure to save all of the OpenGL states whenever I did something with the render texture.
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

ChonDee

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
SFML Light System - Let There Be Light
« Reply #17 on: January 24, 2012, 01:35:52 am »
Wow, this is awesome, exactly what I need!
Keep up the good work!

Are you planning on making documentation for it?

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
SFML Light System - Let There Be Light
« Reply #18 on: January 24, 2012, 09:32:07 pm »
I wasn't planning on it, but I certainly can! I will let you know when it is finished.
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

Ockonal

  • Jr. Member
  • **
  • Posts: 58
    • ICQ Messenger - 449909010
    • View Profile
    • WinCode
SFML Light System - Let There Be Light
« Reply #19 on: February 09, 2012, 01:40:33 am »
Hello
lolz123
Great job! I've made it crossplatform. Everyone can download it from:
http://dl.dropbox.com/u/932520/Source.zip

There is data + a few changes in sources + Makefile. Worked fine for me in ArchLinux with the latest sfml build. I hope, the author not against this :)

btw, why do you write: `it->_Ptr->_Myval`, it's not crossplatform and very bad, why not to use `(*it)->...`?

And you've tried to access 'aabb' member from `QuadTreeOccupant` and it's protected? I replaced it with public to compile the code.

I like it, thanks!
Developing 2d engine&game using: sfml, box2d, librocket, spark2, zoom&zoost, thor

StormWingDelta

  • Sr. Member
  • ****
  • Posts: 365
    • View Profile
SFML Light System - Let There Be Light
« Reply #20 on: February 09, 2012, 05:16:21 am »
That could be why it didn't work on windows or does it not work out of the box when downloaded.  The examples didn't run on my end.
I have many ideas but need the help of others to find way to make use of them.

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
SFML Light System - Let There Be Light
« Reply #21 on: February 10, 2012, 12:38:44 am »
Thanks Ockonal for cleaning up the code! I am putting together a manual for the light system, it should be done soon. I did change some things while doing so though, since some parts were not very user friendly (mainly having to do with updating AABB's), and there are still some glitches having to do with the OpenGL states getting messed up. I hope it is OK if I incorporate your improved code into the new version.
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

Ockonal

  • Jr. Member
  • **
  • Posts: 58
    • ICQ Messenger - 449909010
    • View Profile
    • WinCode
SFML Light System - Let There Be Light
« Reply #22 on: February 10, 2012, 01:08:38 am »
lolz123, It's great ;) Waiting for it.

Btw, maybe it would be better to move directional light into separate structure? You are restict the number of triangles from light source when we set 'spreadAngle' but what if I want to move/rotate the source of directional light?
Developing 2d engine&game using: sfml, box2d, librocket, spark2, zoom&zoost, thor

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
SFML Light System - Let There Be Light
« Reply #23 on: February 10, 2012, 01:59:14 am »
Well, the only thing that changing the spread angle does is change the end angle for rendering the light. It runs the same code whether it is directional or not, so I think putting it in a separate structure is unnecessary. You can still rotate and move the the light, you just need to recalculate the AABB afterwards so that the quad tree remains updated. The AABB cannot just be moved, since the light is not round anymore when it is made directional. If a light is not directional, you can just move the AABB, and no recalculation is required. I am changing some things in the light class so it automatically updates the AABB by either moving or recalculating it when parameters affecting the shape or orientation/position of the light are changed. Right now, you have to do it manually, which can become very confusing :?

The light beam on the other hand needs a separate structure, since it renders the light in a completely different way (a quad). The light rendering is extensible for this reason, but it currently still only supports circular light sources. While not completely realistic, I do not think that anybody will notice that the light beam does not calculate shadow softness using the shape of the beam emitter but rather just a circle positioned along the center point of the beam emitter :wink:
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

Ockonal

  • Jr. Member
  • **
  • Posts: 58
    • ICQ Messenger - 449909010
    • View Profile
    • WinCode
SFML Light System - Let There Be Light
« Reply #24 on: February 10, 2012, 02:05:10 am »
Great answer, thanks :) Maybe you can tell the near time of new release?

Now I'm rewriting the most part of you code with new structure and optimizaton, maybe, I can wait a few time for your updates and make my own after that.
Developing 2d engine&game using: sfml, box2d, librocket, spark2, zoom&zoost, thor

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
SFML Light System - Let There Be Light
« Reply #25 on: February 10, 2012, 02:40:01 am »
I will probably finish it in 2-3 days, unless the OpenGL states issue turns out to be a bigger problem than currently think it is.
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

Ockonal

  • Jr. Member
  • **
  • Posts: 58
    • ICQ Messenger - 449909010
    • View Profile
    • WinCode
SFML Light System - Let There Be Light
« Reply #26 on: February 10, 2012, 08:59:42 am »
Okay, I'm waiting for you ;)
Developing 2d engine&game using: sfml, box2d, librocket, spark2, zoom&zoost, thor

Ockonal

  • Jr. Member
  • **
  • Posts: 58
    • ICQ Messenger - 449909010
    • View Profile
    • WinCode
SFML Light System - Let There Be Light
« Reply #27 on: February 14, 2012, 02:39:15 pm »
lolz123, sorry for disturbing, any news? :)
Developing 2d engine&game using: sfml, box2d, librocket, spark2, zoom&zoost, thor

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
SFML Light System - Let There Be Light
« Reply #28 on: February 15, 2012, 03:06:23 am »
Sorry about that, its taking a bit longer than expected. I am still having problems with the OpenGL states getting messed up  :(. It should be ready soon.
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

Ockonal

  • Jr. Member
  • **
  • Posts: 58
    • ICQ Messenger - 449909010
    • View Profile
    • WinCode
SFML Light System - Let There Be Light
« Reply #29 on: February 17, 2012, 11:46:29 am »
lolz123, okay, no problems. Write here if you have any trobles. Maybe I and other peoples can help you.
Developing 2d engine&game using: sfml, box2d, librocket, spark2, zoom&zoost, thor