hlsl - how do i reflect meshes of the same type to be opposite.

My issue is that I wish to know the correct method for reflecting a mesh against another of the same type using the shader.

Im sure this can be done, but I am a noob so that might explain why i cant find any resources that directly point out how to rotate a mesh in hlsl (though i am sure there is etc)

To give you the scenario..
Imagine I have a wing already loaded and flapping by vertex animation in the shader.
I have another copy of that mesh in the program and imitating the movement of the first wing mesh, as it is literally a copy of the first meshes hlsl code that animates the wing, jyst with the function specified for the second mesh etc.

I want the second mesh to appear opposite to the 1st mesh so i have a rudimentary pair of flapping wings, linear in the fashion regarding the flap element.

ATM, I have a mesh with two wings attahced, both on the same side, both flapping in unison. I am desperate to swap one wing to the opposite side of my mesh utilising those wings.

DirectX 10 is seperating me from the men!

I am pretty confident I goota do something around here

renderMesh(pd3dDevice, g_p_TechniqueWingLeft, &g_wing1);
//code here to render opposite side i think
// I think it needs a rotation and a possible D3DXToRadians thingy
//currently the pointy wing to differentiate (note: reset this back in shader later)
renderMesh(pd3dDevice, g_p_TechniqueWingRight, &g_wing2);

Below is the code section manipulating the mesh , this is in my mind the ideal place to do the rotation so it is done here rather than relying on D3DMatrixRotationY or something like that.

Re: hlsl - how do i reflect meshes of the same type to be opposite.

Posted 23 January 2013 - 02:54 AM

Hey ButchDean, thanks for such a quick reply , as is becoming the usual with your good self and my questions of noob stupidity.
That sounds like an idea but,I already have two meshes in there but both flapping(as are basically two of the same objects) and positioned on the same side.

I was thinking that I may need to translate the Y position by 180 degrees/radians, but am unsure ,if even correct method, how to implement this successfully.

I was trying to imlement this.....

D3DXMatrixTranslate(object1, object2, D3DXToRadian(180));

prior to the render call for the second wing.
However, to no avail......

Re: hlsl - how do i reflect meshes of the same type to be opposite.

Pretty much what I said before will work, give it a go to avoid duplication of the object and over complicated math.

Hey ButchDean, thanks bud for quick reply again.
ng
I know this may be asking alot, but could you by any chance throw some psuedocode at me or possibly help me out by pointing to where i have to implement your suggestion.

I am keen on what you said but am still green behind the ears enough to on keep getting myself muddled up with it.

effectively am i?......
declaring and implementing them odel in my cpp program then also making a copy/instance of it there(how, as at mo i am loading two seperate sdkmeshes of the same wing?).
(i am using the simple sample , so you can imagine its a messy scribble)

Then...

animating the wing in the shader (got this done and working fine so far)

So , you see, my problem is mainly being unsure how to implement those wise words from you, ButchDean, above.

Please dont think I havent searched for this on the Google, I have. My only outcome was that I was either asking the wrong sort of question related to topic or there is little by way of explanation or tutorial for stupid people (RE: me)

A Wish:(hoping the above statement might return some links to google pages that are abundant with the riches I could not find, that we often see on here when someone states they "cant find it on Google")

Thanks again ButchDean, and anyone else who reads this
Gruffy - forever wanting the secret knowledge

Re: hlsl - how do i reflect meshes of the same type to be opposite.

Posted 23 January 2013 - 08:28 PM

In this code:

renderMesh(pd3dDevice, g_p_TechniqueWingLeft, &g_wing1);
//code here to render opposite side i think
// I think it needs a rotation and a possible D3DXToRadians thingy
//currently the pointy wing to differentiate (note: reset this back in shader later)
renderMesh(pd3dDevice, g_p_TechniqueWingRight, &g_wing2);

you have g_p_TechniqueWingRight, &g_wing2 in your second call to renderMesh(). My point is you don't need them. What you need to do is between the two calls have some kind of math that mirror-images the behavior of g_p_TechniqueWingLeft, &g_wing1 rather than use the new objects. How you exactly accomplish this I wouldn't know off hand because I need to be familiar with the composition of the objects and the valid operations you can perform on them.

Re: hlsl - how do i reflect meshes of the same type to be opposite.

Posted 24 January 2013 - 10:45 AM

AMazeballs ButchDean!

I shall try to get that implemented then , and it does make complete sense over my current approach.

Cheers bud.
U You really are a massive help on here and I hope others appreciate you as much I do.
If not, I have a small room in my house that you could occupy full time and feed me with programming knowledge as and when required.

I only hope I reach a level where I can make that kind of difference to others too, one day.
Gruffy