Home Indie Game Drawmesh in unity that ought to however did not work…

Drawmesh in unity that ought to however did not work…

0
Drawmesh in unity that ought to however did not work…

[ad_1]

Hello!

So i’ve been making a little bit experiment which have me butt head with unity’s working, abd I do not know what is going on on, so to analyze I began one other experiment that is not working as supposed, that isn’t in any respect, and I’m at loss to know why.

– I rendered UV unwrap uncooked mesh information utilizing a particular shader, and Graphics.DrawMesh() to a render texture, however upon inspection the info is flawed (world regular and place).
– It appears to make sense since I’m bypassing the gameobject assemble of unity, subsequently I’ve defective matrix. Therefore I attempted passing my very own matrix. But the worldnormal information do not appear to match, and doing the inverse of the transpose of my very own matrix do not appears to do the trick (the usual stuff to remodel regular) …
– To examine additional, as I think that rawmesh is the imported information earlier than unity apply import settings, I create a little bit program that I connected to the gameobject to check its render to varied DrawMesh() command … BUT drawmesh do not work as supposed …

utilizing System.Collections;
utilizing System.Collections.Generic;
utilizing UnityEngine;

public class MeshVsObjectNormalTest : MonoBehaviour
{
//public GameObject normalObject;
Mesh[] uncookedMesh;
Matrix4x4 objectMatrix;
Camera cam;
Material mat;

    // Start known as earlier than the primary body replace
    void Start()
{
        uncookedMesh = new Mesh[1];
uncookedMesh[0] = this.GetComponent<MeshFilter>().mesh;
objectMatrix = Matrix4x4.id;
cam = Camera.foremost;
mat = this.GetComponent<Renderer>().materials;

    }

    // Update known as as soon as per body
    //void Update()
void LateUpdate()
    //void OnPostRender()
    {
    //Graphics.DrawMesh(uncookedMesh[0], objectMatrix, mat,0, cam);
    //Graphics.DrawMesh(uncookedMesh[0], Vector3.zero, Quaternion.id, mat,0, cam);
    Graphics.DrawMesh(uncookedMesh[0], Vector3.zero, Quaternion.id, mat,0);
   
    //mat.SetPass(0);
    //Graphics.DrawMeshNow(uncookedMesh[0], objectMatrix);
   
    Debug.Log(cam);
    }
   
}

Is there one thing I’m lacking?  WTF

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here