VincentITA

Hello there, guys!

I've a little problem with Direct3D9.
I'm following a book written by Jim Adams, called "Advanced Animation with DirectX"
This book show you how to extend the classes D3DXMESHCONTAINER and D3DXFRAME, and using them to render meshes.

Now i'm trying a my example, that you can see here

http://phpfi.com/182098

But there are some problems:
At first, the mesh is not rendered, i've tryied so much position with camera but nothing i can't find it., but the Device->Clear works...
I'm also using a simple shader, here is it...

float4x4 matWorld;
float4x4 matView;
float4x4 matProj;
float4x4 matTotale;


texture TextMesh;
sampler2D STextMesh = sampler_state
{
texture = <TextMesh>;
MIPFILTER = linear;
MAGFILTER = linear;
MINFILTER = linear;
};


struct VSIn
{
float4 Position : POSITION0;
float2 TexCoord : TEXCOORD0;
float3 Normal : NORMAL0;
};

struct VSOut
{
float4 Position : POSITION0;
float2 TexCoord : TEXCOORD0;
float3 Normal : TEXCOORD1;
};

VSOut VsMesh(VSIn Input)
{
matTotale = matWorld * matView * matProj;
Input.Position = mul(Input.Position,matTotale);
return (VSOut)Input;
}

float4 PsMesh (float2 TexCoord : TEXCOORD0) : COLOR0
{
return tex2D(STextMesh,TexCoord);
}

technique SkinShader
{
pass Mesh
{
VertexShader = compile vs_2_0 VsMesh();
PixelShader = compile ps_2_0 PsMesh();
}
}

I've also selected D3D Debug Runtime with all option enabled and max level debug, but i've noted some things:

1)If i do

