I am making a game targeted towards mobile, so I am experimenting around to know how I can boost performance.

Now I have a rectangle with a road texture on it. This I made in Blender. And as expected it has 2 tris.

I made a c# script to add these rectangles together to make a long road. So if I make a road 100 unit long, I have 100 such rectangles, and I expect that their total tris count becomes 200.

enter image description here

Now while running the game, Stats panel shows 8.2k tris for entire scene. And when I disable this 100 unit long road, Stats shows 7.8k tris. So why are there 400 tris for 100 rects?

For each rectangle object, I have already turned off the "cast shadows" property.

Link to blend file https://drive.google.com/file/d/0BztX2HefTk_wb1VuSUlONXVxaE0/view?usp=sharing

Link to texture file https://drive.google.com/file/d/0BztX2HefTk_wc3JvdTBJZmphRUU/view?usp=sharing

EDIT (adding code for builder script)

void createRoad() {
    Vector3 rotation = new Vector3(270, 0, 0);

    float z_size; // Value assigned in CreateWizard()
    Object road_item; // Assigned in CreateWizard()

    for (int i = 0; i < count; i++) {
        GameObject roadPiece = (GameObject)Instantiate (road_item);
        roadPiece.transform.parent = ((GameObject)Selection.objects[0]).transform;
        roadPiece.transform.localPosition = new Vector3 (0, 0, i * z_size);

        roadPiece.transform.localEulerAngles = rotation;
        roadPiece.name = BASE_NAME + (i+1);

        //Turn Off cast-shadows
        roadPiece.GetComponent<MeshRenderer>().shadowCastingMode = 
  • \$\begingroup\$ It sounds like it is rendering twice, maybe once for a depth only pre-pass? That's a common technique to help overdraw problems. It might also be rendering once per light, if you have it lit by two lights. \$\endgroup\$ – Alan Wolfe Jul 18 '15 at 18:45
  • \$\begingroup\$ @AlanWolfe: I have a single light only. \$\endgroup\$ – Vinayak Garg Jul 18 '15 at 18:58
  • \$\begingroup\$ What format is your blender data? I'd look carefully at the model to make sure it really is exactly 2 triangles in your object. \$\endgroup\$ – david van brink Jul 18 '15 at 21:07
  • \$\begingroup\$ What's to the left of your road? The white patch? How did you make your skybox? What about the grey patch on the far left, between the white section and the skybox (or is it just part of the skybox gradient)? \$\endgroup\$ – Clockwork-Muse Jul 19 '15 at 0:10
  • 2
    \$\begingroup\$ Is it set up to render both sides of the triangles? Ie is backface culling off? If so some engines implement that by drawing things twice. Once for the inside, once for the outside. \$\endgroup\$ – Alan Wolfe Jul 19 '15 at 0:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.