Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 01 Feb 2013
Offline Last Active Apr 14 2015 06:23 AM

Topics I've Started

True object billboarding problem

03 March 2015 - 06:47 AM



I'm in trouble trying to do object billboarding to display bones hierarchy.

Question 1 : should I do the billboarding first and then TRS to match the bone position rotation and size or, should I do the TRS first, which I've done already and then rotate around bone axis to align the bone mesh in front of the camera ?


Question 2 : I'm trying to do billboarding with a mesh, here are my steps:

1- get the vector object to cam in world space

2- project it on XZ plan by setting its y component to 0

3- normalize it (objToCamProj)

4- get alpah the dot between forward(0, 0, 1) and objToCamProj

5- get the up vector from cross(forward, objToCamProj)

6- create a rotation axis out of up and rotate each vertex by acos(alpha)

7- transform vertexPos by the model, view and proj mat


Ok now I think the method should be correct BUT, when rotating the camera around my object, it's fine as long as I'm within the positive Z. As soon as the cam pos is going into negative Z, the rotation angle seams like inverse or something.


What am I missing ? (I know for now it's only cylindrical billboard and regarding question 1 I'm doing billboard then TRS)


Any help would be much appreciated.


Mesh matrix transformation question

17 February 2015 - 07:36 AM



I have a mesh which is quika like a cylinder.

When I render it without its local transform, just with an identity matrix, its base is not in 0.0 but in 0.4 and it points toward the -Z.

Then, when I render it with its local transform, it points toward +y and its base is still at 0.4 (just above the origin).


Now, what I need to do is to stretch it in length but without touching those 0.4 from the origin.


I tried so many combinaison now I don't even know if it's possible.


I tried to use its inverse local matrix then scale it then multiply it by its local matrix to put it back etc...

But whatever I'm doing, it's also stretching those 0.4 from the origin so if I scale it 2 times, it puts it at 0.8 from the origin.


I understand I need to cast it in some space where its base would be at the origin, then do the scaling and put it back to where it should be but I can't figure out how to do it with the matrices.


Any help, idea would be much appreciated.

D3DFMT_R16F format and D3DXFLOAT16

18 October 2013 - 02:41 AM

I ashamed of myself for this post but I'd like to understand what's going on.


Here is the problem:

I'm creating a D3DFMT_R16F texture to store -1 to +1 values.

This is working fine and displaying the texture with DirectX texture tools shows what I'm expecting. Also when locking the data I have a pitch of 128 when in actual fact it is 64. First thing I cannot explain...


Then I'm trying to load again that texture from file using the directX9 func.

That's where I'm having troubles, I tried many solutions but none worked.

I tried reinterpret_cast<D3DXFLOAT16*>, I tried D3DXFloat16To32Array() and all sorts of things.

I then wrote a piece of code to load the file from myself, not using D3DXCreateTextureFromFile but a simple stream read, and guess what, using the reinterpret_cast worked fine...


So I'd like to undderstand what's going on with this file format ? If anyone has got some clues, welcome.

Just to let you know, I have no problem with any other format like L8, R32F, or whatever.

This should be the same as writing to the file anyway so I'm just missing something here.

Thanks for helping.

LOD algorythm for sphere made of a cube. Help needed.

12 September 2013 - 12:23 PM


I would really need some help here.

I have a sphere made from a cube so my first lod 0 is 6 patch of 33 verts. The usual stuff.

Now I'm trying to find an algorythm to increase the LOD given a point on the sphere. And this seams really not trivial.

I have tried a  couple of things already but even when looking at the same face of a cube at some points there is irregularities when splitting patches into 4 smaller ones.

The worst is when looking at another face of the cube, the references are changing and it's driving me crazy.


So here I am asking if anyone has seen anything about that particular problem or has faced it or any clue about it.


Thanks a lot for your comments.