Hi, I recently upgraded from Urho3D 1.5 to Urho3D 1.7.1, and ran into a bug that I can’t seem to resolve that wasn’t a problem in 1.5. I found that when I have multiple instances of a model that use the same material, the objects all disappear. This is building on Windows, Direct3d9 (I got linker errors I couldn’t resolve when I tried Direct3D11).
I modified the StaticScene example to just create two boxes as shown below, and assign the same material to both. When I run the example, the boxes are not visible. If I change the second box to use material2, then I see the two boxes. I also found that you can use the same material on different models, and it seems to work as expected, so it appears there is an issue when using the same Material and same Model together on multiple objects. Any ideas?
Node* boxNode1 = scene_->CreateChild(“Box”);
boxNode1->SetPosition(Vector3(-4.0f, 0.0f, 15.0f));
boxNode1->SetScale(5.0f);
Model* box = cache->GetResource(“Models/Box.mdl”);
Material* material1 = cache->GetResource(“Materials/Mushroom.xml”);
Material* material2 = cache->GetResource(“Materials/Terrain.xml”);
StaticModel* boxObject1 = boxNode1->CreateComponent();
boxObject1->SetModel(box);
boxObject1->SetMaterial(material1);
//Create a second node, using the same model and material
Node* boxNode2 = scene_->CreateChild(“Box”);
boxNode2->SetPosition(Vector3(4.0f, 0.0f, 15.0f));
boxNode2->SetScale(5.0f);
StaticModel* boxObject2 = boxNode2->CreateComponent();
boxObject2->SetModel(box);
boxObject2->SetMaterial(material1);