Open rossoe opened 5 years ago
Hi @rossoe, Miro here, I had a look at your file and it seems that it's mainly happening because of the fact those planes and grids have dimension Z = 0. I did a dirty trick and added a single vertex to each grid LOD's mesh and shifted it 2 meters above grid mesh, this way it becomes "volume"(dimensionZ=2) and LODing starts working.
I think the issue is caused by iron.MeshObject.computeScreenSize()
: https://github.com/armory3d/iron/blob/dd61dd852ac9995e1fba9e48c8110f906e6abca7/Sources/iron/object/MeshObject.hx#L342
public inline function computeScreenSize(camera: CameraObject) {
// Approx..
// var rp = camera.renderPath;
// var screenVolume = rp.currentW * rp.currentH;
var tr = transform;
var volume = tr.dim.x * tr.dim.y * tr.dim.z;
screenSize = volume * (1.0 / cameraDistance);
screenSize = screenSize > 1.0 ? 1.0 : screenSize;
}
If at least one dimension equals 0, the volume is 0, thus the objects screenSize is 0 too. This is used at https://github.com/armory3d/iron/blob/master/Sources/iron/object/MeshObject.hx#L244.
Is there any advantage of using the screenSize for LOD over the distance of the object? It is more accurate if the "origin" of the visible mesh is not at the origin position of the object, but that could probably be achieved by calculating the center of the visible mesh and using that for distance calculation?
SHORT DESCRIPTION:
Having opened the example - LOD blend file I created both a Plane and a Grid But running Krom (Armory Player) I cannot seem to get materials against the various LOD's to cycle through their different states - as set up in properties.
EXPECTED RESULT:
As you move the camera away from Grid or Plane, the LOD & associated materials will cycle through whatever I've set against the object.
ACTUAL RESULT:
Objects like Monkey, Cube and Sphere work fine and switch through the various LOD’s & different materials applied as you move away. However the Plane and Grid does not change it’s material (colour)? It appears to only show in Krom the material from the last LOD for any given plane or grid?
STEPS TO REPRODUCE:
Steps:
TECHNICAL SPECIFICATIONS:
What version(s) of the following did you try: Blender: 2.8beta Armory: 0.7.0 (recent git) Operating system: Win 10 Graphics card & driver: GTX960 latest Nvidia
TEST FILE TO REPRODUCE:
https://1drv.ms/u/s!AjCedBZJ5Eh4jBAwxl0N1G9Cuvd-