TylerH Posted December 1, 2009 Share Posted December 1, 2009 For tracers I need the particles to face upwards, so that when projected they are planes parallel to the up vector of the camera, and not a billboard facing the camera's view. How exactly would I do this in the particle.vert shader? Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Josh Posted December 2, 2009 Share Posted December 2, 2009 Well you have two vectors to think about. One is the direction of the bullet. The other is the direction the camera is facing. You might want to solve this on the CPU, because it is a rather tricky problem to get right. You should be able to point the tracer in the direction the bullet is moving. Let's say the z axis of the tracer mesh is aligned to the bullet's velocity. Then find the camera xy position relative to the tracer and align another axis of the tracer to this vector. Fortunately the AlignToVector command lets you align any axis. Make sure you fill in all the parameters of this command, because they will all be 0 if you don't supply an argument. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
TylerH Posted December 2, 2009 Author Share Posted December 2, 2009 Umm, the tracer is a suped up particle shader running on an emitter with a tracer DDS. I am trying to, in the particle vertex shader, rotate the Quad 90 degrees on the Camera's Right Vector so that the Normal of the billboard quad would be equal to the camera's up vector. A rather easy problem to fix. I already have tracers working great, just this pet peave to get them aligned. Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
TylerH Posted December 2, 2009 Author Share Posted December 2, 2009 If you come on MSN I can explain this better. Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
TylerH Posted December 2, 2009 Author Share Posted December 2, 2009 Ok, better explanation. The whole purpose of a billboard is that it is a Quad. It is multiplied by the Model View Matrix to make it coplanar with the view plane. I don't want it to be coplanar with the view plane. I want it to be coplanar with the plane of the Camera's Up Vector. So that it appears how it looks when your eyes are level to a counter top and you are looking across it. Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Josh Posted December 2, 2009 Share Posted December 2, 2009 Why would you want the particles facing up? If you looked at the particle from the side it would become invisible. You want it to face the camera, and be aligned in the direction of travel. Is there any particular reason you want to use a particle emitter for tracers? It seems like an individual mesh would be easier to control. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
TylerH Posted December 2, 2009 Author Share Posted December 2, 2009 That is what I am starting to come to realize. I got a poor looking tracer by skewing the Z of the quad vertices, but it is horrid. You are suggesting I use a mesh? Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Josh Posted December 2, 2009 Share Posted December 2, 2009 I would. Load it from a file so it is instanced. Or you could create a mesh manually and copy it for each tracer. I don't think you will ever have more than 10-20 onscreen at a time, so performance isn't a concern. In the final version, I would have a cache of tracer mesh instances you just hide and show as they are needed, instead of creating things dynamically, but there's no need to worry about that until the basic version is working. Oh hey, here's one example where a single lua state helps, because the tracer cache can be shared across multiple guns. I think your hook suggestion from gmod is a good one, too. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
TylerH Posted December 2, 2009 Author Share Posted December 2, 2009 This can be locked up. I moved over to mesh tracers and got it working perfectly. The ones in Gallery still need a few tweaks. Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Josh Posted December 2, 2009 Share Posted December 2, 2009 I think you will find the results are not as good when you try to apply a texture to fade them along the length, when a cylinder is used. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.