Skip to content

Geometry template in Ninja cannot correctly apply or display transformationMatrix, material, and texture #89

@SavageChigga

Description

@SavageChigga

🧩 Geometry template in Ninja cannot correctly apply or display transformationMatrix, material, and texture

📘 Background

In geographic scene modeling, objects such as trees are often represented using geometry templates to save space and resources.
According to the CityJSON 2.0.1 specification, a template object can include a material member.

Image

Figure 1. Example from CityJSON specification showing template support for the material member.


🧪 Test Setup and Validation

1. Base Model Validation

  • A single tree model with branch and trunk was created using a CityObject.
  • Both material and texture were displayed correctly in Ninja.
  • The model passed cjval validation (The file is valid).
Image

Figure 2. cjval validation result of the base tree object.

2. Geometry Template Test

  • The same tree was restructured using a geometry template for reuse.
  • The model was visualized correctly, but its transformationMatrix, material, and texture were not applied correctly.
  • The data file also passed cjval validation (The file is 100% valid!).
Image

Figure 3. cjval validation result of the template-based file.


📁 Test Data Description

✅ TreeDemo.city.json

  • A single tree model represented as a SolitaryVegetationObject.
  • Serves as the baseline for verifying correct rendering of material and texture.
  • Validated successfully using cjval.
  • Data file: TreeDemo.city.json
Image

Figure 4. Default tree model.

Image

Figure 5. Tree model with different materials.

Image

Figure 6. Tree model with applied textures.


🧩 IssueDemo.city.json

  • Contains two cube objects (using CityObjects) and two tree objects (using geometry templates).
  • Both tree models share the same geometry template but reference different transformation indices.
  • Each tree consists of a trunk and a branch component.
  • Data file: IssueDemo.city.json
Image

Figure 7. Comparison between cube (CityObject) and tree (geometry template) models.

both files use the same Texture resources:

  1. wood.jpg
  2. brick.jpg
  3. Trunk_MAT.jpeg
  4. Branch_MAT.png

⚠️ Problem Description

1. transformationMatrix not applied correctly

  • In Ninja, geometry templates only display correctly with the default matrix.
  • Any modification (translation, rotation, scaling) causes the object to disappear.
  • Example: scaling or offsetting the trunk of the second tree makes it invisible.
"transformationMatrix": [
    10.0, 0.0, 0.0, 0.0,
    0.0, 10.0, 0.0, 0.0,
    0.0, 0.0, 10.0, 0.0,
    0.0, 0.0, 0.0, 1.0
]
Image

Figure 8. Object disappears when a non-default transformationMatrix is applied.


2. material not displayed correctly

  • Cube objects display different materials correctly.
  • Tree objects (using geometry templates) disappear when material is assigned.
Image

Figure 9. Cube rendered correctly, tree model disappears when material applied.


3. texture not displayed correctly

  • Cube objects display textures correctly.
  • Tree objects (geometry templates) show no visible texture changes.
Image

Figure 10. Cube shows texture properly, tree model unaffected.


💡 Summary

Geometry template objects in Ninja cannot correctly apply or display:

  • transformationMatrix
  • material
  • texture

All tested files are 100% valid according to cjval.


❓Questions

  1. What might cause Ninja to fail applying these attributes (transformationMatrix, material, texture) to geometry template objects?
  2. Is there a known fix, configuration, or workaround to correctly render geometry templates with these properties?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions