I used to change the UV of a quad for rain effect, but it was camera angle dependant.
Now I use particles, but it still looks weird when looking straight up (billboard-like effect, and the particle image is 2x16 resolution). What can I change in this case?
please post a image or video. i think afterwards you will find help in here. also i have a couple of pretty nice rain fake effects in mind, which should work good.
What about just using an inside-out cylinder around the camera and scrolling the UVs on that?
That is very similar to the quad method. Basically if you’ll look straight up or straight down you will see the disadvantage. And your rain shouldn’t have a direction in this case other than straight.
Particles fix both of these problems.
I thought I explained my problem.
Here are the files: mediafire.com/?ljmytnz2mie
Look straight up and you’ll see what I’m talking about
The first idea that pops into my mind is to render the particle billboards using a shader that is given the camera direction - as rain drops are a distorted sphere this could be done by inverting the distortion then rendering a sphere (Which is easy in a shader.). The inverting of the distortion would involve the cameras orientation relative to the vertical, so there is no distortion when looking straight up or down but full distortion when looking horizontally. You would of course also need to throw in a motion blur effect and lighting, but it could work very well. It is kinda overkill of course, but I suspect it would look good. Of course, for distant rain I’ld just stick to large billboards of fast moving streaks - this kinda trick only matters for the nearby stuff.
I know about that disadvantage. The only reason I mentioned the cylinder method is because it worked great in the King Kong game. And the only reason I know that thats the way they did it is because I DID look straight up when I played that game. I just didn’t think it was that big of a deal.
But do it however you want, I don’t care. I don’t know if you can turn billboarding off in the particle system (never used it), but if not you can just use the RigidBodyCombiner instead.
Why so complicated?
Something like setBillboardAxis() for particles would fix this
The one on the particles looks like setBillboardPointEye().
@T Rex: Does the rain have an angle in that game?
whats the count of your particles you emit, with a billboard assigned?
i think the problem is, why you cant get a right answer there is no function implemented, where you can rotated your billboard effect flexible. its maybe related to the performance.
i would try to write my own particle system for solving this. those particles dont need any collision, all have the same velocity. so you could easily paint 2000 - 5000 particles and more (i have to test it) which are close to your cam , and rotating in relation to your camera.
the rain effect behind i would fake with complete rain scene billboards.
i just took a look into the particle reference, the particle system is very tiny at panda, its either not possible to touch a particle by id. so i really think the only way is to write your own rain particles.
I don’t have the knowledge and time to write my own particle system.
I know you are trying to help, but… seriously?
I apologise if this sounds rude, but then why not just write my own engine?
panda’s particle system works perfectly fine without collisions, you can easily “paint” that many particles with panda’s system already, you can already make the particles rotate the correct way and faking rain in the distance is best done with fog.
why would mainpulating a single particle matter in this case?
and why in god’s name would it be neccessary to write your own particle system? there is not a single reason to do so.
panda’s particle system is capable of handling rain quite fine. it has been done already. and even if you dont want to use the particle system there are many other ways to create rain, inlcuding geometry and UV-scrolling.
i think we told you about 3dozen times already krid-dirk-whoever. DONT confuse people, if you dont really know a sollution, just keep quiet and dont mislead people.
Lets forget this.
We kinda talked about those.
This got kinda off topic.
My current question is, can I change the billboard effect mode of the particles? I think setBillboardAxis() would work.
I have uploaded the sample ( mediafire.com/?ljmytnz2mie ), but if you guys still don’t understand my problem, here:
This is a video of the camera under the rain:
And this is camera facing up:
See what I mean?
I have heard people using particles for rain, so I thought panda can do that too
I think there is a billboard mode that allows you to make billboards that only rotate around the Z axis. Not sure which, off the top of my head.
um…
But
rain.setBillboardAxis()
does something completely different in the code I posted ( mediafire.com/?ljmytnz2mie )
in the meantime i code a quick and dirty solution.
it works nicley… you can even display more planes, but then you have to get rid of the plane spinning…
maybe this helps you a bit, sorry i wrote it in c++. but its easy to port into python.
//rain fake drh2010
#include "pandaFramework.h"
#include "pandaSystem.h"
#include "texturePool.h"
#include "cardMaker.h"
#include "rigidBodyCombiner.h"
#include "math.h"
#include "mouseWatcher.h"
PandaFramework framework;
WindowFramework *window;
GraphicsEngine *engine;
PT(ClockObject) globalClock = ClockObject::get_global_clock();
PT(AsyncTaskManager) taskMgr = AsyncTaskManager::get_global_ptr();
PT(MouseWatcher) mouseWatcher;
CardMaker particles("particles");
PT(RigidBodyCombiner) rbc = new RigidBodyCombiner("rbc");
int partCOUNT = 2000;
float speed = .08,wave,mx,my;
NodePath camera,rigNode,particlesGEO[2000];
void windowOPEN() {
framework.set_window_title("bla");
WindowProperties *props = new WindowProperties();
props->set_size(640,480);
props->set_origin(500,10);
props->set_undecorated(false);
window = framework.open_window(*props,0);
window->get_graphics_window()->get_active_display_region(0)->set_clear_color(Colorf(0,0,0,1));
}
void getCAMERA() {
camera = window->get_camera_group();
}
void getMOUSEWATCHER() {
mouseWatcher = (MouseWatcher*)window->get_mouse().node();
}
void paint() {
rigNode = NodePath(rbc);
rigNode.reparent_to(window->get_render());
int n = 0;
float x = -.9;
float y = -.8;
for (int i=0;i<partCOUNT;i++) {
particlesGEO[i] = NodePath(particles.generate());
particlesGEO[i].reparent_to(rigNode);
particlesGEO[i].set_scale(.015);
particlesGEO[i].set_color(0,0,1,0);
particlesGEO[i].set_pos(x,y,0);
particlesGEO[i].set_p(90);
x += .04;
n++;
if (n>99) {
n = 0;
x = -.9;
y += .2;
}
}
rbc->collect();
}
void animate() {
//rudimental camera spinning
camera.set_h(camera.get_h()-mx);
camera.set_p(camera.get_p()+my);
// set the particle movement and spinning...
for (int i=0;i<partCOUNT;i++) {
wave += .1;
particlesGEO[i].set_z(particlesGEO[i].get_z()-speed);
particlesGEO[i].set_hpr(camera.get_h(),camera.get_p(),camera.get_r()); // use hpr instead of look at, this way have such a better performance
if (particlesGEO[i].get_z() < -.9) {
particlesGEO[i].set_z(4*sin(wave)); //wait for 3 and more time till your particle get nicely mixed up, i was to lazy to use a other way
}
}
}
void mouse() {
mx = mouseWatcher->get_mouse_x();
my = mouseWatcher->get_mouse_y();
}
AsyncTask::DoneStatus mainTASK(GenericAsyncTask* task, void* data) {
animate();
mouse();
return AsyncTask::DS_cont;
}
int main(int argc, char *argv[]) {
framework.open_framework(argc, argv);
windowOPEN();
getCAMERA();
getMOUSEWATCHER();
paint();
taskMgr->add(new GenericAsyncTask("main task", &mainTASK, (void*) NULL));
framework.main_loop();
framework.close_framework();
return (0);
}
oh i just saw it what you mean, you also have to change the textures of your billboard in relation to the camera angle. so do 3 or more perspectives of your rain drops. …
it would look nice if you just rotate the planes, then you can easly see that your raindrops havnt a volume.
krid… again, I appreciate your willingness to help, but again, your post is confusing, I’m not good at C++ and in my impression you just reinvented the wheel and from what you wrote the end result won’t be that great anyway.
Please remain on topic, that is my latest question. this topic already has many posts but I still haven’t found anything useful.
My current question:
My current question is, can I change the billboard effect mode of the particles? I think setBillboardAxis() would work.
I have uploaded the sample ( mediafire.com/?ljmytnz2mie ), but if you guys still don’t understand my problem, here:
This is a video of the camera under the rain:
And this is camera facing up:
See what I mean?
I have heard people using particles for rain, so I thought panda can do that too

I think there is a billboard mode that allows you to make billboards that only rotate around the Z axis. Not sure which, off the top of my head.
Its .setBillboardAxis(), but if you’ll use it on rain:
rain.setBillboardAxis()
,the result is pretty different
now please ignore what I/was posted earlier…
ok, im going to show you
i think you dont understand what im say, so im finish this code and you will see it will look good and also it will look like the raindrop have a volume. really i dont see any point, why i should try to help to reach a better looking result. at your way you just ended at 2d feeling of the raindrops. like flat strips which falling from the heaven, either you will just see a thin distortion if a raindrop moves nearly exactly onto the center of your cam. this will be the result. the billboard effect is there to improve this a bit.
my 2c solution is here
it changes the texture as the cam rotate to a certain pitch - see if it fits your needs

look like the raindrop have a volume.
thats why I use billboards!

at your way you just ended at 2d feeling of the raindrops
did you even run my sample?
Please, I have already asked you to look only at the question on my previous post. I don’t need other help. Don’t post anything more, pm me if you want. This topic is getting useless.
my 2c solution is here
it changes the texture as the cam rotate to a certain pitch - see if it fits your needs
you insert the coins again, thats nearly that what i said, my solution would include more than 2 textures. but this is what i thought, to do.