SFML community forums
Help => Graphics => Topic started by: wilbefast on March 12, 2011, 01:29:36 pm
-
I'm having a bit of trouble correctly blending shadows - I don't want the area to be darkers when there are multiple shadows lying on top of eachother:
(http://i54.tinypic.com/4rcg2q.png)
Is there a way to iteratively build a sort of layer and then composite it on top of the render target? At the moment I'm exporting a list of vertices from the pathing matrix and projecting each point of each one to create a 4 point polygon.
William
-
There's a source code on the wiki for a complete light manager:
http://www.sfml-dev.org/wiki/fr/sources/lightmanager
The page is in french but you should be able to use the code.
And it's for SFML 2.
-
You forget that I'm fluent in French (I just occasionally get my genres wrong) :P
Thanks for the link - still, is there no way to build an image iteratively in 1.6? Something along the lines of (pseudo-code):
pixel_buffer temp_image(view.width,view.height,colour(255,255,255));
for each vertex in view
{
Polygon shadow(colour(0,0,0));
shadow.add(vertice.start); //A
shadow.add(projection(vertice.start)); //B
shadow.add(projection(vertice.end)); //C
shadow.add(vertice.end); //D
temp_image.draw(shadow);
}
temp_image.set_alpha(200);
window.draw(temp_image);
I've been following this guide on tigsource:
(http://www.saltgames.com/wp-content/uploads/2009/10/unannotated-light-and-single-wall.png) (http://forums.tigsource.com/index.php?topic=8803.0)
-
Nop, sorry. I don't think you can do that in 1.6.
-
Okay then - good to know their way. Guess I'd better switch to 2.0 for my next project...
-
There's a source code on the wiki for a complete light manager:
http://www.sfml-dev.org/wiki/fr/sources/lightmanager
The page is in french but you should be able to use the code.
And it's for SFML 2.
what??? That is awesome, wish I knew that was there before
-
And for those who don't speak/read French, there's Google Translate.
Got interested so I wanted to read it and translate worked pretty well. There were some inaccurate translations I think but you could understand the underlining message.
-
That code is SFML 1.6 right? How much work would it take to convert it to 2.0, just change the way stuff is drawn?
-
And it's for SFML 2.
;)
-
Ooops. Shame on me :)
Now I just need to wait for your Radeon HD fix and I can actually try it out!