Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

steg

Line Lists - rain effect ?

This topic is 6583 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Anybody used line lists in DX3d8 to do some rain effects? What is the best way of moving these lines to achieve the desired rain effect? Thanks, Steve You can achieve anything if you want it badly enough.

Share this post


Link to post
Share on other sites
Advertisement
I never tried making rain, but how about treating each rain as a vector, each vector has its value (The length of the drop) and its direction.
A good direction for rain is maybe... 30 or 45 degrees.
Add all of the drops together into one big linked list, and you got yourself rain



- Goblineye Entertainment
The road to success is always under construction

Share this post


Link to post
Share on other sites
I guess that is one way, but could you not create a custom vertex for a line list and then use DrawPrimitive to render the list with the D3DPT_LINELIST flag? I was just wondering how to move them, I guess each line (rain drop) associated in the list would need a direction and speed value (voila vector as you suggested), but the angle would come into play by the x,y,z coordinates.

struct rainVERTEX
{
int nSpeed;
int nX, int nY, int nZ;
};

rainVERTEX vertices[]
{
{ 5, -5.0, -5.0, 0.0 },
{ 5, 0.0, 5.0, 0.0 }
};


d3dDevice->DrawPrimitive( D3DPT_LINELIST, 0, 1 );

Here, 5 is the speed - what do you think ?

Put these into a custom vertex buffer for rendering with DrawPrimitive. Can you put such information into a custom vertex buffer - I know you can put X,Y,Z or other vector info such as texture coords (u,v), but can you put in the speed values of which I could use for translation and change on the fly and draw again?

Maybe I just dunno what I''m talking about?!

Any help is much appreciated,
Thanks,
Steve

You can achieve anything if you want it badly enough.

Share this post


Link to post
Share on other sites
Rain??? what a COOL idea!! I gotta play with that...

what about a custom vertex..

struct RAINVERTEX
{
float x, float y, float z;
DWORD color;
};

#define D3DFVF_RAINVERTEX {D3DFVF_DIFFUSE}

then have a small struct

struct RAINDROP
{
RAINVERTEX vertex; //rain vertex
D3DXMATRIX matWorld; //local world matrix
int rainlength; //??? the length of the rain drop
};

You would then use the matrix for placing/positioning your rain drop in the world coordinates, then maybe have a SMALL trianglestrip of length rainlength..(ie. you keep drawing in a loop until you reach the desired length of the raindrop)..
I''m not sure but triangles would be faster, and a little more realistic I think than a simple line...plus you could have BLOOD RAIN!! hehehe

I''ll have to play with this one (ie. tutorial??? hehehe)

Wazoo

Share this post


Link to post
Share on other sites
Hi Wazoo,
Sounds cool, I think I''ll have a play when I get home from work tonight. Your idea sounds cool, dunno about the rain length loop though, although it possibly would look better than using line lists? Blood rain, now that sounds awesome, I think you should give it a go and give us one of your cool tutorials on it !-)
BTW - the line list stuff I found in the dx8 docs, it did say you could use it for effects such as heavy sleet, rain etc...
Cheers Wazoo,
Steve


You can achieve anything if you want it badly enough.

Share this post


Link to post
Share on other sites
Yes, a small tri would probably work best. And you can alpha blend the tip so that it "fades" out. I would not hold a matrix for each raindrop though, that would be too much memory, as well as too much processing (tranforming each raindrop?) I would have a particlemanager that holds all of the raindrops and have that hold the matrix, then the random raindrops are in local space relative to the manager.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!