Jump to content

  • Log In with Google      Sign In   
  • Create Account

SFML - Is there a way to implement lights?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • This topic is locked This topic is locked
12 replies to this topic

#1 Carlows   Members   -  Reputation: 141

Like
0Likes
Like

Posted 27 June 2013 - 01:03 PM

Well, this is what I have done:

 

http://www.youtube.com/watch?v=WscKWTXxvbY&feature=youtu.be

 

It's nothing amazing, but ignoring it, I was looking for a way to implement a small light on every bullet, first because the bullets can't be seen very well, but I don't want to use sprites for these... Is there a way to do that? I've been trying the sf::BlendMode::Add, but idk how does that exactly work sad.png.



Sponsor:

#2 Dante12129   Members   -  Reputation: 1166

Like
1Likes
Like

Posted 27 June 2013 - 01:29 PM

You could use a vertex array that stores each bullet as a vertex and make each vertex the color you want it to be. The sf::Points type only lets them be one pixel, though.



#3 Estivo   Members   -  Reputation: 159

Like
1Likes
Like

Posted 27 June 2013 - 02:09 PM

As well you can create your own drawable class.

 

http://www.sfml-dev.org/tutorials/2.0/graphics-vertex-array.php



#4 BeerNutts   Crossbones+   -  Reputation: 3007

Like
2Likes
Like

Posted 27 June 2013 - 02:38 PM

Check out my journal on the subject here  I'm using SFML and a light library someone else developed.  I'm not doing anything special with it, but it can do some cool things.

 

Here's a journal entry with a video of using it.  


My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

#5 BeerNutts   Crossbones+   -  Reputation: 3007

Like
1Likes
Like

Posted 27 June 2013 - 02:56 PM

Let me add, you can also do something much simpler, which is create a larger "layer" of all white for your glow around your bullets, and then do blendmode on it

 

Like this (see the player with glowing armor, and glowing bullets):

enemies1.png

 

Here's a link describing creating the glow image.

 

See my blog entry here detailing the code to do this.  You can find gimp tutorials on how to create the fuzzy white outlines for the glow effects.


Edited by BeerNutts, 27 June 2013 - 03:10 PM.

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

#6 Carlows   Members   -  Reputation: 141

Like
0Likes
Like

Posted 27 June 2013 - 03:52 PM

Let me add, you can also do something much simpler, which is create a larger "layer" of all white for your glow around your bullets, and then do blendmode on it

 

Like this (see the player with glowing armor, and glowing bullets):

enemies1.png

 

Here's a link describing creating the glow image.

 

See my blog entry here detailing the code to do this.  You can find gimp tutorials on how to create the fuzzy white outlines for the glow effects.

 

Great work with that, thanks!



#7 superman3275   Crossbones+   -  Reputation: 2061

Like
1Likes
Like

Posted 27 June 2013 - 04:03 PM

For lighting, I use a matrix of black pixels with different transparency values and draw them on top of my image. Depending on the lighting in that area, the transparency is changed.

 

Cheers :)!


I'm a game programmer and computer science ninja ph34r.png!

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

 

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here smile.png!


#8 Carlows   Members   -  Reputation: 141

Like
0Likes
Like

Posted 27 June 2013 - 05:01 PM

For lighting, I use a matrix of black pixels with different transparency values and draw them on top of my image. Depending on the lighting in that area, the transparency is changed.

 

Cheers smile.png!

 

Hmm, that sounds simpler, the problem is that every bullet is a mini-circle, it has the same color all over it, I try it, but I can't see any difference, lol



#9 BeerNutts   Crossbones+   -  Reputation: 3007

Like
1Likes
Like

Posted 27 June 2013 - 10:56 PM

Here's a link describing how to do make the glow around your objects.


My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

#10 Carlows   Members   -  Reputation: 141

Like
0Likes
Like

Posted 28 June 2013 - 09:19 AM

Here's a link describing how to do make the glow around your objects.

 

Begginer question here, does gimp have a way to paint all the silhouette white?

 

Edit: Solved, but i think my gimp have a bug, when i apply the DoG all the layer gets transparent, what the..


Edited by Carlows, 28 June 2013 - 09:55 AM.


#11 superman3275   Crossbones+   -  Reputation: 2061

Like
1Likes
Like

Posted 28 June 2013 - 09:35 PM

I'm just going to say this as someone who has done advanced graphics design work with Photoshop and Gimp: Just use one of the many great selection tools to get rid of everything around your ship, and delete it. Then, use a selection tool to get the area around your ship only. Then run the paint brush (with your glow color selected) over this selected area.

 

I hope that wasn't too confusing.

 

Cheers :)!


I'm a game programmer and computer science ninja ph34r.png!

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

 

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here smile.png!


#12 achpile   Members   -  Reputation: 101

Like
0Likes
Like

Posted 18 February 2014 - 01:40 AM

This is what I've made in SFML



#13 frob   Moderators   -  Reputation: 22736

Like
0Likes
Like

Posted 18 February 2014 - 01:52 AM

The discussion was happily concluded eight months ago.  The little demo movie is cool, but probably belongs in its own thread. I'm closing this one so it can resume its peaceful "long slumber". 


Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I write about assorted stuff.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS