[HLSL] Pointsprite texture coords?

Started by
1 comment, last by ajoling 18 years, 1 month ago
I'm porting my particle classes to HLSL. Everything is going fine, except I just cannot find a single source on forums/google how to get the proper texture coordinates! And that, for example, RenderMonkey uses some kind of 3DS model as particle type isn't very comforting either. I'm sure it should be possible, multiplying 1.0 to some value for example. Does anyone have some advice? Remember: I'm using pixelshaders (HLSL). I know how to do it with the 'old' FVF method :).
www.persistentrealities.com for Inline ASM for VB, VB Fibre, and other nice code samples in C++, PHP, ASP, etc.<br/>Play Yet Another Laser Game!<br/>
Advertisement
I'm reasonably surprised that no one replied. I guess it really is an unknown thing in DirectX. Do we have to go back to textured quads again for using texture coordinates properly in HLSL? I just can't believe that's the way things should be.
www.persistentrealities.com for Inline ASM for VB, VB Fibre, and other nice code samples in C++, PHP, ASP, etc.<br/>Play Yet Another Laser Game!<br/>
Okay, for the record, I found the problem. Seems it was 'quite' simple.

POINTSPRITEENABLE = true;

Has to be put in the effect file. Then texture coordinates are generated perfectly. So, something like this:

VS_OUTPUT VS_Particle_main(float4 Pos: POSITION){	VS_OUTPUT Out;	//Multiply with VWP.	Out.Pos = mul(Pos, view_proj_matrix);		Out.vPos = Pos.xz;	return Out;}float4 PS_Particle_main(float2 vPos: TEXCOORD0) : COLOR {	//Simply return texture:	return tex2D(sampler_Particle, vPos);}technique Particle{   pass Normal   {		AlphaBlendEnable		= true;		AlphaTestEnable			= false;		SrcBlend				= ONE;		DestBlend				= ONE;		POINTSPRITEENABLE		= true;		POINTSIZE				= 2.0f;		POINTSIZE_MIN			= 20.0f;		POINTSIZE_MAX			= 30.0f;			VertexShader = compile vs_1_1 VS_Particle_main();		PixelShader = compile ps_1_4 PS_Particle_main();   }}
www.persistentrealities.com for Inline ASM for VB, VB Fibre, and other nice code samples in C++, PHP, ASP, etc.<br/>Play Yet Another Laser Game!<br/>

This topic is closed to new replies.

Advertisement