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

Author Topic: Let There Be Light 2  (Read 132255 times)

0 Members and 1 Guest are viewing this topic.

DJuego

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Re: Let There Be Light 2
« Reply #135 on: September 20, 2016, 11:28:45 pm »
Yes. Thanks Cmdu76. Thanks. Thanks. Thanks! Any evolution of this extension is a great news.

In my opinion LTBL2 is one of the more interesting projects in the SFML cosmos (yes thor too  :P). Damn! It is one of the more interesting projects in the 2D graphics universe (!).  :D

Your changes seem fantastic. I will try to test them so soon be possible for me in Mingw-builgs gcc 6.2.0 and Visual Studio 2015.

I like very much the header-only proposal but if you need to add the LetThereBeLight.hpp & LetThereBeLight.cpp... is it header-only?  ??? Anyway i am happy. This is the joy of the day for me.  8)

DJuego


Cmdu76

  • Full Member
  • ***
  • Posts: 194
    • View Profile
ReĀ : Let There Be Light 2
« Reply #136 on: September 21, 2016, 08:32:40 am »
I worked using VS2015 and I haven't tested it elsewhere yet.

Okay that is not really header-only, I read that having .cpp is better for compilation time.

I hope people will test it and give me some feedback.

I'm also working on the normals, I'm getting inspired by the implementation of Breush, here : https://github.com/JumpingToasts/LTBL2

The normals aren't in the two files, yet. I'm waiting a good implementation for normals

« Last Edit: September 21, 2016, 08:37:04 am by Cmdu76 »

Guido_Ion

  • Newbie
  • *
  • Posts: 42
    • View Profile
    • Flow Soccer development
Re: Let There Be Light 2
« Reply #137 on: September 25, 2016, 07:46:08 pm »
Thanks Cmdu76! I've been using LTBL2 for some time now ( video: https://youtu.be/CPy467vARa4 [EDIT: new better video] ) It's great, the main problem I have is the performance though. I'm going to try your version and give you some feedback.
« Last Edit: September 25, 2016, 10:24:25 pm by Guido Bisocoli »

Cmdu76

  • Full Member
  • ***
  • Posts: 194
    • View Profile
Re: Let There Be Light 2
« Reply #138 on: September 29, 2016, 12:19:41 am »
Today, I added my version of LTBL2 in my engine.

The previous version of a demo game using the main version of LTBL2 was running at 45 FPS,
The new version of this demo game using my version of LTBL2 is running at 55 FPS.

That is a small improvement but still good anyway. (+22%)


There is still something uncool with it, I was working on normals, but I'm not a graphical expert. I haven't succeed in adding that functionnality.
I added some code an interface to provide it but there is still a problem somewhere that don't render the normals...
It would be so great if anyone can help there :D

« Last Edit: September 29, 2016, 02:31:54 pm by Cmdu76 »

R23MJ

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Re: Let There Be Light 2
« Reply #139 on: September 29, 2016, 03:15:48 am »
First off: Thank you Cmdu76 for picking this project up!

Secondly, maybe this has been mentioned before, and there is probably a simple answer for it, but shouldn't the light be blocked by the side of the object that is facing it? I took some screenshots to help explain that. Look at the following.

(click to show/hide)

Everything looks fine when you draw whatever is blocking the light. Check out what happens when you don't though.

(click to show/hide)

The side of the box opposite to the light is blocking the light.. For most people this probably isn't a problem; however, in my project, I don't plan to draw the light blockers. Maybe this is intentional, I'm not sure, maybe you could look at it Cmdu76?

To further explain what I mean, I edited the second image to produce what I would expect the result to be.
(Or similar to this)

(click to show/hide)

EDIT::
To, again, further explain, I would expect the result to be the above because we are lighting in a 2D world, meaning the side of the block facing us could have any depth, in a 2D world that wouldn't be measure. For the light to shine on the side of the block facing the player we would have to assume the light is 3D, that is, it has enough depth to light the top of the block, and it is also positioned closer the the player, meaning it is on a different plane that the object it is shining light on.
« Last Edit: September 29, 2016, 03:30:58 am by R23MJ »

Cmdu76

  • Full Member
  • ***
  • Posts: 194
    • View Profile
