Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nanna release api #1062

Merged
merged 40 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
452f564
Api change holes
AlvaroHG Jul 27, 2022
d644670
PR changes
AlvaroHG Jul 27, 2022
16e99ce
Merge
AlvaroHG Aug 18, 2022
903c846
Deprecation of hole boundingbox for polygon
AlvaroHG Aug 19, 2022
7521fd8
Merge branch 'nanna' of github.com:allenai/ai2thor into nanna-release…
AlvaroHG Aug 19, 2022
65e8ec5
Template change
AlvaroHG Aug 19, 2022
fe334ee
Merge branch 'nanna' into nanna-release-api
AlvaroHG Aug 22, 2022
65d76f9
Fixes serialization
AlvaroHG Aug 22, 2022
4fc5795
Depth save
AlvaroHG Aug 22, 2022
bc6700a
Fixes material json
AlvaroHG Aug 24, 2022
3e710b2
Fixes
AlvaroHG Aug 25, 2022
8147c5d
naive scale support
mattdeitke Aug 26, 2022
2b688db
add scale around
mattdeitke Aug 26, 2022
327f2f3
Merge branch 'nanna' into nanna-release-api
AlvaroHG Aug 30, 2022
670aa6d
Image replacement because rendering change
AlvaroHG Aug 30, 2022
d1204e4
Merge branch 'nanna-release-api' into naive-scale
mattdeitke Aug 31, 2022
95838d1
Fixes rendering of front facing of walls to be consistent with defini…
AlvaroHG Sep 2, 2022
de0e44a
Fixes normals and winding for non hole walls
AlvaroHG Sep 3, 2022
3f46fca
quick test
mattdeitke Sep 4, 2022
134cb0e
support runtime prefabs
mattdeitke Sep 4, 2022
7ad3ea1
fix build failures
mattdeitke Sep 5, 2022
c1553c9
don't create new dir at runtime
mattdeitke Sep 5, 2022
90cd315
make database persistent across resets
mattdeitke Sep 5, 2022
a977c41
parent new obj to proc manager
mattdeitke Sep 5, 2022
29be417
remove local saving because it doesn't work at runtime
mattdeitke Sep 5, 2022
021debe
fix parent so cop doesn't show
mattdeitke Sep 5, 2022
a13d2b9
pass in normals
mattdeitke Sep 6, 2022
5b2f99d
Creating walls by room
AlvaroHG Sep 8, 2022
34558d6
Merge branch 'naive-scale' of github.com:allenai/ai2thor into naive-s…
AlvaroHG Sep 8, 2022
5fa9d38
Removes log
AlvaroHG Sep 8, 2022
f374800
Fixes unit test build passes
AlvaroHG Sep 8, 2022
3086e32
Remove new features from naive-scale
AlvaroHG Sep 8, 2022
6648c4a
Fixes build
AlvaroHG Sep 8, 2022
cc49eb6
Reverting winding, clockwise topdwon definitions for wall's frontness…
AlvaroHG Sep 22, 2022
b76282f
Fixes unity tests
AlvaroHG Sep 22, 2022
5285720
Removed all unused code, added json version
AlvaroHG Sep 23, 2022
310485b
Changed version to schema and removed all color variables into materials
AlvaroHG Sep 27, 2022
886116c
Fix tests
AlvaroHG Sep 27, 2022
cbdb065
Updated test rgb
AlvaroHG Sep 28, 2022
51871f8
Removed reference to missing script
AlvaroHG Sep 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions ai2thor/_quality_settings.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# GENERATED FILE - DO NOT EDIT
DEFAULT_QUALITY = "Ultra"
QUALITY_SETTINGS = {
"DONOTUSE": 0,
"High": 5,
"High WebGL": 8,
"Low": 2,
"Medium": 3,
"MediumCloseFitShadows": 4,
"Ultra": 7,
"Very High": 6,
"Very Low": 1,
}
DEFAULT_QUALITY = 'Ultra'
QUALITY_SETTINGS = {'DONOTUSE': 0,
'High': 5,
'High WebGL': 8,
'Low': 2,
'Medium': 3,
'MediumCloseFitShadows': 4,
'Ultra': 7,
'Very High': 6,
'Very Low': 1}
Binary file modified ai2thor/tests/data/procedural/proc_rgb_lit_fifo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ai2thor/tests/test_unity.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def depth_images_near(depth1, depth2, epsilon=1e-5, debug_save=False, filepath="
max = np.max(diff)
norm_diff = diff / max
dx = np.where(np.abs(depth1 - depth2) >= epsilon)
depth_copy[dx] = norm_diff[dx] * (255, 0, 255)
depth_copy[dx] = (norm_diff[dx]*255, norm_diff[dx] * 0, norm_diff[dx] *255)
test_name = os.environ.get('PYTEST_CURRENT_TEST').split(':')[-1].split(' ')[0]
debug_directory = os.path.join(os.path.join(os.getcwd(), TEST_OUTPUT_DIRECTORY))
# if os.path.exists(debug_directory):
Expand Down
53 changes: 34 additions & 19 deletions ai2thor/tests/test_unity_procedural.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from ai2thor.fifo_server import FifoServer
from .test_unity import build_controller, images_near, depth_images_near
import cv2
import json

DATA_PATH = "ai2thor/tests/data/"
IMAGE_FOLDER_PATH = os.path.join(DATA_PATH, "procedural")
Expand Down Expand Up @@ -57,34 +58,38 @@ def create_pixel_diff_image(img, g_truth):
"rooms": {
"1": {
"wallTemplate": {
"unlit": False,
"color": {
"r": 1.0,
"g": 0.0,
"b": 0.0,
"a": 1.0
"material": {
"unlit": False,
"color": {
"r": 1.0,
"g": 0.0,
"b": 0.0,
"a": 1.0
}
}
},
"floorTemplate": {
"roomType": "Bedroom",
"floorMaterial": "DarkWoodFloors",
"floorMaterial": { "name": "DarkWoodFloors" },
},
"floorYPosition": 0.0,
"wallHeight": 3.0
},
"2": {
"wallTemplate": {
"unlit": False,
"color": {
"r": 0.0,
"g": 0.0,
"b": 1.0,
"a": 1.0
"material": {
"unlit": False,
"color": {
"r": 0.0,
"g": 0.0,
"b": 1.0,
"a": 1.0
}
}
},
"floorTemplate": {
"roomType": "LivingRoom",
"floorMaterial": "RedBrick"
"floorMaterial": { "name": "RedBrick"}
},
"floorYPosition": 0.0,
"wallHeight": 3.0
Expand All @@ -107,9 +112,9 @@ def create_pixel_diff_image(img, g_truth):
"floorColliderThickness": 1.0,
"receptacleHeight": 0.7,
"skyboxId": "Sky1",
"ceilingMaterial": "ps_mat"
}

"ceilingMaterial": { "name": "ps_mat" }
},
"schema": "1.0.0"
}

# TODO rendering is different for fifo and wsgi server
Expand All @@ -133,11 +138,18 @@ def test_render_lit(controller_args):
assert evt.metadata["lastActionSuccess"], evt.metadata["errorMessage"]
house = evt.metadata["actionReturn"]

controller.step(
with open("test_render_lit.json", "w") as f:
print(house)
json.dump(house, f)

evt = controller.step(
action="CreateHouse",
house=house
)

print("Action success {0}, message {1}".format(evt.metadata["lastActionSuccess"], evt.metadata["errorMessage"]))
assert evt.metadata['lastActionSuccess']

evt = controller.step(
action="TeleportFull", x=3.0, y=0.9010001, z=1.0, rotation=dict(x=0, y=0, z=0),
horizon=0, standing=True, forceAction=True
Expand Down Expand Up @@ -189,11 +201,14 @@ def test_depth(controller_args):
assert evt.metadata["lastActionSuccess"], evt.metadata["errorMessage"]
house = evt.metadata["actionReturn"]

controller.step(
evt = controller.step(
action="CreateHouse",
house=house
)

print("Action success {0}, message {1}".format(evt.metadata["lastActionSuccess"], evt.metadata["errorMessage"]))
assert evt.metadata['lastActionSuccess']

evt = controller.step(
action="TeleportFull", x=3.0, y=0.9010001, z=1.0, rotation=dict(x=0, y=0, z=0),
horizon=0, standing=True, forceAction=True
Expand Down
52 changes: 52 additions & 0 deletions unity/Assets/Editor/NormalsVisualizer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using UnityEditor;
using UnityEngine;

[CustomEditor(typeof(MeshFilter))]
public class NormalsVisualizer : Editor {

private const string EDITOR_PREF_KEY = "_normals_length";
private const string EDITOR_PREF_KEY_SHOW = "_normals_show";
private Mesh mesh;
private MeshFilter mf;
private Vector3[] verts;
private Vector3[] normals;
private float normalsLength = 1f;

private bool showNormals = false;

private void OnEnable() {
mf = target as MeshFilter;
if (mf != null) {
mesh = mf.sharedMesh;
}
normalsLength = EditorPrefs.GetFloat(EDITOR_PREF_KEY);
showNormals = EditorPrefs.GetBool(EDITOR_PREF_KEY_SHOW);
}

private void OnSceneGUI() {
if (mesh == null || !showNormals) {
return;
}

Handles.matrix = mf.transform.localToWorldMatrix;
Handles.color = Color.yellow;
verts = mesh.vertices;
normals = mesh.normals;
int len = mesh.vertexCount;

for (int i = 0; i < len; i++) {
Handles.DrawLine(verts[i], verts[i] + normals[i] * normalsLength, 4.0f);
}
}

public override void OnInspectorGUI() {
base.OnInspectorGUI();
EditorGUI.BeginChangeCheck();
normalsLength = EditorGUILayout.FloatField("Normals length", normalsLength);
showNormals = EditorGUILayout.Toggle("Show normals", showNormals);
if (EditorGUI.EndChangeCheck()) {
EditorPrefs.SetFloat(EDITOR_PREF_KEY, normalsLength);
EditorPrefs.SetBool(EDITOR_PREF_KEY_SHOW, showNormals);
}
}
}
17 changes: 1 addition & 16 deletions unity/Assets/Scenes/Procedural/Procedural.unity
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.4975387, g: 0.5876736, b: 0.7671069, a: 1}
m_IndirectSpecularColor: {r: 0.49752694, g: 0.5876213, b: 0.76683104, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down Expand Up @@ -1105,7 +1105,6 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 2102304081}
- component: {fileID: 2102304080}
- component: {fileID: 2102304082}
- component: {fileID: 2102304083}
m_Layer: 0
Expand All @@ -1115,20 +1114,6 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &2102304080
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2102304079}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d2f52a53641cf447b8e93cd67654976c, type: 3}
m_Name:
m_EditorClassIdentifier:
floorMesh: {fileID: 0}
floorMaterial: {fileID: 2100000, guid: 9554c30067d9e4b40a657e538d755129, type: 2}
--- !u!4 &2102304081
Transform:
m_ObjectHideFlags: 0
Expand Down
22 changes: 15 additions & 7 deletions unity/Assets/Scripts/BaseFPSAgentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4543,11 +4543,11 @@ float allowedError
var materialIds = new HashSet<string>(
house.rooms.SelectMany(
r => r.ceilings
.Select(c => c.material)
.Concat(new List<string>() { r.floorMaterial })
.Concat(house.walls.Select(w => w.material))
.Select(c => c.material.name)
.Concat(new List<string>() { r.floorMaterial.name })
.Concat(house.walls.Select(w => w.material.name))
).Concat(
new List<string>() { house.proceduralParameters.ceilingMaterial }
new List<string>() { house.proceduralParameters.ceilingMaterial.name }
)
);
var missingIds = materialIds.Where(id => id != null && !materials.ContainsKey(id));
Expand All @@ -4560,9 +4560,17 @@ float allowedError
)
);
}
Debug.Log("Before Procedural call");
var floor = ProceduralTools.CreateHouse(house: house, materialDb: materials);


try {
ProceduralTools.CreateHouse(house: house, materialDb: materials);
}
catch (Exception e) {
Debug.Log(e);
var msg = $"Exception creating house.\n'{e.Message}'\n'{e.InnerException}'";
Debug.Log(msg);
actionFinished(false, actionReturn: null, errorMessage: msg);
return;
}
actionFinished(true);
}

Expand Down
Loading