[CAPX] Yet another shadow caster

0 favourites
From the Asset Store
Find the shadow is a game that you are challenged to find the right shadow for the image.
  • Rather interestingly, I can't actually see any functionality with the resolution, nor the pasters being included in a family.

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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?

  • 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.

  • 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!

  • wow

  • 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?! ;)

  • 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.

  • 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.

  • Thanks R0J0hound - this plugin is brilliant. I've seen this asked for a lot and people have been waiting for something like this for a long time, so I'm sure you've made a lot of people happy!

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

    This is a modified version of the capx if anyone wants it. Again, you should be able to use this as an include in many other sections of your games :) Again, just make sure you have a "Light & Shadow" layer.

    I've also increased the size of the pasters slightly to ensure they don't appear when scrolling to fast. This may have affected the resolution slightly, but it's not noticeable.

    Additionally, the top layer can have a blur effect added to it, which will help smooth out the shadows, but this should be optional in case it slows things down too much.

    Now the only issues appear to be the blend of the light sources seems to wash things out, rather than the nice blend R0J0hound is able to achieve.

    Also, on occasion, the fps will dropp down about half. I can't seem to replicate this a lot, but it seems to happen when moving the lights around a lot.

  • R0J0hound

    I've updated Paster, but now when I load my project, I get an error, reporting:

    Assertion failure: Warning: set rendering to current texture 0

    I've also been unable to get the colours to mix correctly, it's not as good as you managed in the past with the older Canvas plugin. Is that why in a later version you used 3 different colours for the falloff sprite, rather than a single version?

  • Re-download the plugin, I made a fix for r147.

    I did like the color blending in the canvas version, but I used a slightly different approach in the paster version so backgrounds wouldn't be as washed out. It could use improvement though.

  • R0J0hound

    Great, thanks!!!

  • This is strange, but when I try this shadow caster (and my game which uses your shadow casting technique) on Google Chrome it runs very smoothly. But when I run it on Node-Webkit, both run very slow and laggy.

  • R0J0hound

    is there an easy way to fix multiple overlapping shadows and shadows from objects that go through other objects?

    see attached picture:

    <img src="http://i61.tinypic.com/1zl7rjl.jpg" border="0" />

    modded .capx:

    drive.google.com/file/d/0BwK9oyausprPV1A2V0E0X0VkUTQ/edit

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)