Sign in to follow this  

Point Sprites and Vertex Shaders

This topic is 2542 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
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

This topic is 2542 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this