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 / Point Sprites

Author
Message
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 4th Oct 2010 19:49
Is there anything on point sprites? When DX9 first came out I read some articles/tutorials (from google) about them, but I could never get them to work. These would be ideal for a particle system, but I don't see anything that would suggest that GDK would impliment them.... Any news?

The fastest code is the code never written.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 4th Oct 2010 20:27
i posted a PointSprite function here http://forum.thegamecreators.com/?m=forum_view&t=176242&b=22, maybe it helps? or perhaps i got the idea wrong

[url][/url]
Nothing's impossible, it's just a matter of time...
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 4th Oct 2010 20:35
Quote: "or perhaps i got the idea wrong"

I beleive you do. A point sprite is a 2-D representation in 3-D space. The sprite is scaled according to distance from the camera. I honestly don't understand the mechanism used, but the scale calculations and position on screen are supposed to be done by the graphics card (or that's the way I understand it).

The fastest code is the code never written.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 6th Oct 2010 20:54
I don't know about point sprites but Dark GDK has particle commands.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 6th Oct 2010 21:25
Yea... I looked at them. They work like crap. I may be doing it wrong. Does anyone have a good demo using them?

The fastest code is the code never written.
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 7th Oct 2010 11:04
If you set the following render states in a shader technique then you'll get point sprites:



Just remember that GDK still draws triangles, so the mesh you're rendering should have a vertex count that's a multiple of 3, and you may want to disable backface culling, as it will still occur(due to it still drawing triangles).

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 7th Oct 2010 17:22
The code you gave is within an .fx right? I was looking for something done directly in directx. I suppose I could use a shader.... Do you have any suggestions?

The fastest code is the code never written.
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 7th Oct 2010 17:32
Alrighty then, you want to draw your vertex buffer using these args:



and if you're using FVF then you'll want to add the D3DFVF_PSIZE to your FVF mask or do the same via vertex declaration, and as you aren't using shaders you'll want to enable point sprite UV yourself via:



then it should work, assuming the rest of your rendering code is what you would otherwise do with a normal mesh.

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 7th Oct 2010 19:08
Thanks! I am not at my pc right now, but I will have to try that. By the way, will any shaders conflict with it? Not that I'm saying I will try to use a shader on my particles, but will using a shader on other objects have any effect on my point sprites or vice-versa?

Also, it's been a while since I have manually done a vertex buffer, so I'll have to look it up.

Will you be available for more questions about this?

The fastest code is the code never written.
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 7th Oct 2010 19:39
Quote: "By the way, will any shaders conflict with it? Not that I'm saying I will try to use a shader on my particles, but will using a shader on other objects have any effect on my point sprites or vice-versa?"


Provided you draw the vertex buffer using D3D directly, no, as the code to draw other objects will be separate.

Quote: "Will you be available for more questions about this?"


I guess, but you can just look up tutorials on how to make and draw vertex buffers in D3D as it's no different, you just change the primitive type and that's it.

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 7th Oct 2010 19:58
Quote: "you can just look up tutorials on how to make and draw vertex buffers in D3D "

Can GDK coexist with DX rendering? How would I do that? I mean, if you use :

would you be able to send a g_pDirect3D_Device->DrawPrimitive() command before dbSync()???? I mean, I haven't seen any tutorials doing that....

The fastest code is the code never written.
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 8th Oct 2010 05:15
Quote: "would you be able to send a g_pDirect3D_Device->DrawPrimitive() command before dbSync()????"


Yes, just remember that you can't (easily) have your draw calls placed somewhere inside GDK's render code, so your things will be drawn after the GDK scene which makes this ideal for a GUI, but not so much if you want to draw your own 3D things inside the scene, especially if they're transparent.

Quote: "I mean, I haven't seen any tutorials doing that...."


Because it's not something most people do.

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 8th Oct 2010 05:23
I was afraid of that.... I have decided to use GDK objects for particles. If I keep them simple and few, it should be fast enough....

The fastest code is the code never written.

Login to post a reply

Server time is: 2024-11-19 18:19:03
Your offset time is: 2024-11-19 18:19:03