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!


BlackJoker

Member Since 28 Feb 2013
Offline Last Active Mar 27 2015 04:10 AM

Posts I've Made

In Topic: Correct way of using multipass effects in Effects framework

04 March 2015 - 02:54 PM

Interesting.... Could you please explain me a little about that. I just tested with depth disabled and second path applied to sprites, but for now I dont really understand why?

Does shader takes depth into account?


In Topic: Correct way of using multipass effects in Effects framework

04 March 2015 - 09:42 AM

I do like this now:

spriteBatchEffect.GetVariableByName("TextureSampler").AsSampler().SetSampler(0, textureSampler);
         spriteBatchEffect.GetVariableByName("Texture").AsShaderResource().SetResource(texture);
         spriteBatchEffect.GetVariableByName("OrthoMatrix").AsMatrix().SetMatrix(Ortho);

         int passesCount = spriteBatchEffect.GetTechniqueByName("SpriteBatch").Description.PassCount;
         var technique = spriteBatchEffect.GetTechniqueByName("SpriteBatch");
         EffectPass localpass;
         for (int i = 0; i < passesCount; i++)
         {
            localpass = technique.GetPassByIndex(i);
            if (localpass.IsValid)
            {
               localpass.Apply(graphicsDevice);
               graphicsDevice.DrawIndexed(indexCount, 0, 0);
            }
         
         }
         
      }

and add vertex shader to 2nd pass

pass P1
   {
      SetGeometryShader(0);
      SetVertexShader(CompileShader(vs_4_0, SpriteVertexShader()));
      SetPixelShader(CompileShader(ps_4_0, SpritePixelShader2()));
   }

But now I just dont see sprites. No errors, but also no image, but passes are valid.

 

Update:

I missed setting vertex buffer and now It rendering, but still only one path. I dont know why, but it ignores the second one.


In Topic: Collada controller data sorting

26 February 2015 - 12:22 AM

Hm, so, you think that I dont need to sort joint-weights, but just match bone names and thta should do the trick?

 

In my case I already did that, but I am asking should I sort bones like they situated in skeleton (because in my case sid and bone names are the same)

 

for ex in skeleton i have bone1 bone 2 bone3 and in controller bone3 bone1 bone2.

Need I sort bones to make them be as bone1 bone 2 bone3?

 

I want to sort bones because I want to optimize animation algorithm and simplify it a little. If I have sorted bones, I could just multiply current animation matrix * parent.

If I have not sorted bones, I need to multiply them in hierarachy till the first level each time.

 

Do you understand what I mean?


In Topic: Collada controller data sorting

25 February 2015 - 11:58 PM

What do you mean? Could you explain more detail?


In Topic: Bone animation implementation problem

21 February 2015 - 03:33 PM

OK, digging around I found an issue:

1. I import collada to DirectX, so all matrices should be transposed.

2. I use Yup axis and Blender has Zup axis, so I have to change axis with special matrix 

 

M11 - 1

M23 - 1

M32 - 1

M44 - 1

 

multiply each joint matrix once like this - newjointMatrix = axisChangeMatrix * jointMatrix * axisChangeMatrix

 

You need to do this once during load.

 

Then I should just multiply offset * keyframeMatrix. Or If I have hierarchy - keyframe*keyFrame.Parent *..... Parent and so on.

 

Then - send final matrices array to shader.

Thats all.

 

Now animation works correct.


PARTNERS