Hello everyone!
I would like to share updates on my project to implement support for .json & .yaml formats for material definition files. By addressing the limitations of the existing format (.j3md and .j3m), the project aims to simplify material creation, improve performance, and enhance the overall material management experience in jMonkeyEngine applications.
I created 2 new classes JsonMaterialLoader
and YamlMaterialLoader
, converting all the features of the J3MLoader class (ShaderNodes are not included).
Pros of JSON Format
- Readability: Human-readable and easy to understand.
- Lightweight: Compact format, efficient for data transfer.
- Widely supported: Supported by most programming languages and platforms.
- Versatile: Can represent complex data structures.
- Self-describing: Data types are explicitly defined within the structure.
Pros of YAML Format
- Readability: Highly readable and human-friendly syntax.
- Flexibility: Supports various data types and complex structures.
- Compactness: Often more concise than JSON for similar data.
- Comments: Allows for adding explanatory comments.
- Indentation-based: Uses whitespace for structure, improving readability.
Here are some sample files for comparison:
Material
Material.j3m:
Material MyMaterial : Common/MatDefs/Light/Lighting.j3md {
MaterialParameters {
Diffuse : 0.505882 0.505882 0.505882 1.0
UseMaterialColors : true
ParallaxHeight : 0.05
Ambient : 0.2 0.2 0.2 1.0
BackfaceShadows : false
DiffuseMap : WrapRepeat_S WrapRepeat_T "Models/Ferrari/Car.jpg"
Specular : 0.5 0.5 0.5 1.0
Shininess : 12.5
}
AdditionalRenderState {
FaceCull Back
DepthWrite On
ColorWrite On
PolyOffset 0.0 0.0
DepthTest On
Blend Off
Wireframe Off
}
}
Material.json
{
"Material": {
"name": "MyMaterial",
"def": "Common/MatDefs/New/Lighting.json", // or Lighting.j3md
"MaterialParameters": [
{
"name": "ParallaxHeight",
"value": 0.05
},
{
"name": "Shininess",
"value": 12.5
},
{
"name": "Diffuse",
"value": [0.5, 0.5, 0.5, 1]
},
{
"name": "Ambient",
"value": [0.2, 0.2, 0.2, 1]
},
{
"name": "Specular",
"value": [0.5, 0.5, 0.5, 1]
},
{
"name": "UseMaterialColors",
"value": true
},
{
"name": "BackfaceShadows",
"value": false
},
{
"name": "DiffuseMap",
"texture": {
"path": "Models/Ferrari/Car.jpg",
"wrapS": "Repeat",
"wrapT": "Repeat",
"minFilter": "BilinearNoMipMaps",
"magFilter": "Bilinear",
"flipY": false,
"anisotropy": 4
}
}
],
"AdditionalRenderState": {
"faceCull": "Back",
"blend": "Off",
"depthWrite": true,
"colorWrite": true,
"depthTest": true,
"wireframe": false,
"polyOffset": [0.0, 0.0]
}
}
}
Material.yaml
---
Material:
name: "MyMaterial"
def: "Common/MatDefs/New/Lighting.json" # or Lighting.j3md
MaterialParameters:
- name: "ParallaxHeight"
value: "0.05"
- name: "Shininess"
value: "12.5"
- name: "Diffuse"
value: [0.5, 0.5, 0.5, 1]
- name: "Ambient"
value: [0.2, 0.2, 0.2, 1]
- name: "Specular"
value: [0.5, 0.5, 0.5, 1]
- name: "UseMaterialColors"
value: "true"
- name: "BackfaceShadows"
value: "false"
- name: "DiffuseMap"
texture:
path: "Models/Ferrari/Car.jpg"
wrapS: "Repeat"
wrapT: "Repeat"
minFilter: "BilinearNoMipMaps"
magFilter: "Bilinear"
flipY: "false"
anisotropy: "4"
AdditionalRenderState:
faceCull: "Back"
blend: "Off"
depthWrite: "true"
colorWrite: "true"
depthTest: "true"
wireframe: "false"
polyOffset: [0, 0]
Material Definition
PBRLighting.json
{
"MaterialDef":{
"name":"PBR Lighting",
"MaterialParameters":[
{
"type":"Boolean",
"name":"SeparateTexCoord"
},
{
"type":"Boolean",
"name":"UseSpecularAA",
"value":true
},
{
"type":"Boolean",
"name":"BackfaceShadows",
"value":false
},
{
"type":"Boolean",
"name":"UseSpecGloss"
},
{
"type":"Boolean",
"name":"SteepParallax"
},
{
"type":"Boolean",
"name":"HardwareShadows"
},
{
"type":"Boolean",
"name":"HorizonFade"
},
{
"type":"Boolean",
"name":"UseInstancing"
},
{
"type":"Boolean",
"name":"AoPackedInMRMap"
},
{
"type":"Boolean",
"name":"PackedNormalParallax"
},
{
"type":"Boolean",
"name":"UseVertexColor"
},
{
"type":"Boolean",
"name":"LightMapAsAOMap"
},
{
"type":"Float",
"name":"Roughness",
"value":1
},
{
"type":"Float",
"name":"Glossiness",
"value":1
},
{
"type":"Float",
"name":"NormalType",
"value":-1
},
{
"type":"Float",
"name":"ShadowIntensity"
},
{
"type":"Float",
"name":"EmissivePower",
"value":3
},
{
"type":"Float",
"name":"NormalScale"
},
{
"type":"Float",
"name":"EmissiveIntensity",
"value":2
},
{
"type":"Float",
"name":"Metallic",
"value":1
},
{
"type":"Float",
"name":"AlphaDiscardThreshold"
},
{
"type":"Float",
"name":"SpecularAAKappa"
},
{
"type":"Float",
"name":"SpecularAASigma"
},
{
"type":"Float",
"name":"PCFEdge"
},
{
"type":"Float",
"name":"ParallaxHeight",
"value":0.05
},
{
"type":"Float",
"name":"AoStrength"
},
{
"type":"Float",
"name":"ShadowMapSize"
},
{
"type":"FloatArray",
"name":"MorphWeights"
},
{
"type":"Int",
"name":"NumberOfBones"
},
{
"type":"Int",
"name":"NumberOfMorphTargets"
},
{
"type":"Int",
"name":"FilterMode"
},
{
"type":"Int",
"name":"NumberOfTargetsBuffers"
},
{
"type":"Int",
"name":"BoundDrawBuffer"
},
{
"type":"Matrix4",
"name":"LightViewProjectionMatrix0"
},
{
"type":"Matrix4",
"name":"LightViewProjectionMatrix1"
},
{
"type":"Matrix4",
"name":"LightViewProjectionMatrix2"
},
{
"type":"Matrix4",
"name":"LightViewProjectionMatrix3"
},
{
"type":"Matrix4",
"name":"LightViewProjectionMatrix4"
},
{
"type":"Matrix4",
"name":"LightViewProjectionMatrix5"
},
{
"type":"Matrix4Array",
"name":"BoneMatrices"
},
{
"type":"Texture2D",
"name":"EmissiveMap"
},
{
"type":"Texture2D",
"name":"SpecularMap"
},
{
"type":"Texture2D",
"name":"SpecularGlossinessMap"
},
{
"type":"Texture2D",
"name":"MetallicRoughnessMap",
"colorSpace":"Linear"
},
{
"type":"Texture2D",
"name":"ParallaxMap",
"colorSpace":"Linear"
},
{
"type":"Texture2D",
"name":"RoughnessMap",
"colorSpace":"Linear"
},
{
"type":"Texture2D",
"name":"GlossinessMap"
},
{
"type":"Texture2D",
"name":"ShadowMap5"
},
{
"type":"Texture2D",
"name":"ShadowMap4"
},
{
"type":"Texture2D",
"name":"ShadowMap1"
},
{
"type":"Texture2D",
"name":"ShadowMap0"
},
{
"type":"Texture2D",
"name":"ShadowMap3"
},
{
"type":"Texture2D",
"name":"ShadowMap2"
},
{
"type":"Texture2D",
"name":"NormalMap",
"colorSpace":"Linear"
},
{
"type":"Texture2D",
"name":"BaseColorMap"
},
{
"type":"Texture2D",
"name":"MetallicMap",
"colorSpace":"Linear"
},
{
"type":"Texture2D",
"name":"LightMap"
},
{
"type":"Vector2",
"name":"FadeInfo"
},
{
"type":"Vector3",
"name":"LightPos"
},
{
"type":"Vector3",
"name":"LightDir"
},
{
"type":"Vector4",
"name":"Emissive"
},
{
"type":"Vector4",
"name":"Splits"
},
{
"type":"Vector4",
"name":"BaseColor",
"value":[
1,
1,
1,
1
]
},
{
"type":"Vector4",
"name":"Specular",
"value":[
1,
1,
1,
1
]
}
],
"Techniques":[
{
"name":"PostShadow",
"FragmentShader":"Common/MatDefs/Shadow/PostShadowPBR.frag",
"VertexShader":"Common/MatDefs/Shadow/PostShadow.vert",
"ShaderLanguages":[
"GLSL310", "GLSL300", "GLSL150", "GLSL100"
],
"WorldParameters":[
"WorldViewProjectionMatrix",
"WorldMatrix",
"ViewProjectionMatrix",
"ViewMatrix"
],
"Defines":[
{
"name":"BOUND_DRAW_BUFFER",
"param":"BoundDrawBuffer"
},
{
"name":"HARDWARE_SHADOWS",
"param":"HardwareShadows"
},
{
"name":"FILTER_MODE",
"param":"FilterMode"
},
{
"name":"PCFEDGE",
"param":"PCFEdge"
},
{
"name":"DISCARD_ALPHA",
"param":"AlphaDiscardThreshold"
},
{
"name":"SHADOWMAP_SIZE",
"param":"ShadowMapSize"
},
{
"name":"FADE",
"param":"FadeInfo"
},
{
"name":"PSSM",
"param":"Splits"
},
{
"name":"POINTLIGHT",
"param":"LightViewProjectionMatrix5"
},
{
"name":"NUM_BONES",
"param":"NumberOfBones"
},
{
"name":"INSTANCING",
"param":"UseInstancing"
},
{
"name":"BACKFACE_SHADOWS",
"param":"BackfaceShadows"
},
{
"name":"NUM_MORPH_TARGETS",
"param":"NumberOfMorphTargets"
},
{
"name":"NUM_TARGETS_BUFFERS",
"param":"NumberOfTargetsBuffers"
}
],
"ForcedRenderState":{
"Blend":"Modulate",
"DepthWrite":false,
"PolyOffset":[
-0.1,
0.0
]
}
},
{
"name":"PreShadow",
"FragmentShader":"Common/MatDefs/Shadow/PreShadowPBR.frag",
"VertexShader":"Common/MatDefs/Shadow/PreShadow.vert",
"ShaderLanguages":[
"GLSL300", "GLSL150", "GLSL100"
],
"WorldParameters":[
"WorldViewProjectionMatrix",
"WorldViewMatrix",
"ViewProjectionMatrix",
"ViewMatrix"
],
"Defines":[
{
"name":"BOUND_DRAW_BUFFER",
"param":"BoundDrawBuffer"
},
{
"name":"DISCARD_ALPHA",
"param":"AlphaDiscardThreshold"
},
{
"name":"NUM_BONES",
"param":"NumberOfBones"
},
{
"name":"INSTANCING",
"param":"UseInstancing"
},
{
"name":"NUM_MORPH_TARGETS",
"param":"NumberOfMorphTargets"
},
{
"name":"NUM_TARGETS_BUFFERS",
"param":"NumberOfTargetsBuffers"
}
],
"ForcedRenderState":{
"FaceCull":"Off",
"ColorWrite":false,
"PolyOffset":[
5.0,
3.0
]
}
},
{
"name":"PreNormalPass",
"FragmentShader":"Common/MatDefs/SSAO/normal.frag",
"VertexShader":"Common/MatDefs/SSAO/normal.vert",
"ShaderLanguages":[
"GLSL300", "GLSL150", "GLSL100"
],
"WorldParameters":[
"WorldViewProjectionMatrix",
"WorldViewMatrix",
"NormalMatrix",
"ViewProjectionMatrix",
"ViewMatrix"
],
"Defines":[
{
"name":"BOUND_DRAW_BUFFER",
"param":"BoundDrawBuffer"
},
{
"name":"BASECOLORMAP_ALPHA",
"param":"BaseColorMap"
},
{
"name":"NUM_BONES",
"param":"NumberOfBones"
},
{
"name":"INSTANCING",
"param":"UseInstancing"
},
{
"name":"NUM_MORPH_TARGETS",
"param":"NumberOfMorphTargets"
},
{
"name":"NUM_TARGETS_BUFFERS",
"param":"NumberOfTargetsBuffers"
}
]
},
{
"name":"Glow",
"FragmentShader":"Common/MatDefs/Light/PBRGlow.frag",
"VertexShader":"Common/MatDefs/Misc/Unshaded.vert",
"ShaderLanguages":[
"GLSL300", "GLSL150", "GLSL100"
],
"WorldParameters":[
"WorldViewProjectionMatrix",
"ViewProjectionMatrix",
"ViewMatrix"
],
"Defines":[
{
"name":"HAS_EMISSIVEMAP",
"param":"EmissiveMap"
},
{
"name":"HAS_EMISSIVECOLOR",
"param":"Emissive"
},
{
"name":"BOUND_DRAW_BUFFER",
"param":"BoundDrawBuffer"
},
{
"name":"NUM_BONES",
"param":"NumberOfBones"
},
{
"name":"INSTANCING",
"param":"UseInstancing"
},
{
"name":"NUM_MORPH_TARGETS",
"param":"NumberOfMorphTargets"
},
{
"name":"NUM_TARGETS_BUFFERS",
"param":"NumberOfTargetsBuffers"
}
]
},
{
"name":"Default",
"FragmentShader":"Common/MatDefs/Light/PBRLighting.frag",
"VertexShader":"Common/MatDefs/Light/PBRLighting.vert",
"ShaderLanguages":[
"GLSL300", "GLSL150", "GLSL100"
],
"LightMode":"SinglePassAndImageBased",
"WorldParameters":[
"WorldViewProjectionMatrix",
"CameraPosition",
"WorldMatrix",
"WorldNormalMatrix",
"ViewProjectionMatrix",
"ViewMatrix"
],
"Defines":[
{
"name":"BOUND_DRAW_BUFFER",
"param":"BoundDrawBuffer"
},
{
"name":"BASECOLORMAP",
"param":"BaseColorMap"
},
{
"name":"NORMALMAP",
"param":"NormalMap"
},
{
"name":"NORMALSCALE",
"param":"NormalScale"
},
{
"name":"METALLICMAP",
"param":"MetallicMap"
},
{
"name":"ROUGHNESSMAP",
"param":"RoughnessMap"
},
{
"name":"EMISSIVEMAP",
"param":"EmissiveMap"
},
{
"name":"EMISSIVE",
"param":"Emissive"
},
{
"name":"SPECGLOSSPIPELINE",
"param":"UseSpecGloss"
},
{
"name":"PARALLAXMAP",
"param":"ParallaxMap"
},
{
"name":"NORMALMAP_PARALLAX",
"param":"PackedNormalParallax"
},
{
"name":"STEEP_PARALLAX",
"param":"SteepParallax"
},
{
"name":"LIGHTMAP",
"param":"LightMap"
},
{
"name":"SEPARATE_TEXCOORD",
"param":"SeparateTexCoord"
},
{
"name":"DISCARD_ALPHA",
"param":"AlphaDiscardThreshold"
},
{
"name":"NUM_BONES",
"param":"NumberOfBones"
},
{
"name":"INSTANCING",
"param":"UseInstancing"
},
{
"name":"USE_PACKED_MR",
"param":"MetallicRoughnessMap"
},
{
"name":"USE_PACKED_SG",
"param":"SpecularGlossinessMap"
},
{
"name":"SPECULARMAP",
"param":"SpecularMap"
},
{
"name":"SPECULAR_AA",
"param":"UseSpecularAA"
},
{
"name":"SPECULAR_AA_SCREEN_SPACE_VARIANCE",
"param":"SpecularAASigma"
},
{
"name":"SPECULAR_AA_THRESHOLD",
"param":"SpecularAAKappa"
},
{
"name":"GLOSSINESSMAP",
"param":"GlossinessMap"
},
{
"name":"NORMAL_TYPE",
"param":"NormalType"
},
{
"name":"VERTEX_COLOR",
"param":"UseVertexColor"
},
{
"name":"AO_MAP",
"param":"LightMapAsAOMap"
},
{
"name":"AO_PACKED_IN_MR_MAP",
"param":"AoPackedInMRMap"
},
{
"name":"AO_STRENGTH",
"param":"AoStrength"
},
{
"name":"NUM_MORPH_TARGETS",
"param":"NumberOfMorphTargets"
},
{
"name":"NUM_TARGETS_BUFFERS",
"param":"NumberOfTargetsBuffers"
},
{
"name":"HORIZON_FADE",
"param":"HorizonFade"
}
]
}
]
}
}
PBRLighting.yaml
---
MaterialDef:
name: "PBR Lighting"
MaterialParameters:
- Color:
- BaseColor: [1, 1, 1, 1]
- Specular: [1, 1, 1, 1]
- Vector2:
- FadeInfo:
- Vector3:
- LightPos:
- LightDir:
- Float:
- Roughness: 1
- Metallic: 1
- Glossiness: 1
- NormalType: -1
- EmissivePower: 3
- EmissiveIntensity: 2
- AlphaDiscardThreshold:
- ShadowIntensity:
- NormalScale:
- SpecularAAKappa:
- SpecularAASigma:
- PCFEdge:
- ParallaxHeight: 0.05
- AoStrength:
- ShadowMapSize:
- Texture2D:
- MetallicRoughnessMap: Linear
- MetallicMap: Linear
- NormalMap: Linear
- ParallaxMap: Linear
- BaseColorMap:
- EmissiveMap:
- SpecularMap:
- GlossinessMap:
- SpecularGlossinessMap:
- RoughnessMap:
- LightMap:
- ShadowMap0:
- ShadowMap1:
- ShadowMap2:
- ShadowMap3:
- ShadowMap4:
- ShadowMap5:
- Boolean:
- UseSpecularAA: true
- BackfaceShadows: false
- UseSpecGloss:
- SteepParallax:
- HardwareShadows:
- HorizonFade:
- UseInstancing:
- AoPackedInMRMap:
- PackedNormalParallax:
- UseVertexColor:
- LightMapAsAOMap:
- SeparateTexCoord:
- Matrix4:
- LightViewProjectionMatrix0:
- LightViewProjectionMatrix1:
- LightViewProjectionMatrix2:
- LightViewProjectionMatrix3:
- LightViewProjectionMatrix4:
- LightViewProjectionMatrix5:
# etc...
Techniques:
- name: "PostShadow"
FragmentShader: "Common/MatDefs/Shadow/PostShadowPBR.frag"
VertexShader: "Common/MatDefs/Shadow/PostShadow.vert"
ShaderLanguages: ["GLSL310", "GLSL300", "GLSL150", "GLSL100"]
WorldParameters:
- "WorldViewProjectionMatrix"
- "WorldMatrix"
- "ViewProjectionMatrix"
- "ViewMatrix"
Defines:
BOUND_DRAW_BUFFER: "BoundDrawBuffer"
HARDWARE_SHADOWS: "HardwareShadows"
FILTER_MODE: "FilterMode"
PCFEDGE: "PCFEdge"
DISCARD_ALPHA: "AlphaDiscardThreshold"
SHADOWMAP_SIZE: "ShadowMapSize"
FADE: "FadeInfo"
PSSM: "Splits"
POINTLIGHT: "LightViewProjectionMatrix5"
NUM_BONES: "NumberOfBones"
INSTANCING: "UseInstancing"
BACKFACE_SHADOWS: "BackfaceShadows"
NUM_MORPH_TARGETS: "NumberOfMorphTargets"
NUM_TARGETS_BUFFERS: "NumberOfTargetsBuffers"
ForcedRenderState:
Blend: "Modulate"
DepthWrite: "false"
PolyOffset: [-0.1, 0]
- name: "PreShadow"
FragmentShader: "Common/MatDefs/Shadow/PreShadowPBR.frag"
VertexShader: "Common/MatDefs/Shadow/PreShadow.vert"
ShaderLanguages: ["GLSL300", "GLSL150", "GLSL100"]
WorldParameters:
- "WorldViewProjectionMatrix"
- "WorldViewMatrix"
- "ViewProjectionMatrix"
- "ViewMatrix"
Defines:
BOUND_DRAW_BUFFER: "BoundDrawBuffer"
DISCARD_ALPHA: "AlphaDiscardThreshold"
NUM_BONES: "NumberOfBones"
INSTANCING: "UseInstancing"
NUM_MORPH_TARGETS: "NumberOfMorphTargets"
NUM_TARGETS_BUFFERS: "NumberOfTargetsBuffers"
ForcedRenderState:
FaceCull: "Off"
ColorWrite: "false"
PolyOffset: [5, 3]
- name: "PreNormalPass"
FragmentShader: "Common/MatDefs/SSAO/normal.frag"
VertexShader: "Common/MatDefs/SSAO/normal.vert"
ShaderLanguages: ["GLSL300", "GLSL150", "GLSL100"]
WorldParameters:
- "WorldViewProjectionMatrix"
- "WorldViewMatrix"
- "NormalMatrix"
- "ViewProjectionMatrix"
- "ViewMatrix"
Defines:
BOUND_DRAW_BUFFER: "BoundDrawBuffer"
BASECOLORMAP_ALPHA: "BaseColorMap"
NUM_BONES: "NumberOfBones"
INSTANCING: "UseInstancing"
NUM_MORPH_TARGETS: "NumberOfMorphTargets"
NUM_TARGETS_BUFFERS: "NumberOfTargetsBuffers"
- name: "Glow"
FragmentShader: "Common/MatDefs/Light/PBRGlow.frag"
VertexShader: "Common/MatDefs/Misc/Unshaded.vert"
ShaderLanguages: ["GLSL300", "GLSL150", "GLSL100"]
WorldParameters:
- "WorldViewProjectionMatrix"
- "ViewProjectionMatrix"
- "ViewMatrix"
Defines:
HAS_EMISSIVEMAP: "EmissiveMap"
HAS_EMISSIVECOLOR: "Emissive"
BOUND_DRAW_BUFFER: "BoundDrawBuffer"
NUM_BONES: "NumberOfBones"
INSTANCING: "UseInstancing"
NUM_MORPH_TARGETS: "NumberOfMorphTargets"
NUM_TARGETS_BUFFERS: "NumberOfTargetsBuffers"
- name: "Default"
FragmentShader: "Common/MatDefs/Light/PBRLighting.frag"
VertexShader: "Common/MatDefs/Light/PBRLighting.vert"
ShaderLanguages: ["GLSL300", "GLSL150", "GLSL100"]
LightMode: "SinglePassAndImageBased"
WorldParameters:
- "WorldViewProjectionMatrix"
- "CameraPosition"
- "WorldMatrix"
- "WorldNormalMatrix"
- "ViewProjectionMatrix"
- "ViewMatrix"
Defines:
BOUND_DRAW_BUFFER: "BoundDrawBuffer"
BASECOLORMAP: "BaseColorMap"
NORMALMAP: "NormalMap"
NORMALSCALE: "NormalScale"
METALLICMAP: "MetallicMap"
ROUGHNESSMAP: "RoughnessMap"
EMISSIVEMAP: "EmissiveMap"
EMISSIVE: "Emissive"
SPECGLOSSPIPELINE: "UseSpecGloss"
PARALLAXMAP: "ParallaxMap"
NORMALMAP_PARALLAX: "PackedNormalParallax"
STEEP_PARALLAX: "SteepParallax"
LIGHTMAP: "LightMap"
SEPARATE_TEXCOORD: "SeparateTexCoord"
DISCARD_ALPHA: "AlphaDiscardThreshold"
NUM_BONES: "NumberOfBones"
INSTANCING: "UseInstancing"
USE_PACKED_MR: "MetallicRoughnessMap"
USE_PACKED_SG: "SpecularGlossinessMap"
SPECULARMAP: "SpecularMap"
SPECULAR_AA: "UseSpecularAA"
SPECULAR_AA_SCREEN_SPACE_VARIANCE: "SpecularAASigma"
SPECULAR_AA_THRESHOLD: "SpecularAAKappa"
GLOSSINESSMAP: "GlossinessMap"
NORMAL_TYPE: "NormalType"
VERTEX_COLOR: "UseVertexColor"
AO_MAP: "LightMapAsAOMap"
AO_PACKED_IN_MR_MAP: "AoPackedInMRMap"
AO_STRENGTH: "AoStrength"
NUM_MORPH_TARGETS: "NumberOfMorphTargets"
NUM_TARGETS_BUFFERS: "NumberOfTargetsBuffers"
HORIZON_FADE: "HorizonFade"
For this format I had also thought of this structure for the MaterialParameters block, let me know which one you prefer:
---
MaterialDef:
name: "PBR Lighting"
MatParams:
- Float: {name: Roughness, value: 1}
- Texture2D: {name: MetallicRoughnessMap, colorSpace: Linear}
- Color: {name: BaseColor, value: [1, 1, 1, 1]}
- Vector2: {name: FadeInfo}
- Vector3: {name: LightPos}
- Vector3: {name: LightDir}
- Int: {name: UseInstancing}
- Boolean: {name: UseSpecularAA, value: true}
- Boolean: {name: UseInstancing}
- Matrix4: {name: LightViewProjectionMatrix0}
# ...
I wrote the project taking cues from other engines like Unity, partly for fun and partly because I think the current format is a bit old, limited, and difficult to evolve (see the numerous parsing problems of the SDKās Materials editor).
Obviously the project is developed as a library external to the engine.
Let me know if there is interest in the idea. Any constructive criticism is always appreciated.