Jump to content
  • Advertisement
Sign in to follow this  

[CANCELED] VS 3.0, PSIZE fails

This topic is 4493 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 have a very simple PointSprite shader which works in vs_2_0 mode. When moving to vs_3_0, the PSIZE out param seems to be ignored.
float4x4 WorldViewProj : WORLDVIEWPROJECTION;
float4 UserPosition : POSITION;

struct Vs_out
    float4 Position  : POSITION;
    float4 Color : COLOR0;
    float Size : PSIZE;

Vs_out Transform(
    float4 Position  : POSITION , 
    float4 Color : COLOR0 ){
    Vs_out Out = (Vs_out)0;
    // Distance from Player
    float dx = Position.x - UserPosition.x;
    float dz = Position.z - UserPosition.z;
    float dist = dx*dx + dz*dz;
    Out.Position = mul(Position, WorldViewProj);
    Out.Color = Color / (dist * 20.0 + .3);
    Out.Size = 34.0 / Out.Position.z;
    // Out.Size = 0.0; //Or whatever 
    return Out;

technique Tech
    pass P0
        vertexshader = compile vs_3_0 Transform();
        pixelshader  = NULL;

            Device.RenderState.DestinationBlend = Blend.One;
            Device.RenderState.PointSpriteEnable = true;
            Device.RenderState.PointScaleEnable = true;

            Device.RenderState.ZBufferEnable = false;
            Device.RenderState.AlphaBlendEnable = true;

            Device.SetTexture(0, partsTexture);
            Matrix worldViewProj = Device.Transform.View * Device.Transform.World * Device.Transform.Projection;
            effect.SetValue("WorldViewProj", worldViewProj);
            effect.SetValue("UserPosition",  new Vector4(center.X, 0f, center.Z, 0f));

                Device.VertexFormat = CustomVertex.PositionColored.Format ;
                Device.DrawUserPrimitives(PrimitiveType.PointList, N_PARTICLES, partsVertices);

The particles seems to have a constant enormous size, for any value of Out.Size (even 0.0). When i set Device.RenderState.PointSize in my app, it works well. On which points are models 2.0 and 3.0 different ? Thanks. [Edited by - raytaller on June 7, 2006 11:23:35 AM]

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!