Hi. Well it seems pretty muched fixed on all 3 axis which I can see would be good for the sun or something. I was wondering if you can tell me if Im being inefficent in my use of the function (I know DrawPrimitiveUP is crappy but other than that).
MatrixBB is your function altered a little but you'll know the parameters passed to it (I take it it was written in C++ originally)
Easy enough, A little trig, using the direction vector from the eye point to the look at point.
Now, we just want to rotate around the Y axis, so lets see if this works =):
Code:
Public Sub MatrixMatrixBillboardTranspose(result As D3DMATRIX8, a As D3DMATRIX8 , x As Single, y As Single, z As Single)
result._11 = a._11
result._12 = 0.0 'a._21
result._13 = a._31
result._14 = 0.0
result._21 = 0.0 'a._12
result._22 = 1.0 'a._22
result._23 = 0.0 'a._32
result._24 = 0.0
result._31 = a._13
result._32 = 0.0 'a._23
result._33 = a._33
result._34 = 0.0
result._41 = x
result._42 = y
result._43 = z
result._44 = a._44
End Sub
I simply omitted values from the transpose that are not included in a Y axis rotation matrix. Try it out =).
Im sure this is the right code Z. It seems to tilt by the Y axis only but I think that is an optical illusion since the camera is moving so therefore the Y axis must be fixed and X and Z face the camera. Correct?
I think I should put some ground in my little billboard project so it doesnt get too confusing .
By the way I wasnt sure wot u meant by the trig stuff so I left that out.
Thanks for making billboarding so much easier for me Z, I was sure getting confused b4 u saved me on this 1. I take it u skipped the direcx4vb.com billboarding lesson 2 .
Cheers mate. I will make sure I put by Z and Dan on my project . Maybe they will give u a degree 2 (or a second degree to add to the one u prob have already).
Z U have been great and I know u must have work to do so ignore this if u r busy but if u do have tme how did you work out which values to change in the function?
I dont mind not knowing this if u dont have time but if u do it would be interesting to know.
Glad it works =). Do some more tests with it, and let me know if it really is correct =).
What it SHOULD do is NOT rotate on either the X or Z axes. Take something sitting on your desk, and hold it up. If you imagine that there is an invisible line sticking through the top and bottom of the object, and you rotate around this line, you are rotating on the Y axis. If the line is sticking from left to right, you are rotating around the x axis, and if the line sticks through the front and back, you rotate around the z axis.
The trig I gave you was just a little reference. That is how the MS sample does it.
I actually started with point sprites, but decided that they were too slow when I needed scaled particles.
As for the matrix thing. Each type of transformation matrix is set up the same way, like so:
No, it isnt in the SDK Docs. There are a few for some of the more complicated matrices (projection matrices, and such). You can usually find them on the net.
After spending hours last nite on it I am having troubles with billboards still .
I made a project and had probs wiv it so I made another one and had exactly the same prob.
Everything works but only if the ground (the vertices making up the forest floor or wotever ground used) has a y value of 0.
If not the billboards start 'sinking' below ground level (boo hoo)
I understand if u r busy Z but if not would u mind have a quikc look at these projects please (I hate to ask u but u r the only one who is familiar with the BB code used).
Thanks
Dan
PS Both projects attempt the same thing and are set to a sreen res of 1600 x 1200. The project attaced to this reply has better GFX (and therefore an increased amount of code that is irrelevant to billboarding). The next project is attached to the next reply.
Soz the first 1 is the 1 wiv the bad GFX. I cant post the 1 wiv good GFX coz its too big. The 1 i attached above is better for demonstration purposes neway. It demonstrates both Y-Axis fixed bb's (and by uncommenting one line of code) bb's that are not fixed on any axis.
Hey Z u have helped me loads already its cool if u r too busy at the mo