Skip to content

[rmodels] OBJ models with multiple materials/meshes not loading correctly #3576

Closed
@njegg

Description

@njegg
  • I tested it on latest raylib version from master branch
  • I checked there is no similar issue already reported
  • I checked the documentation on the wiki
  • My code has no errors or misuse of raylib

Issue description

I have a model made in blender with multiple meshes and materials that load correctly in raylib 4.5, but after updating to 5.0 everything is in one material. I have provided a minimal example with a simple 2 mesh/material model.

Environment

Tried on multiple machines and operating systems

Issue Screenshot

4.5
4.5
master/5.0
master

Code Example

model.zip

#include "src/raylib.h"

int main(void)
{
    const int screenWidth = 800;
    const int screenHeight = 450;

    InitWindow(screenWidth, screenHeight, "model loading");

    Camera camera = { 0 };
    camera.position = (Vector3){ 2.0f, 2.0f, 2.0f };
    camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
    camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
    camera.fovy = 45.0f;
    camera.projection = CAMERA_PERSPECTIVE;

    Model model = LoadModel("tomato.obj");

    Vector3 position = {0};

    DisableCursor();

    SetTargetFPS(60);

    while (!WindowShouldClose())
    {
        UpdateCamera(&camera, CAMERA_FIRST_PERSON);

        BeginDrawing();

            ClearBackground(RAYWHITE);

            BeginMode3D(camera);

                DrawModel(model, (Vector3) {0}, 1.0f, WHITE);
                DrawGrid(20, 10.0f);

            EndMode3D();

        EndDrawing();
    }

    UnloadModel(model);
    CloseWindow();

    return 0;
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions