How to export bump 3d model to use normal mapping by fbx-conv

Hi cocos, I have an ugent demo for my customer in the next 2 weeks. I really really need your helps

I’m trying to export 3d model with normal mapping.

Looking into fbx-conv tool, I have found option -p (Export tagent binormal data.).

fbx-conv.exe -t -p -v BlenderGuruCobblestoneStreetFinal.fbx

But I cannot export c3b, c3t including VERTEX_ATTRIB_TANGENT, VERTEX_ATTRIB_BINORMAL

from here: https://github.com/cocos2d-x/fbx-conv

I saw that, VERTEX_ATTRIB_TANGENT will not be exported if model does not have normal material. (I have no experience with blender or any other 3d tool)

I tried with fbx model from blenderguru but it still not work.

I did the wrong thing, or fbx-conv have some problem in exporting procedure ?

here is my convert output:

INFO:     FBX to c3x converter, version 0.7 x32 (release version, cocos2d-x-3.4
beta0 or later version can use)
STATUS:   Loading source file
PROGRESS: Import FBX 1.89% Plane.019
PROGRESS: Import FBX 3.77% Plane.018
PROGRESS: Import FBX 5.66% Plane.017
PROGRESS: Import FBX 7.55% Plane.016
PROGRESS: Import FBX 9.43% Cylinder.012
PROGRESS: Import FBX 11.32% Cylinder.011
PROGRESS: Import FBX 13.21% Cylinder.010
PROGRESS: Import FBX 15.09% Cylinder.009
PROGRESS: Import FBX 16.98% Cylinder.008
PROGRESS: Import FBX 18.87% Cylinder.007
PROGRESS: Import FBX 20.75% Cylinder.006
PROGRESS: Import FBX 22.64% Cylinder.005
PROGRESS: Import FBX 24.53% Cylinder.004
PROGRESS: Import FBX 26.42% Cylinder.003
PROGRESS: Import FBX 28.30% Cylinder.002
PROGRESS: Import FBX 30.19% Plane.015
PROGRESS: Import FBX 32.08% Plane.013
PROGRESS: Import FBX 33.96% Cylinder.013
PROGRESS: Import FBX 35.85% Stalk-big1
PROGRESS: Import FBX 37.74% Original
PROGRESS: Import FBX 39.62% SecondOriginal
PROGRESS: Import FBX 41.51% Variation B
PROGRESS: Import FBX 43.40% VariationC.001
PROGRESS: Import FBX 45.28% VariationD
PROGRESS: Import FBX 47.17% Material.006
PROGRESS: Import FBX 49.06% Material.005
PROGRESS: Import FBX 50.94% Material.003
PROGRESS: Import FBX 52.83% Material.002
PROGRESS: Import FBX 54.72% ThickGrass
PROGRESS: Import FBX 56.60% Plane.011
PROGRESS: Import FBX 58.49% Plane.010
PROGRESS: Import FBX 60.38% Plane.009
PROGRESS: Import FBX 62.26% Plane.008
PROGRESS: Import FBX 64.15% Mesh
PROGRESS: Import FBX 66.04% Mesh.001
PROGRESS: Import FBX 67.92% Mesh.002
PROGRESS: Import FBX 69.81% Mesh.003
PROGRESS: Import FBX 71.70% Mesh.004
PROGRESS: Import FBX 73.58% Mesh.005
PROGRESS: Import FBX 75.47% Mesh.006
PROGRESS: Import FBX 77.36% Mesh.007
PROGRESS: Import FBX 79.25% Mesh.008
PROGRESS: Import FBX 81.13% Mesh.009
PROGRESS: Import FBX 83.02% Mesh.010
PROGRESS: Import FBX 84.91% Plane.002
PROGRESS: Import FBX 86.79% Mesh.011
PROGRESS: Import FBX 88.68% Mesh.012
PROGRESS: Import FBX 90.57% Mesh.013
PROGRESS: Import FBX 92.45% Mesh.014
PROGRESS: Import FBX 94.34% Mesh.015
PROGRESS: Import FBX 96.23% Mesh.016
PROGRESS: Import FBX 98.11% Mesh.017
PROGRESS: Import FBX 100.00%

