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

Documentation: Unclear how "World JSON" is supposed to work #13

Open
hybridherbst opened this issue Aug 26, 2024 · 1 comment
Open

Documentation: Unclear how "World JSON" is supposed to work #13

hybridherbst opened this issue Aug 26, 2024 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@hybridherbst
Copy link
Contributor

hybridherbst commented Aug 26, 2024

My understanding is that "Upload World JSON" is kind of a shortcut to having an actual glTF; it allows passing in some JSON data (ideally basically a glTF file or subset thereof) and then operating on that data.

However, I can't seem to get it to work.

Here's the World JSON I tried to use:

{
    "materials": [
        {
            "doubleSided": true,
            "name": "Box",
            "pbrMetallicRoughness": {
                "baseColorFactor": [
                0.800000011920929,
                0.800000011920929,
                0.800000011920929,
                1
                ],
                "roughnessFactor": 0.418181836605072
            }
        },
        {
            "doubleSided": true,
            "name": "Numbers",
            "pbrMetallicRoughness": {
                "baseColorTexture": {
                "extensions": {
                    "KHR_texture_transform": {
                    "offset": [
                        0,
                        0.9999999925494194
                    ],
                    "scale": [
                        1,
                        0.10000000149011612
                    ]
                    }
                },
                "index": 0
                },
                "metallicFactor": 0,
                "roughnessFactor": 0.44090908765792847
            }
        }
    ]
}

and here's the graph:

{
	"nodes": [
		{
			"type": "pointer/get",
			"values": [
				{
					"id": "index",
					"value": [
						1
					],
					"type": 1
				}
			],
			"configuration": [
				{
					"id": "pointer",
					"value": "/materials/{index}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/offset"
				}
			],
			"flows": [],
			"metadata": {
				"positionX": "-152.95025358469047",
				"positionY": "-14.052485184163714"
			}
		},
		{
			"type": "event/onStart",
			"values": [],
			"configuration": [],
			"flows": [
				{
					"id": "out",
					"node": 2,
					"socket": "in"
				}
			],
			"metadata": {
				"positionX": "-87.98506592492325",
				"positionY": "285.35751182875754"
			}
		},
		{
			"type": "ADBE/output_console_node",
			"values": [
				{
					"id": "message",
					"node": 0,
					"socket": "isValid"
				}
			],
			"configuration": [],
			"flows": [],
			"metadata": {
				"positionX": "234.9002222471646",
				"positionY": "101.39403215244309"
			}
		}
	],
	"variables": [],
	"customEvents": [],
	"types": [
		{
			"signature": "bool"
		},
		{
			"signature": "int"
		},
		{
			"signature": "float"
		},
		{
			"signature": "float2"
		},
		{
			"signature": "float3"
		},
		{
			"signature": "float4"
		},
		{
			"signature": "float4x4"
		},
		{
			"signature": "custom",
			"extensions": {
				"AMZN_interactivity_string": {}
			}
		}
	]
}

My expectation is that this should log "true". Is that incorrect?

EDIT: After looking into the code, it seems like only /nodes/99/scale, rotation, translation is hardcoded for pointer access instead of using what's available in the world model.

Loading a GLB also doesn't seem to actually make it possible to access the JSON data inside; only specific properties are registered

@mattmacf98
Copy link
Contributor

In order to use a pointer path that appears in the WorldJson for either engine we would need to register it in the decorator. For the actual Babylon 3D one this means figuring out and implementing the mapping from glTF -> Babylon representation. For the logging one we could just literally dive directly into the JSON and then any pointer in that worldJson is "valid", but I think it would be best to explicitly only enable pointers which are glTF valid found https://github.com/KhronosGroup/glTF/blob/main/specification/2.0/ObjectModel.adoc

@mattmacf98 mattmacf98 added the documentation Improvements or additions to documentation label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants
@hybridherbst @mattmacf98 and others