Skip to main content
gamedev.net
🔒 Locked

point sprite shaders

Started by programmer_tom 1 reply 600+ views
Original Post
programmer_tom
programmer_tom
i'm trying to write a shader for point sprites so can move around the vertices of their VBs w/o locking, smuggling the velocity vector stuff in the vertex format. now that i have set my shader, i can see the points move correctly, but the texturing is non-existant ( just white, un-textured points ). anyone know a trick to fixing this prowblem? do i need to have UV coords in the format even though it's a point sprite? is this even possible to do what i wanna do? is there some magical register i need to write data to in the shader?
turnpast
turnpast
In the FF the texcoords of point sprites are generated for you and I speculate that adding a TEXCOORD0 to your PS input should pick up these texcoords. You must have have point sprites enabled (D3DRS_POINTSPRITEENABLE) for this, otherwise the UVs will be the same across the entire sprite. As you implied it does not make sense for the VS to output texcoords when it can output a PSIZE, to be useful they must be somehow generated post vertex shader. In your PS it should just be a matter of sampling the right texture. I have not done this with shaders, but I would be interested to know how it it works for you.
programmer_tom
programmer_tom
thx for the help.

i eventually figured it out...took a while.

if you wanna do your own point sprite shader, you gotta pretty much
figure out how to rewrite the default shader.

it's not that bad if you know the formula they use for attenuation that you need to make the sprites scaled right.

now i have all the power in the world though...no need to lock VB to move PS vertices around :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.