STATUS:   [Plane.011] Triangulating FbxMesh geometry
STATUS:   [Plane.010] Triangulating FbxMesh geometry
STATUS:   [Plane.009] Triangulating FbxMesh geometry
STATUS:   [Plane.008] Triangulating FbxMesh geometry
STATUS:   [Mesh] Triangulating FbxMesh geometry
STATUS:   [Mesh.001] Triangulating FbxMesh geometry
STATUS:   [Mesh.002] Triangulating FbxMesh geometry
STATUS:   [Mesh.003] Triangulating FbxMesh geometry
STATUS:   [Mesh.004] Triangulating FbxMesh geometry
STATUS:   [Mesh.005] Triangulating FbxMesh geometry
STATUS:   [Mesh.006] Triangulating FbxMesh geometry
STATUS:   [Mesh.007] Triangulating FbxMesh geometry
STATUS:   [Mesh.008] Triangulating FbxMesh geometry
STATUS:   [Mesh.009] Triangulating FbxMesh geometry
STATUS:   [Mesh.010] Triangulating FbxMesh geometry
STATUS:   [Plane.002] Triangulating FbxMesh geometry
STATUS:   [Mesh.011] Triangulating FbxMesh geometry
STATUS:   [Mesh.012] Triangulating FbxMesh geometry
STATUS:   [Mesh.013] Triangulating FbxMesh geometry
STATUS:   [Mesh.014] Triangulating FbxMesh geometry
STATUS:   [Mesh.015] Triangulating FbxMesh geometry
STATUS:   [Mesh.016] Triangulating FbxMesh geometry
STATUS:   [Mesh.017] Triangulating FbxMesh geometry
VERBOSE:  [Plane.011] polygons: 128 (384 indices), control points: 81
VERBOSE:  [Plane.010] polygons: 128 (384 indices), control points: 81
VERBOSE:  [Plane.009] polygons: 128 (384 indices), control points: 81
VERBOSE:  [Plane.008] polygons: 128 (384 indices), control points: 81
VERBOSE:  [Mesh] polygons: 116 (348 indices), control points: 120
VERBOSE:  [Mesh.001] polygons: 116 (348 indices), control points: 128
VERBOSE:  [Mesh.002] polygons: 116 (348 indices), control points: 124
VERBOSE:  [Mesh.003] polygons: 212 (636 indices), control points: 144
ERROR:    [Mesh.003] Skipping geometry without material
VERBOSE:  [Mesh.004] polygons: 44 (132 indices), control points: 56
VERBOSE:  [Mesh.005] polygons: 44 (132 indices), control points: 56
VERBOSE:  [Mesh.006] polygons: 44 (132 indices), control points: 56
VERBOSE:  [Mesh.007] polygons: 44 (132 indices), control points: 56
VERBOSE:  [Mesh.008] polygons: 44 (132 indices), control points: 56
VERBOSE:  [Mesh.009] polygons: 212 (636 indices), control points: 146
ERROR:    [Mesh.009] Skipping geometry without material
VERBOSE:  [Mesh.010] polygons: 44 (132 indices), control points: 56
VERBOSE:  [Plane.002] polygons: 2 (6 indices), control points: 4
VERBOSE:  [Mesh.011] polygons: 22680 (68040 indices), control points: 25920
WARNING:  Mesh contains more indices (68040) than the specified maximum (32767)
VERBOSE:  [Mesh.012] polygons: 1200 (3600 indices), control points: 790
VERBOSE:  [Mesh.013] polygons: 1200 (3600 indices), control points: 790
VERBOSE:  [Mesh.014] polygons: 1440 (4320 indices), control points: 945
VERBOSE:  [Mesh.015] polygons: 992 (2976 indices), control points: 655
VERBOSE:  [Mesh.016] polygons: 880 (2640 indices), control points: 575
VERBOSE:  [Mesh.017] polygons: 1216 (3648 indices), control points: 800
STATUS:   Converting source file
STATUS:   Closing source file
VERBOSE:  Listing model information:
VERBOSE:  ID        :
VERBOSE:  Version   : Hi=0, Lo=7
VERBOSE:  Meshes    : 3 (250520 vertices, 21 parts, 92202 indices)
VERBOSE:  Nodes     : 24 root, 24 total, 22 parts
VERBOSE:  Materials : 5 (0 textures)
STATUS:   Exporting to c3t file: BlenderGuruCobblestoneStreetFinal.c3t
STATUS:   Closing exported file    indent preformatted text by 4 spaces

here is my c3t:

{
	"version": "0.7", 
	"id": "", 
	"meshes": [
		{
			"attributes": [{
					"size":   3, 
					"type": "GL_FLOAT", 
					"attribute": "VERTEX_ATTRIB_POSITION"
				}, {
					"size":   3, 
					"type": "GL_FLOAT", 
					"attribute": "VERTEX_ATTRIB_NORMAL"
				}, {
					"size":   2, 
					"type": "GL_FLOAT", 
					"attribute": "VERTEX_ATTRIB_TEX_COORD"
				}], 

Any help would be very valuable to me

Anyone ? plzzz

I am trying to do the same and haven’t yet got it working so the following may not help:

I don’t believe Blender has a concept of “normal material”. I can only think that that means a material that has a texture for which

  • Normal Map has been checked
  • Tangent has been selected
  • Diffuse Color has been unchecked
  • Geometry Normal has been checked

but presumably you must have that otherwise your model wouldn’t look correct in Blender

My c3t file has this:

"materials": [
	{
		"id": "Material__lizard-tex-plain_png", 
		"ambient": [ 1.000000,  1.000000,  1.000000], 
		"diffuse": [ 0.800000,  0.800000,  0.800000], 
		"emissive": [ 0.800000,  0.800000,  0.800000], 
		"opacity":  1.000000, 
		"textures": [
			{
				"id": "lizard-tex-plain_png", 
				"filename": "lizard-tex-x.png", 
				"type": "DIFFUSE", 
				"wrapModeU": "REPEAT", 
				"wrapModeV": "REPEAT"
			},
			{
				"id": "lizard-norm-plain_png", 
				"filename": "lizard-norm-x.png", 
				"type": "NORMAL", 
				"wrapModeU": "REPEAT", 
				"wrapModeV": "REPEAT"
			}
		]
	}
],

Do you have TANGENT properties in you c3t file ?
Can you render sprite with normal mapping ?
look into tests/cpp-tests/Resources/Sprite3DTest/sphere_bumped.c3b. We can find VERTEX_ATTRIB_TANGENT and VERTEX_ATTRIB_BINORMAL
2 aboves attribute is used for normal mapping.

And I still don’t known how to export model include these attribute.
Do you have any solution for this ?

I do!!! :grinning: Just five minutes ago I got it working. Within Blender, when exporting to FBX, use the 7.4 version, click the Geometrie tab and check Tangent Space. Then use the -p flag to fbx-conv.

Glad I found your post. I didn’t realise that the lack of tangen space was the problem. Nor did I know of the -p flag.

I want specular highlights so I’m going to have to mess with the shaders but having the normal map working at all is a big step forward.

Thank you so much, I have tangent and binormal now :smiley:

I looked back at this, hoping to mark it as solved, but I cannot see the “tick” button on any post.