HLSL into c++ code

Started by
3 comments, last by Adam_42 10 years, 1 month ago

Hi,

im trying to understand some hlsl code so i can convert it to just c++

just to give you some background i am trying to implement mesh-less deformation based on shape matching,

as reference i use

http://www.beosil.com/download/MeshlessDeformations_SIG05.pdf

the sample code is from NVIDIA's example of this implementation.

the underlined parts are the ones that i do not understand,

jmat[0] - is that accessing the row? or just a specific index?

and when they initialize xmfloat3x3 optimumR = ..., in my example i filled in the last indexes with zeros, the constructor requires it.

but they have not initialized those indexes to anything, are they initialized to 0 by default , or is that part of this "matrix" is irrelevant?

my code is on the right, its how much i got so far, i think the Jacobi function part should be ok, having problems with over function.

please give me tips and correct me where i am wrong,

Thank You!

Advertisement

Oh you should post the code in editable form so that copy paste would be easier.

However, it seems that you are mixing vector / scalar operations. Such as Optimum[R] refers to the first column or row of the float3x3 matrix. Not just the first element.

Same goes for jmat[0]. It isn't a scalar, but a vector. So you cannot replace jmat[0] / sqrt(...) with jmat._11 / sqrt(...).

Cheers!

Thanks, i need more help.

why somewhere they use mul() to multiply and in other cases they use * ?.

(Just to make sure.....) with jmat[0] / sqrt(mat(0,0))), does that mean that each element of that vector ._11 _12 _13 will be divided by the number sqrt(mat(0,0))), or does division here works differently.

Thanks Again.




(Just to make sure.....) with jmat[0] / sqrt(mat(0,0))), does that mean that each element of that vector ._11 _12 _13 will be divided by the number sqrt(mat(0,0))), or does division here works differently.

True.


why somewhere they use mul() to multiply and in other cases they use * ?.

mul() is a matrix multiply.

The * operator is a per-component multiply.

This topic is closed to new replies.

Advertisement