Archive 17/01/2023.

Use JSONFile as a Material

Askhento

I know that materials use .xml files, but I don’t like them))
Is it possible to use JSON instead?

1vanK

Urho3D Editor > View > Material Editor > Save As > *.json

Askhento

Thnx for response)
Do you have an example file? Sounds stupid but I don’t have editor haha

1vanK
{
	"techniques": [
		{
			"name": "Techniques/NoTextureUnlit.xml",
			"quality": 0,
			"loddistance": 0.0
		}
	],
	"textures": null,
	"shaderParameters": {
		"UOffset": "1 0 0 0",
		"VOffset": "0 1 0 0",
		"MatDiffColor": "1 1 1 1",
		"MatEmissiveColor": "0 0 0",
		"MatEnvMapColor": "1 1 1",
		"MatSpecColor": "0 0 0 1",
		"Roughness": "0.5",
		"Metallic": "0"
	},
	"shaderParameterAnimations": null,
	"cull": "ccw",
	"shadowcull": "ccw",
	"fill": "solid",
	"depthbias": {
		"constant": 0.0,
		"slopescaled": 0.0
	},
	"alphatocoverage": false,
	"lineantialias": false,
	"renderorder": 128,
	"occlusion": true
}
Askhento

It works!
Thank you)

Askhento

By the way what if I want to use EnvCube.xml Technique? Do you an example of a environment texture field in this case?

1vanK
{
	"techniques": [
		{
			"name": "Techniques/DiffEnvCube.xml",
			"quality": 0,
			"loddistance": 0.0
		}
	],
	"textures": {
		"diffuse": "Textures/Mushroom.dds",
		"environment": "Textures/Skybox.xml"
	},
	"shaderParameters": {
		"UOffset": "1 0 0 0",
		"VOffset": "0 1 0 0",
		"MatDiffColor": "1 1 1 1",
		"MatEmissiveColor": "0 0 0",
		"MatEnvMapColor": "0.2 0.2 0.2",
		"MatSpecColor": "0.1 0.1 0.1 16",
		"Roughness": "0.5",
		"Metallic": "0"
	},
	"shaderParameterAnimations": null,
	"cull": "ccw",
	"shadowcull": "ccw",
	"fill": "solid",
	"depthbias": {
		"constant": 0.0,
		"slopescaled": 0.0
	},
	"alphatocoverage": false,
	"lineantialias": false,
	"renderorder": 128,
	"occlusion": true
}
Askhento

Thank you! It seems that eventually I need the xml file “Textures/Skybox.xml”? Is there any way to set it as json also?

1vanK

I found only ParseTextureTypeXml function in sources