Jump to content
  • Advertisement
Sign in to follow this  
akhin

Point Sprites and Vertex Shaders

This topic is 2881 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 all ,

I have a vertex buffer for primitives
I do set POINT SPRITE render state appropriately

And without trying with my effect fil which has a very simple implementation of a vertex shader ( actually doing nothing ) , I am able to render as expected

but when I bring the effect file as the code in below , then I cant see the point sprites :

Application


// view matrix and projection matrices are passed from my camera class
MATRIX16 worldMatrix;
D3DXMatrixIdentity(&worldMatrix);
MATRIX16 worldViewProj = (worldMatrix ) * (*viewMatrix) * (*projectionMatrix) ;
m_effect->SetMatrix("worldViewProj",&worldViewProj);
m_effect->SetTechnique("Fireworks");
unsigned int nPass ;
m_effect->BeginRender(&nPass);

m_effect->BeginPass(0);

m_vertexBuffer->Render(numOfParticles);

m_effect->EndPass();

m_effect->EndRender();




Effect File

float4x4 worldViewProj : WorldViewProjection; // This matrix will be loaded by the application

struct VS_INPUT
{
float3 position : POSITION;
float4 color : COLOR0;
};

struct VS_OUTPUT
{
float4 hposition : POSITION;
float4 color : COLOR0;
};

VS_OUTPUT VS( VS_INPUT IN )
{
VS_OUTPUT OUT;

OUT.hposition = mul( worldViewProj, float4(IN.position, 1) );
OUT.color = IN.color ;

return OUT;
}

technique Fireworks
{
pass Pass0
{
VertexShader = compile vs_1_1 VS();
}
}

Share this post


Link to post
Share on other sites
Advertisement
You might need to set the point size in the vertex shader. Try adding float Size : PSIZE to your vertex shader output and write the point size.

Share this post


Link to post
Share on other sites
Quote:
OUT.hposition = mul( worldViewProj, float4(IN.position, 1) );

I'm not an HLSL expert, but you can try reversing the order of multiplication:

OUT.hposition = mul( float4(IN.position,1),worldViewProj);

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!