GithubHelp home page GithubHelp logo

Comments (2)

quentincaffeino avatar quentincaffeino commented on May 13, 2024

First: your initialization of RMC must be like this
mesh = CreateDefaultSubobject<URuntimeMeshComponent>(TEXT("GeneratedMesh"));
instead of what you have:
mesh = CreateDefaultSubobject(TEXT("GeneratedMesh"));

Let's have a look on basics of mesh generation:
Lets say you want to create a square. Then you need four vertices with coordinates: V0 (0, 0, 0); V1 (50, 0, 0); V2 (0, 50, 0); V3 (50, 50, 0)
untitledasd

TArray<FVector> vertices;

vertices.Add(FVector( 0,  0, 0));
vertices.Add(FVector(50,  0, 0));
vertices.Add(FVector( 0, 50, 0));
vertices.Add(FVector(50, 50, 0));

Now we need to create faces, one face requires three vertices to form a triangle. Using our square of four vertices we need to create two faces by connecting vertices in this order:

  1. First triangle: V0 -> V2 -> V1
  2. Second triangle: V2 -> V3 -> V1

untitledasd2

TArray<int32> triangles;
triangles.Add(0);
triangles.Add(2);
triangles.Add(1);

triangles.Add(2);
triangles.Add(3);
triangles.Add(1);

Then we need UVs. Creating them are pretty easy. You have to calculate UV<0, 1> position for each vertex. If you want to scale texture - just multiply your UV coordinate by scale. This how it would look on our square:
untitledasd3

TArray<FVector2D> UVs;
UVs.Add(FVector2D(0, 0));
UVs.Add(FVector2D(1, 0));
UVs.Add(FVector2D(0, 1));
UVs.Add(FVector2D(1, 1));

And finally we'll create normals and tangents. I prefer generating them using KismetProceduralMeshLibrary function: LINK.

Also have a look at RuntimeMeshComponent wiki

I hope I helped you. Sorry for my English.

from realtimemeshcomponent.

Koderz avatar Koderz commented on May 13, 2024

I've not seen any problem like this in any of my tests. It appears to me that the vertex winding order got reversed on your first example and so backface cull kicked in and kept it from rendering.

I'm gonna go ahead and close this as I haven't heard anything else from you in a while. If you still see this or any other issue feel free to reopen or post a new issue!

Thanks!

from realtimemeshcomponent.

Related Issues (20)

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.