[CAPX] Yet another shadow caster

Show us your completed creations made in Construct 2

Post » Tue Oct 08, 2013 2:31 am

@R0J0hound

In my attempt to make it suitable to layouts of all sizes, I added in a feature that will destroy all of the pasters, and then re-create them (just to be tidy, and make sure they're in the same space). I then set their width and height to the size of the layout (so that they can be used everywhere), and finally, I set the resolution.

However, I noticed that when I scaled the paster objects, the resolution looked like it had dropped. I tweaked the resolution, as you suggested, and that didn't have any effect. Finally, I separated the family into their individual parts, and altered the scale for each, and I ended up with a black screen.

Please see the attached: https://dl.dropboxusercontent.com/u/50465867/Construct/NewLight.capx

I've made it work with any layout size (with a few more things to add to help maintain a high frame rate) but notice how low the resolution is? It doesn't matter how much I seem to change the RES variable, it doesn't appear to help.

It's a brilliant plugin, and thanks again. So close to getting it exactly how I want it. Any ideas how I can fix this resolution? The same technique worked fine for the older version.
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
84
S
15
G
7
Posts: 991
Reputation: 11,231

Post » Tue Oct 08, 2013 4:11 am

Rather interestingly, I can't actually see any functionality with the resolution, nor the pasters being included in a family.
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
84
S
15
G
7
Posts: 991
Reputation: 11,231

Post » Tue Oct 08, 2013 7:50 am

Because the pasters are just created they can't be picked from a family until the next toplevel event. A solution is to add a second "start of layout" event and move the "set resolution" action to that, or you could discard the family completely and do a "set resolution" for each paster type.
B
94
S
33
G
118
Posts: 5,396
Reputation: 75,853

Post » Tue Oct 08, 2013 3:12 pm

@R0J0hound

I can't seem to get that to work either. I had tried breaking up the family first, but that gave me the same result.

https://dl.dropboxusercontent.com/u/50465867/Construct/NewLight.capx

The shadow sections no longer correlate with the objects. I've tried changing the resolution, and then altering the size of the pasters.

The canvas plugin had a function that would resize the canvas, and not just change the size. Is that what I'm doing wrong?
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
84
S
15
G
7
Posts: 991
Reputation: 11,231

Post » Tue Oct 08, 2013 5:26 pm

The function is the same in Paster as it was in canvas. The issue here at least for me is the texture size is bigger than the max supported size of my video card. Also at least for this example you only need to cover the window not the entire layout.
eg.https://dl.dropboxusercontent.com/u/5426011/examples19/NewLight.capx

If you scroll just reposition the canvas accordingly.
B
94
S
33
G
118
Posts: 5,396
Reputation: 75,853

Post » Tue Oct 08, 2013 7:01 pm

I fiddled around with the composition some more and put it in one of my older examples to test it out with scrolling.
https://dl.dropboxusercontent.com/u/5426011/examples19/mario_record_w_shadows.capx

@Ashley Kudos! Copy/pasting between capx' and the replace object function work great!
B
94
S
33
G
118
Posts: 5,396
Reputation: 75,853

Post » Wed Oct 09, 2013 12:10 am

wow
B
12
S
3
G
1
Posts: 347
Reputation: 2,866

Post » Wed Oct 09, 2013 2:39 am

@R0J0hound
I wanted to ask for a request for this plugin I think it would help a lot with the light casting issue.
Isn't it possible to had a clear path?! of fill with transparent?!
This way we could past the object light to the canvas and then clear the shadow part leaving us with fully transparent canvas only with the

light "minus" shadows.. this canvas could be easely "destination out"
and the layer background painted as black!!... this way a layer underneath it would be revealed :D

What do you think?! ;)
B
11
S
3
G
5
Posts: 19
Reputation: 3,639

Post » Wed Oct 09, 2013 5:53 am

I've tried to combine the mario example and the original version. For some reason, although everything looks like it's been set up in exactly the same way, including names, etc... for some reason the lights aren't changing colour.

With this set up, you should be able to use it as an include. Then you just need to make sure you have a "Light & Shadow" layer where you want to use it.

https://dl.dropboxusercontent.com/u/50465867/Construct/LightCombo.capx

If anyone is able to fix the light colour, it would be appreciated.

I can't tell if it's faster or slower than the canvas version, but it creates a much better result.

The only other issue is that res just doesn't appear to work at all, so I've taken that out.
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
84
S
15
G
7
Posts: 991
Reputation: 11,231

Post » Wed Oct 09, 2013 7:53 am

@AnD4D
To fix the color make the "color" paster invisible and the "mix" paster visible. The RES stuff is working fine for me... try setting the resolution to something low like 100x100 to see the effect more readily? With linear sampling it can be very subtle at times.
As for speed the new method is certainly faster with webgl on. With webgl off it's slower but that's only because it uses 4 canvases instead of 2.

@xDGameStudios
That method of shadows is basically what my latest examples do. The paster and canvas plugins support pasting objects with "destination out". The paster object also already allows you draw a quad with your blend of choice.
B
94
S
33
G
118
Posts: 5,396
Reputation: 75,853

PreviousNext

Return to Completed Creations

Who is online

Users browsing this forum: No registered users and 3 guests