[effect] Fog fx

  • Another cool stuff quickly ported in 2 minutes.

    Fog effect for misty scenes..

    Live demo:

    http://gigatron3k.free.fr/html5/C2/FX/fog

    Latest fx file : http://gigatron3k.free.fr/html5/C2/FX/fogfx.rar

    Contact me for special parameters like direction speed density etc....

  • Nice, again!

    I was actually looking to make some fog effects for my current project so this might do the job nicely.

    I'm hoping to be able to create some fog on a given layer, but "mask" it from certain areas. For example, I want the fog to always be "on top" of any game characters, but only outside of a structure and not inside. The character is always "on top" of the structure (since the structure is a cut-away side view) but I want them to be "behind" the fog.

    Is there a good/simple way to mask the fog effect from any given area?

    Thanks!

    ~Sol

  • Nice, again!

    I was actually looking to make some fog effects for my current project so this might do the job nicely.

    I'm hoping to be able to create some fog on a given layer, but "mask" it from certain areas. For example, I want the fog to always be "on top" of any game characters, but only outside of a structure and not inside. The character is always "on top" of the structure (since the structure is a cut-away side view) but I want them to be "behind" the fog.

    Is there a good/simple way to mask the fog effect from any given area?

    Thanks!

    ~Sol

    Can you explain your request by an image.. ?

    Thanks

  • Depends on your layout sizes and the amount of exits, maybe you can just add collision triggers, that will bring the player to in front of structure/bottom, it'll probably be more efficient for rendering too, as long as you don't actually need to cut the image or mask out a certain shape, I wouldn't go with masking.

  • Gigatron

    Sure, here is a picture of pretty much what I'm looking to do:

    Hoping "fog" can be extended to other "weather" style effects too, like rain/snow.

    @Lof

    I'm using layers to significantly help with z-ordering... as it stands, the way I'd like to implement fog, I couldn't have everything on the same layer and use simple z-ordering anyway, since the fog would have to be both in-front of things AND behind things at the same time.

    As pictured, the "structure" has to be behind the "actors", but in front of the fog - and the "actors" have to be in front of the "structure".

    The only way I can think of to do this, is to have the fog opacity set to "0" if overlapping the structure, but this would create a "soft finish" around the structure (unless my fog sprites/particles were very small and in great numbers) - which is not ideal for performance.

    I was hoping for a mask of some sort to define where the fog would be omitted on the layer set up for fog (which would preferably be in front of everything else). I'd like to make this layer a "weather" layer ideally... so I can do fog/rain/snow etc.

    Perhaps there's a better way to do this entirely? I'm not sure!

    ~Sol

  • SoldjahBoy

    Ok... it's on the way; you must not apply this shader to layer or layout but to sprite. So the sprite become

    the mysterious Vtex (shader running inside this). Simply pin sprite to the visible area of your game(must follow the scene) after

    this use Z order command to move the Fog under or upper the structure and the actor.

    Will try to add rain lightning etc... before July.

    Regards

  • OH awesome!

    Thanks Gigatron - just one question though if it pins to a sprite (my character), what will happen if there is many instances of this character? My character is going to be used for every character in game (just re-texture each part to make them look differently) so if I understand how you explain it - what will happen if I have this effect pinned to many characters at once?

    I guess the problem I have is that; with many characters, one or two may be outside while the rest are inside - maybe I need to just have some extra layers and "move" the character who is outside to a layer that is further behind?

    I can't wait to see the extra weather effect though - that will be awesome!

    Thanks again

    ~Sol

  • OH awesome!

    Thanks Gigatron - just one question though if it pins to a sprite (my character), what will happen if there is many instances of this character? My character is going to be used for every character in game (just re-texture each part to make them look differently) so if I understand how you explain it - what will happen if I have this effect pinned to many characters at once?

    I guess the problem I have is that; with many characters, one or two may be outside while the rest are inside - maybe I need to just have some extra layers and "move" the character who is outside to a layer that is further behind?

    I can't wait to see the extra weather effect though - that will be awesome!

    Thanks again

    ~Sol

    I will make an example for you .. in fact you must just use Z order for your objects.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Gigatron

    It's all good, I made some workaround with my layering... I now have two layers that characters can exist on - one which is on top of the structure layer, and one that is behind the weather layer.

    My layers now look something like this;

    1. ACTOR

    2. BUILDING

    3. WEATHER

    4. ACTOR 2

    So I've made some events to simply move the character to another layer behind where the effects will be - but if you want to make an example to show what you mean then that would still be helpful - maybe I've made this extra work for no reason

    Thanks again

    ~Sol

  • I understand more and more the complexity of the problem , however, playing with glsl alpha

    will hope solve the problem.

    Sprite is inside fog or not, i will continue to work on this;

    http://gigatron3k.free.fr/html5/C2/FX/fog2

  • OH man, I'm getting excited! This is looking really cool Gigatron

    If you can't/don't want to mess around with a masking area - I've taken the non-lazy route and doubled up my layers and added some events that move objects/characters/etc between the various layers to be in front or behind the weather layer. It wasn't my ideal solution because it seemed like over-complication and double handling of objects - but it's working now and I should stop being so lazy!

    Cheers for all your effort - the rain and lighting effects look super!

    ~Sol

  • Gigatron.

    That's looks ridiculously good. Fab work.

  • Ok then every one can now try and test this fx based on work of reecpj from ST;

    http://gigatron3k.free.fr/html5/C2/FX/fogfx.rar

    You can manipulate speed, x,y direction of fog, and moon x,y pos

    Thanks all for testing ;

  • Gigatron Thank you so much

  • Gigatron Thank you so much

    Thank you too for your good comment.

    However the dev fx is a bit advanced if i add lightning it's become nice;

    http://gigatron3k.free.fr/html5/C2/FX/fog2

    btw:

    With this fx i learned how add layer with glsl <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

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