mgsx-dev/gdx-gltf

Documentation or Example on Rendering Procedural Mesh

sesteel opened this issue · 6 comments

I've struggled with getting a procedural model to render correctly. I am building a simple heightmap which displays correctly in the default pipeline; however, after modifying the materials when adding it to a scene it renders black.

image

I have several models in the same scene rendering on the same SceneManager render call with the same lights. Is there a particular texture that must be present for lighting to work correctly? I just want to make sure I am not spinning my wheels in the wrong area.

@sesteel Sorry for the delay. No special texture is necessary to have lighting working correctly. The minimal setup (if i remember correctly) is to have a BaseColor (see PBRColorAttribute.createBaseColorFactor) for your material and normals for your mesh.

@sesteel I am experiencing the same problem. I am trying to add a cube (built procedurally) and no matter what I try it's always black.

@mgsx-dev let's say the cube has a material with ColorAttribute, does PBRColorAttribute also needs to be defined? Or it should replace the ColorAttribute?

@yuripourre as said in my previous comment, material should have a baseColorFactor (PBRColorAttribute.createBaseColorFactor). ColorAttribute.diffuse is not compatible with PBR shader.

@mgsx-dev thank you, I will do some testing later today.

@yuripourre @sesteel i added a minimal runnable example of procedural model and material here

@mgsx-dev PBRColorAttribute.createBaseColorFactor did the trick, I was trying to use create diffuse instead.

Thank you so much for this example, it is very helpful!