Sign in to follow this  

geometry shader point sprites

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

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