in here CreateVertexBuffer()
these here
v[0] = VertexPNT(-0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f);
v[1] = VertexPNT(-0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
v[2] = VertexPNT( 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
v[3] = VertexPNT( 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f);
For each vertex, we need to specify the translation offset that positions the billboard the vertex is part of in world space, so that we can compute the rotation part and the translation part of the world transformation.
With this set up, we can render all the billboards in one draw primitive call, and the correct billboard world matrix is generated in the vertex shader for each vertex.
Billboarding trees are not visible
I still don't understand what it is I am supposed to do. It appears you are quoting from the same book I am reading, and therefore I am not seeing anything new about the matter.
Won't somebody help me? Note, I cannot emphasize this enough. I am not asking you to do my homework. I am simply studying this book on my own free time for fun.
Also note, all of the source code fragments that I have posted under my username are from the book "Introduction to 3D Game Programming With DirectX 9.0c A Shader Approach" by Frank D. Luna. I do not claim to have written any of it. I have merely made minor tweaks that are a part of the book's exercises. Again, I do not claim to have written ANY of the source code that I have previsouly posted under my username. All of the credit goes to the author Frank D. Luna.
Its funny I have the book as well but when I fire up my old pc with that code on it its not the same as yours in part it is but the vertex you have its for some reason is not the same as mine and its been a long time ago for that sample for me, I think I changed it to suite my mingy code back then. you really need to get pix running. its not that hard I remember when I first used pix(I still dont understand how you do bottle neck checks in it but)but .
What you need do is to compile and build the exe .
You will then need to copy your exe to where your program files are for this project,
Then start pix
click on file tab->new experiment.
On the experiment panel Program path select your exe.
Then under what infomation do you want to gather ??? select A single-frame capture on F12 key press
then press the start button.
The exe will load up and you should see your code in action. move your camera to where you think your trees are then press F12 key this takes a shot of the whole dx code thing and when you close the app it will display a list of things.But what you may be intrested in is the panel at the bottom left.
See Fame + sign click it that displays your devices state at the time you pressed F12. find your draw call by the looks of your code you have a few(if you using dxfont class that to has lots of draw calls dont confuse them with your draw calls). Then when you click on the draw call to the right there is a details area the render tab is your screen you should see stuff in there. the Mesh tab is how you find your trees look for the vertex that matches your trees, try it. it will all be revealed.
What you need do is to compile and build the exe .
You will then need to copy your exe to where your program files are for this project,
Then start pix
click on file tab->new experiment.
On the experiment panel Program path select your exe.
Then under what infomation do you want to gather ??? select A single-frame capture on F12 key press
then press the start button.
The exe will load up and you should see your code in action. move your camera to where you think your trees are then press F12 key this takes a shot of the whole dx code thing and when you close the app it will display a list of things.But what you may be intrested in is the panel at the bottom left.
See Fame + sign click it that displays your devices state at the time you pressed F12. find your draw call by the looks of your code you have a few(if you using dxfont class that to has lots of draw calls dont confuse them with your draw calls). Then when you click on the draw call to the right there is a details area the render tab is your screen you should see stuff in there. the Mesh tab is how you find your trees look for the vertex that matches your trees, try it. it will all be revealed.
I'm still confused as to what might be wrong.
Here is PreVS:
[attachment=10033:pix1.PNG]
Hers is PostVS:
[attachment=10034:pix2.PNG]
My only guess is here...
Basically I'm placing the billboard translation offset into the "normal" member of VertexPNT, and feeding it into the bboffset parameter of AABillBoardVS. Maybe that's the problem.
Here is PreVS:
[attachment=10033:pix1.PNG]
Hers is PostVS:
[attachment=10034:pix2.PNG]
My only guess is here...
struct VertexPNT
{
VertexPNT()
:pos(0.0f, 0.0f, 0.0f),
normal(0.0f, 0.0f, 0.0f),
tex0(0.0f, 0.0f){}
VertexPNT(float x, float y, float z,
float nx, float ny, float nz,
float u, float v):pos(x,y,z), normal(nx,ny,nz), tex0(u,v){}
VertexPNT(const D3DXVECTOR3& v, const D3DXVECTOR3& n, const D3DXVECTOR2& uv)
:pos(v),normal(n), tex0(uv){}
D3DXVECTOR3 pos;
D3DXVECTOR3 normal;
D3DXVECTOR2 tex0;
static IDirect3DVertexDeclaration9* Decl;
};
Basically I'm placing the billboard translation offset into the "normal" member of VertexPNT, and feeding it into the bboffset parameter of AABillBoardVS. Maybe that's the problem.
How will making the offsets larger help? Besides, I tried making the first tree offset (10, 0, 10) and I still couldn't see it.
Do the trees actually render when you disable billboarding?
only:
outVS.posH = mul(float4(posL, 1.0f), gWVP);
outVS.tex0 = tex0;
only:
outVS.posH = mul(float4(posL, 1.0f), gWVP);
outVS.tex0 = tex0;
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement