Giter VIP home page Giter VIP logo

mikumikuflex's People

Contributors

dtxmania avatar kyasbal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mikumikuflex's Issues

Source in english

I translated the whole project into English. All file names and all methods and members. The compilation is identical to the original project, but everything is in English. Are you interested in workable sources entirely in English?
It’s hard for me to work with sources in Japanese.

いくつかは間違ったモデルのポーズを助けます。プロジェクトがフォワードキネマティクスの間違った計算を使用しているため。 (Some help with wrong model pose. Because project using wrong calculation of forward kinematics.)

///JAPAN
このコードにエラーがあります。

            #region " 親付与によるFKを適用する。"
            //----------------
            this._親付与によるFK変形更新.変形を更新する();
            this._モデルポーズを再計算する();
            //----------------
            #endregion

このコードにはコメントが必要です

            #region " 親付与によるFKを適用する。"
            //----------------
            //this._親付与によるFK変形更新.変形を更新する();
            //this._モデルポーズを再計算する();
            //----------------
            #endregion

そして、いくつかの変更を行う必要があります
拡張:

FKはIKの前とIKの間に呼び出す必要があります。

1)クラス「ボーンコントロール」では、「親ボーンの子を許可」のリストが必要であり、このリストは「子ボーンのリスト」と同じように入力されますが、「親ボーン」の代わりに「親ボーンを許可」を受け取ります(フォワードキネマティクスで使用されます) )
2)クラス "ボーンコントロール"に "親の付与されたボーン"、 "付与された位置"、および "付与された回転"変数を追加する必要があります(クラスコンストラクタではそれらをゼロにしますが、 "親の付与されたボーン"は計算子ボーンループで埋める必要があります)
3)手順「モデルポーズの計算」では、
3.1)「許可された回転」と「許可された位置」を、「親許可された骨」から「この骨」への順**学を介して計算します(「許可された親骨」がnullでない場合のみ)。
3.2)位置+回転(アニメーション、インバースキネマティクス、物理)に加えて、「許可された位置」+「許可された回転」(位置+許可された位置の回転*許可された回転)によって骨の新しいローカル位置を計算します。
3.3)親ボーンからグローバルポジションを計算します。
3.4)すべての子ボーンをループして計算します。
3.5)すべての影響を受けるボーンをループして計算します(リスト「親のボーンの子を許可する」を使用)。
4)ドロープロシージャのフォワードキネマティクスを削除する必要があります。
5)ボーンの新しい位置と新しい回転を取得した後の物理演算では、位置から「許可された位置」(ボーン位置=ボーン位置-ボーン「許可された位置」)と回転から「許可された回転」(ボーン回転=ボーン回転)を削除する必要があります。 *反転したボーンの「許可された回転」)。

それで全部です。

///ENGLISH
In this code error:

            #region " 親付与によるFKを適用する。"
            //----------------
            this._親付与によるFK変形更新.変形を更新する();
            this._モデルポーズを再計算する();
            //----------------
            #endregion

This code must be commented

            #region " 親付与によるFKを適用する。"
            //----------------
            //this._親付与によるFK変形更新.変形を更新する();
            //this._モデルポーズを再計算する();
            //----------------
            #endregion

And some changes need to be done

Explanation:

FK must call before IK and during IK.

  1. in class "bone control" need list of "grant parent bone childs" and this list filled same way as "list of child bones", but instead of "parent bone" take "grant parent bone" (that used in forward kinematics)
  2. in class "bone control" need to be add "parent granted bone", "granted position" and "granted rotation" variables (in class contstructor zero them, but "parent granted bone" need to be filled in compute child bone loop)
  3. in procedure "calculate model pose" we must
    3.1) calculate "granted rotation" and "granted position" via forward kinematics from "parent granted bone" to "this bone" (only if "granted parent bone" is not null);
    3.2) calculate new local position of bone via position+rotation (animation, inverse kinematics, physics) plus "granted position" + "granted rotation" (position + granted position rotation * granted rotation);
    3.3) calculate global position from parent bone;
    3.4) loop and calculate all child bones;
    3.5) loop and calculate all influented bones (via list "grant parent bone child");
  4. Forward kinematics in Draw procedure need to be removed;
  5. In Physics calculation after get new position and new rotation of bones we need to remove "granted position" from position (bone position = bone position - bone "granted position") and "granted rotation" from rotation (bone rotation = bone rotation * inverted bone "granted rotation").

Thats all.

Some help for this project

I think this code helps your to improve this project.
All variables and file names are translated to English for simplicity, and you can translate it back to japan.
This code is for last region of procedude Draw (public void 描画する) of the file PMX_model.cs (PMXモデル.cs)):

                #region " Set D3D pipeline (material unit)."
                //----------------
                //++ change block 1
                //old code
                //d3ddc.Rasterizer.State = this._rasterizerStateForBacksideSingleSidedDrawing;
                //new code
                //check if edge needed
                if (material.drawingFlag.HasFlag(PMXFormat.Drawing_flag.edge)){
                    d3ddc.Rasterizer.State = this._rasterizerStateForBacksideSingleSidedDrawing;
                }
                //-- change block 1
                //----------------
                #endregion
                //++ change block 2
                //old code
                /*materialDrawingShader.Draw(
                    d3ddc,
                    material.numberOfVertices,
                    material.startingIndex,
                    MMDPass.Edge,
                    globalParameters,
                    this._globalParametersConstantBuffer,
                    textureSRV,
                    sphereMapTextureSRV,
                    toonTextureSRV);*/
                //new code
                //check if edge needed
                if (material.drawingFlag.HasFlag(PMXFormat.Drawing_flag.edge)){
                    materialDrawingShader.Draw(
                        d3ddc,
                        material.numberOfVertices,
                        material.startingIndex,
                        MMDPass.Edge,
                        globalParameters,
                        this._globalParametersConstantBuffer,
                        textureSRV,
                        sphereMapTextureSRV,
                        toonTextureSRV);
                }
                //-- change block 2

Short explain: if edge flag is not setted, we MUST zero edgeColor and edgeSize, and we MUST not to call edge draw pass. Because some textures will flick (hair and clothes) with not needed edge pass.
That's all. Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.