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

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

0 Members and 5 Guests are viewing this topic.

Roose Bolton of the Dreadfort

  • Full Member
  • ***
  • Posts: 113
  • Full-time Procrastinator, Part-time programmer.
    • View Profile
    • Personal Portfolio/Website/Blog
Re: SFML Light System - Let There Be Light
« Reply #105 on: April 16, 2012, 07:21:48 pm »
Hey Lolz..

I hope your still here.. I'm so depressed :(

Something I think you might have changed has broken something in the latest release.

Before, if I added a light, it would light up the texture behind it, which was cool because you could set the ambient light to (0,0,0) and it would be dark everywhere, then you could have a torch or lights light up certain areas, this does not work anymore.

the lights dont actually light up the texture behind them, it seems as if its on another layer

test it yourself,

add a big background image, set the ambient light to (0,0,0) then place a light in the centre, you wont see the light.

I hope you can fix this it's major to the little game I'm making and I was enjoying it so much :(

Cheers
« Last Edit: April 16, 2012, 07:28:48 pm by 1337matty »
Trying so very hard to finish at-least one project.

Watch out for the RAII police, they will get you.

www.bantersaurus-games.com

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #106 on: April 19, 2012, 04:54:07 pm »
It doesn't work anymore because of some changes in SFML.
The new version will fix this, sorry that it is taking so long. It is nearly done though, it will probably be released this weekend.
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

Roose Bolton of the Dreadfort

  • Full Member
  • ***
  • Posts: 113
  • Full-time Procrastinator, Part-time programmer.
    • View Profile
    • Personal Portfolio/Website/Blog
Re: SFML Light System - Let There Be Light
« Reply #107 on: April 19, 2012, 07:04:02 pm »
I haven't updated my SFML though?

either way, thanks a lot - cant wait :D
Trying so very hard to finish at-least one project.

Watch out for the RAII police, they will get you.

www.bantersaurus-games.com

HighQuality

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • http://www.nevereal.net
Re: SFML Light System - Let There Be Light
« Reply #108 on: April 24, 2012, 09:07:09 pm »
Got a new ETA for the new version?
Can't wait to test it out btw, looks awesome :)

Will this system work for a huge world and will it be relatively fast? (for example 65536x65536 pixels)
Also, how would you go about programming something similar to a sun outdoors, so it casts shadows in the same angle on all objects for example.

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #109 on: April 26, 2012, 12:10:46 am »
Sorry that it is taking so long, the new version of SFML introduced a lot of new bugs  :P, and I also took part in Ludum Dare this past weekend. Most of the bugs come from the render textures (FBO's/pBuffers).

I may just do FBO's manually in OpenGL (thus really making it entirely SFML-independent), so future updates to SFML will not affect anything. Also, it would then be faster on my machine (and therefore probably others as well), since render textures take entire seconds to create on my machine for some reason, but normal FBO's are instantaneous.

Hopefully it will be finished by this weekend ::)

@ HighQuality:
The system can support massive worlds, since it has a spatial partitioning system. How fast it runs depends on the density of the lights, since more on screen at a time will be slower.

I thought about a separate sun feature before, I will work on it in the version following the next version.


Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

jmcmorris

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #110 on: April 26, 2012, 12:20:10 am »
Looking forward to the next update!

I'm curious how you would go about creating this sun feature. I'm not sure how you could detect if the player is underground or not without having knowledge of the rest of the world.

I am working on a sandbox game, which I'm guessing is what HighQuality is doing. This is what I plan on doing... I have a wall tile layer and one for the ground as well. If the both are empty then I will fill that space in with light.

HighQuality

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • http://www.nevereal.net
Re: SFML Light System - Let There Be Light
« Reply #111 on: April 26, 2012, 06:59:00 pm »
@lolz123
That's great, participated in Ludum Dare as well, although I didn't finish the game on time due to it being too ambitious and I decided to quit a little after midnight around 3 hours before the competition ended (I'm from Sweden)

@jmcmorris
Actually I'm "porting" the engine a Game Maker project of mine to C++, it's an online rpg, won't call it an MMO yet since it's not massive by any means so far although it got the potential to be (I'm not exactly porting it, it's more of a remake)
The Game Maker version got about 15 months in the works and the C++ one like one.
Got more than 2 years experience of multiplayer programming in GameMaker through 39dll and got a basic understanding about how most stuff on the internet works.
If you wish you can check out our website at www.nevereal.net
Anyways, won't turn this topic into a discussion about our private projects more than I've already done since that's pretty offtopic and most likely breaks the forum rules.

scorch

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #112 on: May 01, 2012, 03:17:18 pm »
Will this support normal maps? It's the only thing I miss in this light system. :D

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #113 on: May 02, 2012, 12:32:19 am »
Sorry that it has been taking so long. Anyways, there is now a new version (1.5) that works with the latest SFML2! The code has been completely restructured, and a naming convention was adopted.

So, now all you have to do to use it in your project is link to the Source folder for a static link, and then link to OpenGL. Glew is no longer a dependency.

I added the hull transparency feature, but it is not quite working yet  :-[. It will render a bit strangely at the moment. It will be fully functioning in the next version.

I am now working on sunlight, normal maps, and the ability to run multiple separate light systems for the next version ;)
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

DJuego

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #114 on: May 02, 2012, 01:02:42 pm »
I am deeply interested in the evolution of this project. Thank you very much for your efforts, Lolz123!
It seems destined to be an amazing tool.

P.S.

From manual:  'A self-expanding quad tree is currently still in development, there are still a lot of bugs to iron out.'   :P This is incredible!!




DJuego
« Last Edit: May 02, 2012, 01:14:51 pm by DJuego »

scorch

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #115 on: May 02, 2012, 06:23:14 pm »
If you can implement normal maps, perhaps I'll have a look on porting it to .NET (if you don't mind ;D) so that I can use it on a project of mine.  ;)