Re: Let There Be Light 2
« Reply #140 on: September 29, 2016, 12:03:49 pm »
lolz123 added this functionnality but as the project wasn't documented most people doesn't noticed it.

You can use :
shape->setRenderLightOver(true); // If you use my version
shape->_renderLightOverShape = true; // If you use lolz123 version's

Edit : I tested it, and the result wasn't what I expected, I'll take look...

R23MJ

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Re: Let There Be Light 2
« Reply #141 on: September 29, 2016, 02:26:09 pm »
I simulated the effect I wanted simply by setting the objects color to the light systems ambient color. Works unless you use alpha.

Ezhoikam

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Let There Be Light 2
« Reply #142 on: October 02, 2016, 02:08:42 pm »
Is it possible to use it with the isometric tiled maps?

Cmdu76

  • Full Member
  • ***
  • Posts: 194
    • View Profile
Re: Let There Be Light 2
« Reply #143 on: October 02, 2016, 03:28:48 pm »
@R23MJ

I hadn't the time to really look at it...
But you can try something like that :
sf::RectangleShape shape;
shape.setSize({ 200.f, 50.f });
shape.setPosition({ 500.f, 300.f });
shape.setFillColor(lightSystem.getAmbientColor());
lightSystem.createLightShape(shape);
And then draw your shape

@Ezhoikam

Isometric usually divide y-axis length by 2, but I suggest you to try. The effect might be good depending on the render you want.

smguyk

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
Re: Let There Be Light 2
« Reply #144 on: October 29, 2016, 08:36:46 pm »
Cmdu76 I'm trying to use your version but I'm getting these errors:

(click to show/hide)

What do I have to do? :/

I also tried the original version but I can't compile that one either because make_unique and other c++14 stuff isn't supported on my compiler

edit: yeah it was due to old files it's fixed now thank you!
« Last Edit: October 30, 2016, 02:13:50 pm by smguyk »

Cleroth

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Let There Be Light 2
« Reply #145 on: October 29, 2016, 08:38:19 pm »
Why are you using VS2012?

Guido_Ion

  • Newbie
  • *
  • Posts: 42
    • View Profile
    • Flow Soccer development
Re: Let There Be Light 2
« Reply #146 on: October 30, 2016, 01:02:05 am »
Cmdu76 I'm trying to use your version but I'm getting these errors:

(click to show/hide)

What do I have to do? :/

I also tried the original version but I can't compile that one either because make_unique and other c++14 stuff isn't supported on my compiler

Maybe you should rebuild the entire solution, VS might not have recognized that you changed some files.

Guido_Ion

  • Newbie
  • *
  • Posts: 42
    • View Profile
    • Flow Soccer development
Re: Let There Be Light 2
« Reply #147 on: January 21, 2017, 08:50:14 pm »
Hey, I'm having trouble getting this effect: I need occluders to cast shadows over other occluders like this:



I need the box on the bottom to be affected by the box on the top (meaning: be in the dark), like the player is.
In (1) player and grey box are visible and on (2) only the player is in the dark while the grey box isn't affected by the shadow of the big box.
Any idea on how to achieve this?

DarkRoku12

  • Full Member
  • ***
  • Posts: 203
  • Lua coder.
    • View Profile
    • Email
Re: Let There Be Light 2
« Reply #148 on: January 22, 2017, 03:31:19 am »
Hey, I'm having trouble getting this effect: I need occluders to cast shadows over other occluders like this:



I need the box on the bottom to be affected by the box on the top (meaning: be in the dark), like the player is.
In (1) player and grey box are visible and on (2) only the player is in the dark while the grey box isn't affected by the shadow of the big box.
Any idea on how to achieve this?

I was messing with this severals months ago, i couldn't reach a reliable way to solve this issue, but you can try the method "renderLightOverShape"
I would like a spanish/latin community...
Problems building for Android? Look here

Ungod

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: Let There Be Light 2
« Reply #149 on: January 28, 2017, 05:22:28 pm »
I use ltbl2 in my game "Last of the Ambaras" now :)  Just wanted to share some impressions. I refactored the framework to support my own quad-tree and modified the interface. I didnt see ltbl2 in a top-down-game before, so I guess some of you might be interested in how it could look.