if (SUCCEED(Shader->SetValue("oiadjoaidsj",&something,sizeof(something);

where oaskdo is an invalid D3DXHANDLE, it continues the execution...

2) If i set the VertexDeclaration to NULL and use a shader, the output does not say me that there is not a vertex declaration and that D3D will use in atuomatic a default VertexDeclaration (Position + Texcoord + Normal)

3) If in a mesh formed by 10 materials, i do

if (SUCCEED(Mesh->DrawSubset(102938))

It does not gives me any error...

Another thing, when i create a D3DDevice it say me each time
"Unable to create index buffer driver", or something similar...
What does it means

And why he says me each time a redefinition of D3DPOINT

Why when i begin a shader each time i can see a ignore of redundand state how to avoid it

D3DINFO:: MemFini what does it means

Thank you and excuse me for bad english.
GoodBye!




Re: Game Technologies: Graphics Unable to render mesh

VincentITA

Noone can help me






Re: Game Technologies: Graphics Unable to render mesh

BLANC Guillaume

This is indeed a strange debug behaviour. If the D3DPOINT redefinition is at compile time, you can try to solve this issue using compiler precompile option (/P).

>> Why when i begin a shader each time i can see a ignore of redundand state how to avoid it

Dx debug detects redundant render state set. To avoid these messages, avoid setting redundant states to the device using your own state cache. Anyway, these messages are only warnings so unless you're using a pure device, concentrate on limiting state changes rather than eliminating them.

>> D3DINFO:: MemFini what does it means

This is dumped by Dx debug runtime if memory leak detection is selected from debug options. If any Dx memory leaks are the dumped.

>> i've tryied so much position with camera but nothing i can't find it

Try Pix for windows to see your mesh prior and post vertex shading so you won't have this "finding" problem and you'll be able to understand the issue.






Re: Game Technologies: Graphics Unable to render mesh

VincentITA

I've found the problem, it was in the shader.
I had to change this
matTotale = matWorld * matView * matProj

with this code

matTotale = mul(mul(matWorld,matView),matProj)

I thought so much yesterday and i found this solution.
But in this mode the matrix is computed for each vertex and this is bad, but it's very good to have 3 matrix separated...suggestions







Re: Game Technologies: Graphics Unable to render mesh

VincentITA

>>This is indeed a strange debug behaviour. If the D3DPOINT redefinition is at compile time, you can try to solve this issue using compiler precompile option (/P).

No, it's at execution time...

>>Dx debug detects redundant render state set. To avoid these messages, avoid setting redundant states to the device using your own state cache. Anyway, these messages are only warnings so unless you're using a pure device, concentrate on limiting state changes rather than eliminating them.

I never set the redundant state, and infact i never use function ->SetSamplerState, i use a ID3DXEFFECT object and i do beginpass(0) for start rendering...
It's an internal thing of shader...








Re: Game Technologies: Graphics Unable to render mesh

BLANC Guillaume

>>No, it's at execution time...

What's exactly the message

>> I never use function ->SetSamplerState, i use a ID3DXEFFECT object and i do beginpass(0)..

your HLSL code contains a sampler definition:

sampler2D STextMesh = sampler_state

{
texture = <TextMesh>;
MIPFILTER = linear;
MAGFILTER = linear;
MINFILTER = linear;
};

So ID3DXEFFECT API automaticaly calls SetSamplerState for you whenever it is used. This is because ID3DXEFFECT does not know the current state of the device like you know it. If you want to avoid it, you can remove sampler parameters from the effect file and call SetSamplerState() manually in your code.




Re: Game Technologies: Graphics Unable to render mesh

BLANC Guillaume

Indeed it's expensive. Keep 3 seperate matrices in your engine but concatenate it to one before sending it to the shader. If you still want to use the 3 matrices in the shader for something else, then upload all 4 matrices (3 + concatenated one). It will still be far cheaper than computing it per vertex.





Re: Game Technologies: Graphics Unable to render mesh

VincentITA

Then the shader are all converted into call of fixed pipeline...

interesting, i did not know this.
Thank you for all your information, you have helped me so much, also the idea of matrix...thank you!

I'll post soon the message.






Re: Game Technologies: Graphics Unable to render mesh

VincentITA

I get also this info
Direct3D9: (INFO) :Failed to create driver indexbuffer
I've got an ATI X1300...what sort of error is this ...i've read that is an error given for all the predx8 video cards, but the mine is not so old!!! Any suggestion

About the point, i'll check very soon near my pc and 'll paste.







Re: Game Technologies: Graphics Unable to render mesh

BLANC Guillaume

One of the parameter might be incorrect in the CreateIndexBuffer call. Isn't DirectX debug runtime dumping usefull information just before "Direct3D9: (INFO) :Failed to create driver indexbuffer". If not, you can experiment different parameters and check yours are well initialized.





Re: Game Technologies: Graphics Unable to render mesh

VincentITA

this is the point error



D3D9 Helper: Warning: Default value for D3DRS_POINTSIZE_MAX is 2.19902e+012f, not 1.44115e+017f. This is ok.

the index buffer is not impossible becouse the INFO is given when i create a device, without drawing nothing, i use D3DHAL and D3DHARDWWARE vertex processing...






Re: Game Technologies: Graphics Unable to render mesh

BLANC Guillaume

>> D3D9 Helper: Warning: Default value for D3DRS_POINTSIZE_MAX
I would not worry about that, it's probably a driver caps warning

>> Index buffer
I'm not sure I understood, are you able to create an index buffer Is that only a warning





Re: Game Technologies: Graphics Unable to render mesh

VincentITA

Yes i can draw becouse in this program i draw some meshes by an ID3DXMESH interface, given me by an x file (that has got ever an IndexBuffer)






Re: Game Technologies: Graphics Unable to render mesh

BLANC Guillaume

I've done some researches and it seams that your driver is reporting DirectX that it doesn't support index buffers natively in hardware. Anyway this is fine, because the D3D runtime handles it appropriatly. Your application will continue to function correctly (this is why it's only an INFO message, not a WARNING or ERROR). This error is usualy reported for pre-Dx8 hardware (or probably by a weird driver behavior). If your hardware is not that old, you could check for a  new driver release or for an answer from your hardware manufacturer.