Hi,
recently, i started thinking about the lights in a project. So i first look for some topics talking about that, i saw the "This is not a game" way to do that, but i didn't found this method apropriate. Then I found PixelEffects. I learned GLSL language and tried to make my own light effect, and I did it
But in my game, i want more than one light source, so i started to modify the shader in a way that it can handle 32 light sources, multidirectional or unidirectional. The problems comes here, despite my best efforts, only one source is displayed at a time...
I hope someone could read my work and, maybe, found the problem, it would help me a lot !
Here's the shader.
Thank you beforehand, and sorry for the english, not my first language
Share a Shader!
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Share a Shader!
Hi,
I'm new to shaders and I'm sure I wouldn't learn it that fast.
Therefore my question.
Is it difficult to make two lights for a little spaceships? All areas that are not affected by the lights should be obscured/nebulized.
Basically like in Ref's "tile_page" (viewtopic.php?f=4&t=3733&start=100#p61880).
I'm new to shaders and I'm sure I wouldn't learn it that fast.
Therefore my question.
Is it difficult to make two lights for a little spaceships? All areas that are not affected by the lights should be obscured/nebulized.
Basically like in Ref's "tile_page" (viewtopic.php?f=4&t=3733&start=100#p61880).
"Docendo discimus" - Lucius Annaeus Seneca
Re: Share a Shader!
My first shader! It pixelates an image.
- Attachments
-
- pixelize.love
- (61.19 KiB) Downloaded 685 times
Re: Share a Shader!
Not sure that this is exactly what's wanted but hope it helps.Petunien wrote: Hi,
I'm new to shaders and I'm sure I wouldn't learn it that fast.
Therefore my question.
Is it difficult to make two lights for a little spaceships? All areas that are not affected by the lights should be obscured/nebulized.
Basically like in Ref's "tile_page" (viewtopic.php?f=4&t=3733&start=100#p61880).
CAUTION: Contains 'CANVASES' and can cause heavy breathing and red eyes in some people!
Haven't figure out exactly what Xgolf is doing with fakecanvases yet.
Sure is a lot of code to get around. Like the greater than 200 fps with canvases even with a hand cranked dual core.
- Attachments
-
- headlights.love
- simple shader for simulated head lights
- (149.06 KiB) Downloaded 521 times
Re: Share a Shader!
Thank you! It's very nice!
I think I've got to learn this anyway.
I think I've got to learn this anyway.
"Docendo discimus" - Lucius Annaeus Seneca
Re: Share a Shader!
I don't know if this is any clearer but you can simplify the shader:Petunien wrote:Thank you! It's very nice!
I think I've got to learn this anyway.
Code: Select all
effect = gr.newPixelEffect [[
extern Image mask;
vec4 effect(vec4 color,Image tex,vec2 tc,vec2 pc)
{
vec4 img_color = Texel( tex, tc );
vec4 mask_color = Texel( mask, tc );
img_color.a = mask_color.a; // just transfer the mask's alpha to image
return img_color;
}
]]
Code: Select all
mask_canvas:clear(0,0,0,backgnd_intensity) -- for areas to be suppressed
gr.setColor( 255, 255, 255, beam.intensity ) -- for areas to be transferred as a beam
With a few extra lines in the shader, you could also add some color to the beam (yellow?).
Good luck being creative!
Re: Share a Shader!
Tried to comparing masking using pixelEffect and Stencil + mapPixel.
Result: pixelEffect >200 fps while Stencil + mapPixel 1 fps
Didn't full appreciate the speed penality with mapPixel plus I was unsuccesful at using characters as a mask - just got white rectangles.
The mask via pixelEffect is really simple to impliment:
1. create a canvas with the desired background alpha
2. draw on canvas using the desired foreground alpha
3. apply the effect
4. everywhere you drew will now appear with the foreground alpha
Attached file is a simple test.
Result: pixelEffect >200 fps while Stencil + mapPixel 1 fps
Didn't full appreciate the speed penality with mapPixel plus I was unsuccesful at using characters as a mask - just got white rectangles.
The mask via pixelEffect is really simple to impliment:
1. create a canvas with the desired background alpha
2. draw on canvas using the desired foreground alpha
3. apply the effect
4. everywhere you drew will now appear with the foreground alpha
Attached file is a simple test.
- Attachments
-
- mask.love
- Just a test of masking using characters
- (58.15 KiB) Downloaded 397 times
Re: Share a Shader!
Sorry for the late answer. Thank you for the explanation.
I'll try it if I get spare time. Thank you again.
I'll try it if I get spare time. Thank you again.
"Docendo discimus" - Lucius Annaeus Seneca
- Mandarancio
- Prole
- Posts: 11
- Joined: Mon Nov 03, 2008 5:08 pm
- Location: Parma - Italy
- Contact:
Re: Share a Shader!
Some one can help me to understand how make shaders like this two (of course I think is more than a single shader), both made using Love!
https://vimeo.com/45259228
https://vimeo.com/43841761
Final effect is really cool!
https://vimeo.com/45259228
https://vimeo.com/43841761
Final effect is really cool!
Arch Linux user..
..No Freedom without Sharing..
http://mandarancio.deviantart.com/
http://manda.netsons.org/
..No Freedom without Sharing..
http://mandarancio.deviantart.com/
http://manda.netsons.org/
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Share a Shader!
Those are really nice. I like the second one.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot], Semrush [Bot] and 3 guests