Jump to content
  • Advertisement
Sign in to follow this  
Uriel

Point Sprites with HLSL revisited

This topic is 4843 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! I wrote a shader displaying point sprites. It consist only vertex shader, which is simply passing data to fixed pixel pipe for processing. Looks like that: VS_OUTPUT VShade(VS_INPUT In) { VS_OUTPUT Out = (VS_OUTPUT) 0; Out.Pos = mul(In.Pos,matViewProj); Out.pSize = In.pSize; Out.color = In.color; return Out; } Pretty simple. The problem: sprites are not scaling. At all. They treat psize, as their final size in pixels - i set size to 800 and i get 800 x 800 pix mega sprite. DX docs says that such situation may occur if im passing "post-transformed flexible vertex format (FVF) vertices". Is there any way to get scaleable PS using HLSL? Thanks in advance for a quick anwser!

Share this post


Link to post
Share on other sites
Advertisement
I'm not 100% sure on this one w.r.t. PSprites, but with all other geometry, as soon as you switch over to a programmable path then **you** are responsible for all vertex processing. I assume that the fixed function is using some factor of position/depth/distance to scale the sprites - something you'll have to emulate yourself in the vertex shader.

Try using a depth-related value for scaling, once you've done your transform you should be able to get the depth of the sprite, scale/saturate this value to get a 0..1 scalar and you're set [grin]

hth
Jack

Share this post


Link to post
Share on other sites

Thanks, that solves the problem!

I have already implemented my own lame depth based linear scale function - at least im free ot that damn PointScale_A, B and C nightmare. Knowing screen horizontal resolution, depth and particle scale its an easy task.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!