Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Space dust with DarkGDK.

Author
Message
Stucky
15
Years of Service
User Offline
Joined: 11th Apr 2009
Location:
Posted: 22nd Jul 2009 09:18
I'm wondering how someone can accomplish a space dust affect using DarkGDK. Something like what you see in Freelancer or EVE Online. Where white specks of dust are stationary around your ship when you stay still but then move in the opposite direction of your ship when you move. Its a great way showing movement in the void of space. I've been trying to do it with particle systems, but I'm still completely oblivious to how particles work.
Phosphoer
16
Years of Service
User Offline
Joined: 8th Dec 2007
Location: Seattle
Posted: 22nd Jul 2009 20:21 Edited at: 29th Jul 2009 23:32
I'd position a bunch of small ghosted plains in a cloud around the player, and when the player get's close to the edge of the cloud, reposition it so that he is in the center again.

Potassium
15
Years of Service
User Offline
Joined: 12th Jul 2009
Location:
Posted: 22nd Jul 2009 20:33
Wanna cyber?
Stucky
15
Years of Service
User Offline
Joined: 11th Apr 2009
Location:
Posted: 29th Jul 2009 10:11
Quote: "Posted: 22nd Jul 2009 05:21
I'd position a bunch of small ghosted plains in a cloud around the player, and when the player get's close to the edge of the cloud, reposition it so that he is in the center again."


Well the problem with that is to the player it would just look like he's running into the same exact flat surface with a 2 dimensional texture over and over again. I know there's a way to do this with particles I just don't have the experience to do it myself.
Phosphoer
16
Years of Service
User Offline
Joined: 8th Dec 2007
Location: Seattle
Posted: 29th Jul 2009 23:10 Edited at: 29th Jul 2009 23:33
Quote: "Well the problem with that is to the player it would just look like he's running into the same exact flat surface with a 2 dimensional texture over and over again."


I don't really understand. Particles are pretty much just ghosted planes themselves.. Each plane would be a single particle of dust. I've used this method lots of times in the past, I promise it works.

dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 30th Jul 2009 03:07 Edited at: 30th Jul 2009 03:13
It's easiest to start with 3D lines, as Phosphoer said you want a cloud of planes, but ideally you'd want to wrap them individually around the camera rather than as a whole else you'd notice sudden jumps in them(depending on they are laid out). So you have a cube of points, then a virtual cube that initially houses all these points, this virtual cube follows the camera. If a point leaves the cube then you wrap its position so it's now inside the cube again but on the other side(note: this isn't the same as repositioning it at the cube wall, as doing so would lead to a flat plane of points if you moved really fast).

Now you have a bunch of points(nothing more than vectors thus far), if you want them to extend based on your movement speed then you need to draw a line from this point to this point + velocity, where velocity is a 3D vector much like the point positions. This is great and all but if you want them to be planes then things get more fun, first of all you won't under any circumstances use a separate object for each point or particle in this cloud, doing so is heinously inefficient. Instead, you will make a single object and alter the vertex buffer yourself to simulate many separate planes.

If you're not sure how to do this then, excerpt:

Note: the radius is set to -1.0f to prevent culling issues and culling shouldn't even be required on such an object anyway.

Say you have 100 particle planes, you'd want 400 vertices and 600 indices and you'd then arrange your index buffer to form 100 quads: {0,1,2,0,2,3,...}.

Now, to make these planes rotate toward the camera so you can always see them you must first find the 2 vectors for each point mentioned above(particle point and point+velocity, now known as pointA and pointB or just A and B). Then find the centre of them( (A+B)*0.5 ) then subtract the camera position, this gives you the vector between the centre of your particle and the camera(now known as C). Now just vector cross product this vector with your camera velocity(D = cross( C, velocity ) or cross( C, A-B )), this gives you a vector perpendicular to both the vectors between the camera and particle and the particle's direction(now known as D). You then write your 4 vertex positions where the first 2 are the points lying on the particle's position(A), you just set their positions to pointA + and - the perpendicular vector(D). Your last 2 vertices get the positions of pointB + and - the perpendicular vector(D).

I hope that made sense.

Stucky
15
Years of Service
User Offline
Joined: 11th Apr 2009
Location:
Posted: 30th Jul 2009 07:07
Quote: "
I don't really understand. Particles are pretty much just ghosted planes themselves.. Each plane would be a single particle of dust. I've used this method lots of times in the past, I promise it works."

Sorry I must have misinterpreted your original post. I see what you mean now.

Dark Coder, I have yet to use anything dealing with vectors in DarkGDK, but regardless I'll give your method a try. Thanks for the help. Maybe there's a good DarkGDK vectors tutorial I could look at for help.

Login to post a reply

Server time is: 2024-10-01 08:36:08
Your offset time is: 2024-10-01 08:36:08