Jump to content

rain


dreamhead
 Share

Recommended Posts

hi

i was wondering how to get a good rain effect white leadwerks, i use particels but they dont give a good effect wat i need.

so any ideas?

the real world is in my head

CPU-Intel® Core2 Quad CPU Q6600 @ 2.40GHz

CPU Speed 2.40 GHz

RAM 3.5 GB

OS Microsoft Windows XP Professional (Build Service Pack 32600)

Video Card GeForce 8800 GT

Video Card Features-

*Video RAM 512.0 MB

Video RAM 256 MB 512.0 MB

Hardware T&L Yes

Pixel Shader version 3.0

Vertex Shader version 3.0

using:leadwerks2.3,2

[ dreamhead.png

Link to comment
Share on other sites

If you take a look at the Jeklynn Heights C++ code, there is a weather system with code for rain that produces a pretty convincing effect.

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

I'm using physics rain, it doesn't look as good as graphical rain, but it works better. For example the rain drops don't fall inside buildings, and you can look out of a window and see rain outside, and no rain inside. What also works better is that the rain drops can cast shadows like real rain does, and the rain drops can be lit by lights, which makes it look good in the night also.

 

Around 1000 cubes doesn't slow down the FPS too much, but it depends how low your FPS originally was. With 100 cubes you still get decent rain, but not so heavy of course.

 

Of course the center of the rain area always follows the camera, so you don't need so much rain drops.

Maybe if it was possible to write a smear shader, then the rain drops would pull tails behind them.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Sounds interesting, have a demo?

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

Would 1 sided planes that always face the player (only along the Y axis though) be more efficient than cubes? The planes could have a transparent image of a rain drop type.
It might be, I have to try different methods and see which takes the least FPS. Also the cube physics shape might not be the fastest, although I heard that the primitive shapes on Newton are much faster than any custom composed shapes. I could still try if a tetrahedron physics shape would be faster than a physics cube.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

I'm using physics rain, it doesn't look as good as graphical rain, but it works better. For example the rain drops don't fall inside buildings, and you can look out of a window and see rain outside, and no rain inside. What also works better is that the rain drops can cast shadows like real rain does, and the rain drops can be lit by lights, which makes it look good in the night also.

 

Around 1000 cubes doesn't slow down the FPS too much, but it depends how low your FPS originally was. With 100 cubes you still get decent rain, but not so heavy of course.

 

Of course the center of the rain area always follows the camera, so you don't need so much rain drops.

Maybe if it was possible to write a smear shader, then the rain drops would pull tails behind them.

sound very interesting,do you have any vid of demo of or tut,to see how to use it

the real world is in my head

CPU-Intel® Core2 Quad CPU Q6600 @ 2.40GHz

CPU Speed 2.40 GHz

RAM 3.5 GB

OS Microsoft Windows XP Professional (Build Service Pack 32600)

Video Card GeForce 8800 GT

Video Card Features-

*Video RAM 512.0 MB

Video RAM 256 MB 512.0 MB

Hardware T&L Yes

Pixel Shader version 3.0

Vertex Shader version 3.0

using:leadwerks2.3,2

[ dreamhead.png

Link to comment
Share on other sites

I can make a demo soon, but first I need to optimize it a bit more. It's still too slow when used in a real game, even when it seemed not to take too much FPS in the tech demo :huh:

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

I can make a demo soon, but first I need to optimize it a bit more. It's still too slow when used in a real game, even when it seemed not to take too much FPS in the tech demo ;)

yea i can't wait to see a demo to :)

the real world is in my head

CPU-Intel® Core2 Quad CPU Q6600 @ 2.40GHz

CPU Speed 2.40 GHz

RAM 3.5 GB

OS Microsoft Windows XP Professional (Build Service Pack 32600)

Video Card GeForce 8800 GT

Video Card Features-

*Video RAM 512.0 MB

Video RAM 256 MB 512.0 MB

Hardware T&L Yes

Pixel Shader version 3.0

Vertex Shader version 3.0

using:leadwerks2.3,2

[ dreamhead.png

Link to comment
Share on other sites

I imagine that objects that no longer move get deleted? The solution seems cool and has many benefits as the rain exists out of enities (as you mentioned). If you can make the fps stay relatively okay, then this could work in this case. Since we need it to work in a situation with a fixed camera position, there should be plenty of pc performace left for the rain.

 

On one hand it would still be neat to have direct influance over particle angle direction. This has happened to me before with smal flames and also rain.

Link to comment
Share on other sites

Yes, objects which stopped moving are deleted, and also objects which fall under the ground (you can adjust the Y value).

 

Today I came up with an idea which could improve the performance a lot:

Not using physics, but doing a raycast matrix over the whole terrain and all objects on it with a given grid resolution.

When raindrops fall below the matrix, they will be deleted. The below check has to take also the speed of the rain particle into consideration, so that it will be deleted if the next iteration would bring it below the matrix.

That will do the same as physics, so raindrops don't get inside buildings.

 

If raycasts are fast enough, then it might also work fully dynamic without a precalculated raycast heightmap.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

From my experience raycasts are far from fast, so I'm thinking the precalc is going to be required. I have to wonder how fast it would even be to make this heightmap for raycasting. Are you thinking of casting a ray for every possible point and store off the height at which that ray hit something? I would think that would take a long time to compile such a heightmap.

Link to comment
Share on other sites

No, like I said, there would be a grid resolution, so basically like a heightmap resolution, which you can adjust when creating the rain class. Moving objects could also update the heightmap with a given frequency, so it would not be static.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

You need 67 million raycasts ;)

Well, but it doesn't really matter since you can do the precasting outside of the game, so the game only loads the heightmap.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

But the player is moving, so the area around the player would need to be recalculated each time he moves. The 8192x8192 is precalculated and not raycasted during game play.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Torque uses raycasts for rain. Hardy any FPS hit unless it is really pouring. I think they use a "thick" ray to find objects etc. but each drop also has splash animation when each drop hits something. Not sure how that works but i will look into it.

AMD Phenom II X6 Black Edition, 8GB, 120 GB SSD, 2TB HDD, nVidia GTX 570 1.2GB, Win 7 x64

Intel Core i5, 4GB, 120GB SSD, NVidia 360M 1GB, Win 7 x64

Link to comment
Share on other sites

I just remember using real-time raycasts for terrain decals (was probably doing something like 20+) and the fps was a very noticeable drop.

 

Doing ran in a shader would be the best way to do it, but making shaders is a pain and it seems not many people can do it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...