N1ghtly

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #116 on: May 02, 2012, 09:53:45 pm »
Along with the Thor library this is the most interesting library for SFML in my opinion :)

nulloid

  • Full Member
  • ***
  • Posts: 134
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #117 on: May 03, 2012, 03:43:16 am »
Quote from: Lolz123
I added the hull transparency feature, but it is not quite working yet  :-[. It will render a bit strangely at the moment. It will be fully functioning in the next version.

Maybe my solution I've just implemented today will work for you. See examples here. At the end of the post, there is a series of equations, telling you the color components of the shadow's color. (Note, that this is not a physically correct model, as far as I know.) The shapes are just alpha-blended on the shadowed texture. I think it is not the best solution, but that's not related to the problem.

Unfortunately, I can't just copy the code, since it is written in Haskell. (Only the rendering is done by SFML, the calculation of colors is in Haskell. But if you want to see, just ask :))

Also, if you have any other idea, please, share with me. Maybe that's better than this.

A question: will you implement mirrors? Because if so, I'll really consider using your engine instead of mine. (I have some ideas related to this, too, so maybe I can help.)
« Last Edit: May 03, 2012, 03:50:18 am by nulloid »

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #118 on: May 04, 2012, 12:18:18 am »
Thanks for the link! However, I am doing transparency without color at the moment. It just makes only some of the light shine through, but does not change the color of the light. I didn't even think of doing different colors yet, maybe I will try to add that later. If I do, I will probably have another look at your equations  ;). My idea at the moment would be to render the shadows with the transparent object's color with multiplicative blending to the lighting buffer, after having rendered the light to it.

I am not sure why you would want mirrors in a 2D game, since you will not see anything really interesting, unless you are shining a laser at it. Curved mirrors would be pretty difficult (if not composed out of a lot of small planar mirrors which would make it insanely processing intensive), but a planar mirror should be possible, if you render a second light representing the image of the light source in the mirror, and then invert the shadow masking for the mirror. That, or you could stencil out the part overlapping the mirror and then flip it. I'll give it a try once I complete the existing feature list  :)
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

DJuego

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #119 on: May 04, 2012, 12:55:36 am »
Damned nostalgia!

   Mirrors+Laser+2D = DEFLEKTOR (in my good old Commodore 64).

   

The physic for plane mirror in this case (beams of highly coherent light) is relatively easy. "the angle of incidence equals the angle of reflection" and so...

 ;D

P.S: I suggest a change log for Let There Be Light.

DJuego

Sorry for my English!

« Last Edit: May 04, 2012, 01:00:27 am by DJuego »

 

anything