• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
March 28, 2024, 08:16:36 am

News:

Please use .png instead of .bmp when uploading unfinished sprites to the forum!


Rain Effect

Started by lirmont, September 29, 2011, 03:58:27 pm

lirmont

September 29, 2011, 03:58:27 pm Last Edit: October 02, 2011, 05:23:41 pm by lirmont
So, now that the system for sprite effects (as complete or incomplete as it is) is integrated into Tethical, here's something non-sprite animation related from me: a rain effect.

Basically, do you believe it's rain? What you're seeing is a test setup (it's based off the one that was set up for integrating sprite animations) with a map, a background, two NPCs, and the rain effect over it all. See the 3rd picture for a really zoomed out look at the monstrosity that is the rain effect.

Tethical Rain, Attempt #001: 001, 002, and 003.

Panda3d particle effect file: Tethical Rain, Attempt #001

--

Already Suggested:


  • An effect when the water hits the map (from Kivutar; implemented)

  • Rain should be vertical (from Kivutar; implemented)

  • Rain should come from one general direction as opposed to a single point (from RandMuadDib, also PGF; implemented)

  • Fog on map during rain (from PGF; implemented by faking with sprite effect)

  • Rain shouldn't be long (from PGF; implemented, but subject to change; length varies with scaled size of map)

  • Rain shouldn't be blue; real rain is gray-blue with high transparency (from PGF; transparency implemented, color changed, but needs feedback)

  • Rain should have different sized drops (from Cheetah; implemented as x1, x2, x3 line thickness at random chance)

  • A rain drop should disapear instead of traversing the map if a collision occurs (from Kivutar; semi-implemented; more accurate range for the rain is in place).

  • Varying duration/speed (from RandMuadDib; implemented)

  • Varying orientation (from RandMuadDib; implemented)

  • Realistic fog (from RandMuadDib, also PGF; unlikely because I can't think of a good approach to this)


Kivutar

Nice start!
Having an effect when the water hit the map would be great.
The rain should be more vertical I think.
Tethical, an online FFT clone

RandMuadDib

I think, if possible, it should all be in 1 direction instead of coming from a source point. It would be more realistic
I will show you the power of SARDIIIIINES!!!!

lirmont

September 29, 2011, 05:55:15 pm #3 Last Edit: September 30, 2011, 09:18:50 am by lirmont
Here's a more vertical version:

Tethical Rain, Attempt #002: 001 and 002.

Panda3d particle effect file: Tethical Rain, Attempt #002

Also, Panda3d's particle system doesn't support collision detection, so, at the very least, accurate ground effects would require drawing all the geometry (lines in this case), tracking them, and adding each line to a collision handler (or calculating collision). If I were familiar with writing particle systems to begin with, I'm sure I wouldn't think it's a very difficult thing to do, considering the lines that are getting drawn could easily be mapped to a colision ray of the same slope as the line that's being drawn (i.e. the rain) and you know where it would intersect with the map as soon as you generate the line (because lines/rays don't change slope or position), but I'll have to think it over a while.  

Pickle Girl Fanboy

September 29, 2011, 06:25:32 pm #4 Last Edit: September 29, 2011, 06:31:02 pm by Pickle Girl Fanboy
It looks poor.  Vanilla has two rain effects, I believe.  The first is the drip layer, which sits over the map, and just repeats an animation of rain hitting the ground over and over again (with another animation for rain hitting water).  The second effect is just rain dropping straight down, possibly repeated over each square.

The rain you have is too long, and too blue.  Real rain is kinda gray-blue with high transparency.  So is the rain effect in Vanilla.  It shouldn't all come from a singular source, as much as the Occuria do piss on Ivalice.

First, work on getting a rain animation similiar to FFT's.  I'm sure there's a way to rip it and study it.  Only once you have that down should you start working on wind and it's interactions with rain, clothing, and objects.

If you can, implement a low lying mostly transparent fog that hovers just over the ground when it rains outside.

I'll google some images.

Cheetah

September 29, 2011, 09:21:10 pm #5 Last Edit: September 29, 2011, 09:22:05 pm by Cheetah
Similar to PGF, I would recommend using FFT as a model for this. The interesting this about rain in the air, is that it looks the same where ever you are standing. Those it can be a screen effect instead of throwing in 3D elements. The only time rain looks different is when you see it hitting the ground, and that is a texturing thing or adding an additional effect on top of existing textures.

So to do a rain effect you just have different sized drops falling whatever direction you want on different plains. This is a technique used for almost all weather effects in even modern games. The progressively smaller falling rain drops on progressively further back plains (noting that you don't actually have to move this plain anywhere) is thus always constant regardless of what you are looking at or from what angle and just repeats.

I will say that when you are looking up your method looks really cool, but this rarely ever happens in a tactical game.
Current Projects:

lirmont

September 29, 2011, 11:18:21 pm #6 Last Edit: September 30, 2011, 07:52:42 pm by lirmont
This attempt: non-particle effect lines with collision. Ideas used in this approach: trade blue for gray, add landing effect (expanding circle, fades over 4 seconds), keep vertical.

Tethical Rain, Attempt #003: 001, 002, 003, and 004.

Like I said in the previous post, it'll still take a while to make it correct. That is, I don't know how to determine normals at a point in Panda3d yet (i.e. normal would give the direction the little puddle would be rotated to lay flat against the geometry), and I don't know how to tell the collision engine that the camera moved. Meaning, the effect only works in the view it was created in (or so it seems). Anyway, the benefit of this method is I now know (programmatically) when one of the rain drops slams through the map, and the programming is set up to take the bounding box of a map as input (meaning you can use any map).

Tethical Python Rain Test: Tethical Rain, Attempt #003.

Lijj

The last post looks pretty great Lirmont.. makes a lot more sense than the first.
  • Modding version: PSX

Kivutar

It's too bad the particle system does not support collisions... Using particles files used to provide a very modular approach. With this custom code, we'll have to think an abstraction layer.
But your last try looks so good, I can't resist to add it ingame event if it makes the engine more complicated. I wanted to code something like that, but didn't know how to do it: I know collisions, but I wonder how you made the circle. Let me study this code... :)
Tethical, an online FFT clone

lirmont

I will update the first post with a suggestions list. Keep them coming.

@Kivutar: While you're looking at the code, know that you can use this command to view the collisions happen: base.cTrav.showCollisions(render). I removed it during cleaning up some of the parts of the code. Anyway, other stuff to know is that the "rayCollider" (it's really only a line segment) is set to check against ALL geometry. This is not the right approach, but, to make it work to have something to show, it is what I used. The correct way is to include a "Collide" entry in the .egg file of the map OR generate a set of CollisionPolygon(s) at runtime (it would only include top-facing polygons). That way, only the map is checked against. Doing this correctly should free up some room for more rain drops OR more complicated landing effects. That is, if you consider the FFT maps, they could just have top-facing polygons be made into colliders at run-time. If you consider my maps, I would need to make a simplified map (consisting of only large/blanket top-facing polygons) to use as a collider.

Kivutar

A rain drop should disapear instead of traversing the map if a collision occurs.
Tethical, an online FFT clone

lirmont

September 30, 2011, 07:28:30 pm #11 Last Edit: October 01, 2011, 10:36:25 am by lirmont
Building on the same attempt, ideas/changes in this iteration: sprite effects on landing (fog), auto-generated collision surfaces based on map geometry, and appropriate rotation for the circles that get drawn (though, they're overshadowed by the fog, in my opinion).









Map collider surface in place of map:


Tethical Python Rain Test: Tethical Rain, Attempt #003-2

First, for the sprite effects to be used appropriately, there needs to be an optional cache of processed textures (the Effect class requires an alpha channel). I implemented a make-shift solution for this particular demonstration, but I'm not capable of reading python's documention well enough to know how to use the langauge's in-line dictionary feature for arrays. But, there's no slowdown once I added the mini-cache to the Effect to store the last used texture object.

Second, Panda3d's documention was unhelpful with regards to getting the model's transform properties from the .egg, so I'll have to address that later. The transform properties are required for building the collision polygons. Otherwise, the mesh is loaded in real-size (huge) and is totally unsuable.

That's all for now.

--

Now with double/triple width on occasion:







Tethical Python Rain Test: Tethical Rain, Attempt #003-3

Pickle Girl Fanboy

The color is much better.  Might be a little too gray, though that could be the battlefield.  Post rain animations/videos of this map as it is now, and brighter.  If that doesn't look right, then increase the blue or decrease the non-blue colors (make it less gray) by 10%.

The fog needs work - check out videos of Tenchu and Tenchu 2 on youtube, specifically levels where it rains, and levels with fog and smoke.  Vagrant story might also have something to contribute, but I don't remember if it ever rains (maybe during the prologue?), though it is foggy in places.  The Snowfly Forest might help.

Fog sticks to the lowest lying areas available, near water, near areas that don't get as much sunlight as nearby areas, and places that fit all the previous criteria and are also shielded from the wind.

There are many different types of rain, but rainfall usually follows a pattern.
*It gets dark.
*isolated drops fall, usually round and fat.
*More drops fall, faster and faster.
*Eventually, you get the "sheet" of rain, where rain falls evenly over all the ground, and is moved in sheets by the wind.  You get some turbulance around areas where the wind is blocked or channeled into weird shapes.

But all this isn't needed.  All we need is for someone to find and reverse-engineer both the raind drops and the rain landing animations, and then you implement something similiar.  You can get away with a cheap effects if you vary the tempo and drop distribution from among several patterns, chosen at random.

It'll help if you post gifs or videos.  Youtube is fine.

lirmont

October 01, 2011, 06:25:43 pm #13 Last Edit: October 02, 2011, 11:23:38 am by lirmont
Here's video for 3 different settings I came up with based on the 7 variables the system takes into account to create the rain: Light, Medium, and Heavy.


Setting 1: Light Rain (100+ fps)

Spawn Cycle: Every .15 seconds
Spawn X Drops: 4
Drop Duration: .75 seconds
% Chance, Impact Circle: 10%
% Chance, Impact Fog: 10%
% Double Drop: 0%
% Triple Drop: 0%


Setting 2: Medium Rain (90+ fps)

Spawn Cycle: Every .01 seconds
Spawn X Drops: 1
Drop Duration: .75 seconds
% Chance, Impact Circle: 50%
% Chance, Impact Fog: 20%
% Double Drop: 10%
% Triple Drop: 2%


Setting 3: Heavy Rain (18-20 fps)

Spawn Cycle: Every .01 seconds
Spawn X Drops: 2
Drop Duration: .75 seconds
% Chance, Impact Circle: 80%
% Chance, Impact Fog: 50%
% Double Drop: 80%
% Triple Drop: 25%

_

RandMuadDib

umm... where are the vids? i can't seem to find them.
I will show you the power of SARDIIIIINES!!!!

lirmont

They're links in the first sentence, following the colon. You have to download them to view them, but they're small (~2mbs). Sorry for the inconvenience.

RandMuadDib

October 02, 2011, 10:08:47 am #16 Last Edit: October 02, 2011, 10:16:15 am by RandMuadDib
oh duh i'm just blind :D sorry for being dumb

I like Heavy, but i find it weird that the fog pops up randomly when drops hit. i think if a fog effect were to be introduced, it should cover the whole map all the time, real fog doesn't pop in and out of existence, it rolls.

Is there any chance to get the individual drops to fall at different speeds? it seemed a little too computerized, or mechanical. Nature is much more randomized, but i know we (as a species) can only accomplish so much with computers. And while i'm on the subject, slight differences in direction (not every raindrop, and not more than a degree or two in any direction) might help with that as well. Again, don't know whats possible or too difficult, just throwing out ideas.
I will show you the power of SARDIIIIINES!!!!

lirmont

October 02, 2011, 05:18:33 pm #17 Last Edit: October 02, 2011, 05:19:14 pm by lirmont
Panda3d only offers one type of fog, with two implementations. The "fog" is color scaling (as opposed to a physical object; "volumetric"). So, what follows is the best it probably has to offer:

Light + Linear Fog


Medium + Linear Fog


Heavy + Linear Fog


Heavy + Exponential Fog


The degree deviation and drop duration deviation is implemented in this version. The impact fog sprites don't work with the fog (for whatever reason), so they're disabled when fog is enabled.

Tethical Python Rain Test: Tethical Rain, Attempt #004

Pickle Girl Fanboy

Just forget about the fog for now, it'll take to long to get it right.  As for the rain, make an option or toggle for a static rain like FFT or for more realistic and randomized rain.