Jump to content
  • Advertisement
Sign in to follow this  
rouncED

geometry shader point sprites

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

I googled for it but I couldnt find anything useful. I need help here cause im not sure how to make the geometry shader work with a point list to expand into triangles to make the sprites. (in dx10) My shader looks like this atm. float3 right; float3 up; float voxradius; struct vs_outputm { float4 pos : SV_POSITION; float4 col : TEXCOORD0; float4 nor : TEXCOORD1; }; struct ps_outputm { float4 col; }; vs_outputm vsm(float4 pos : POSITION, float4 col : DIFFUSE, float4 nor : SPECULAR) { vs_outputm output; output.pos=pos; output.col=col; output.nor=nor; return output; } [maxvertexcount(4)] void gsm(point vs_outputm input[1], inout TriangleStream<vs_outputm> TriStream) { vs_outputm output; output.pos=mul(input[0].pos-right*voxradius+up*voxradius,wvp); output.nor=input[0].nor; output.col=input[0].col; TriStream.Append(output); output.pos=mul(input[0].pos+right*voxradius+up*voxradius,wvp); output.nor=input[0].nor; output.col=input[0].col; TriStream.Append(output); output.pos=mul(input[0].pos+right*voxradius-up*voxradius,wvp); output.nor=input[0].nor; output.col=input[0].col; TriStream.Append(output); //output.pos=mul(input[0].pos+right*voxradius-up*voxradius,wvp); //output.nor=input[0].nor; //output.col=input[0].col; //TriStream.Append(output); TriStream.RestartStrip(); } ps_outputm psm(vs_outputm vso) : SV_TARGET { ps_outputm output; float3 nor; nor.x=vso.nor.r*2-1; nor.y=vso.nor.g*2-1; nor.z=vso.nor.b*2-1; float light=dot(-ldir,vso.nor); output.col=vso.col*light; output.col.a=1.0f; return output; } technique10 mapdraw { pass P0 { SetVertexShader(CompileShader(vs_4_0, vsm())); SetGeometryShader(CompileShader(gs_4_0, gsm())); SetPixelShader(CompileShader(ps_4_0, psm())); } } This is NOT working (all i get is a blank screen), is there any obvious error? (especially where i define the geometry shader) Thanks.

Share this post


Link to post
Share on other sites
Advertisement
I got it working, the problem is i wasnt getting the w paramater right... again... thank you drive though.

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!