Question about mesh and bigger texture UV data.

General questions about Indigo, the scene format, rendering etc...
Post Reply
8 posts • Page 1 of 1
Johny
Posts: 27
Joined: Wed Apr 18, 2007 10:37 pm

Question about mesh and bigger texture UV data.

Post by Johny » Sun May 06, 2007 7:44 pm

I try to write expoter from trueSpace to Indigo file format. But I dont know how to write Indigo Mesh if obj UV coordinats are bigger than obj vertices.
Bellow are the obj mesh info that I got from texture cube (texture with one jpg file).

Anyone know how to implementation/convert below info to Indigo Mesh data (with uv data)?

Code: Select all

Object name is: /Project/test1/Cube
Number of Vertices : 8
Number of Triangles : 12
Number of faces : 12
Number of Normals : 8
Number of UV coords : 36
Number of Triangle UV coords : 12

UV Triangle stream data:0	-->0	1	2
UV Triangle stream data:1	-->3	4	5
UV Triangle stream data:2	-->6	7	8
UV Triangle stream data:3	-->9	10	11
UV Triangle stream data:4	-->12	13	14
UV Triangle stream data:5	-->15	16	17
UV Triangle stream data:6	-->18	19	20
UV Triangle stream data:7	-->21	22	23
UV Triangle stream data:8	-->24	25	26
UV Triangle stream data:9	-->27	28	29
UV Triangle stream data:10	-->30	31	32
UV Triangle stream data:11	-->33	34	35

UVCoords number :0	-->-5.960464477539063e-8		1
UVCoords number :1	-->-5.960464477539063e-8		0
UVCoords number :2	-->1		0
UVCoords number :3	-->-5.960464477539063e-8		1
UVCoords number :4	-->1		0
UVCoords number :5	-->1		1
UVCoords number :6	-->-5.960464477539063e-8		0
UVCoords number :7	-->1		0
UVCoords number :8	-->1		1
UVCoords number :9	-->-5.960464477539063e-8		0
UVCoords number :10	-->1		1
UVCoords number :11	-->-5.960464477539063e-8		1
UVCoords number :12	-->1		1
UVCoords number :13	-->0		1
UVCoords number :14	-->0		0
UVCoords number :15	-->1		1
UVCoords number :16	-->0		0
UVCoords number :17	-->1		0
UVCoords number :18	-->1		1
UVCoords number :19	-->-5.960464477539063e-8		1
UVCoords number :20	-->-5.960464477539063e-8		0
UVCoords number :21	-->1		1
UVCoords number :22	-->-5.960464477539063e-8		0
UVCoords number :23	-->1		0
UVCoords number :24	-->1		0
UVCoords number :25	-->1		1
UVCoords number :26	-->-5.960464477539063e-8		1
UVCoords number :27	-->1		0
UVCoords number :28	-->-5.960464477539063e-8		1
UVCoords number :29	-->-5.960464477539063e-8		0
UVCoords number :30	-->1		1
UVCoords number :31	-->0		1
UVCoords number :32	-->0		0
UVCoords number :33	-->1		1
UVCoords number :34	-->0		0
UVCoords number :35	-->1		0

Vertices number :0	-->1	-1	-1	Normal-->0.5773502588272095	-0.5773502588272095	-0.5773502588272095
Vertices number :1	-->1	-1	1	Normal-->0.3333333134651184	-0.6666666865348816	0.6666666865348816
Vertices number :2	-->-1	-1	-1	Normal-->-0.6666666865348816	-0.3333333134651184	-0.6666666865348816
Vertices number :3	-->-1	-1	1	Normal-->-0.5773502588272095	-0.5773502588272095	0.5773502588272095
Vertices number :4	-->1	1	-1	Normal-->0.6666666865348816	0.6666666865348816	-0.3333333134651184
Vertices number :5	-->-1	1	-1	Normal-->-0.5773502588272095	0.5773502588272095	-0.5773502588272095
Vertices number :6	-->-1	1	1	Normal-->-0.5773502588272095	0.5773502588272095	0.5773502588272095
Vertices number :7	-->1	1	1	Normal-->0.5773502588272095	0.5773502588272095	0.5773502588272095

Triangles number :0	-->0	1	3
Triangles number :1	-->0	3	2
Triangles number :2	-->0	2	5
Triangles number :3	-->0	5	4
Triangles number :4	-->5	2	3
Triangles number :5	-->5	3	6
Triangles number :6	-->3	1	7
Triangles number :7	-->3	7	6
Triangles number :8	-->7	4	5
Triangles number :9	-->7	5	6
Triangles number :10	-->0	4	7
Triangles number :11	-->0	7	1
Thanks

zuegs
Posts: 380
Joined: Tue Jun 27, 2006 5:46 pm
Location: switzerland

Post by zuegs » Sun May 06, 2007 8:57 pm

I think UVs are related to faces. You have 12 faces with 3 points each, 12*3=36 matches your 36 UVs. Imagine that a vertex/corner of a cube has 3 faces connected and each face can have different UV for this corner.

One problem u still have! the normals looks like your cube is a sphere :wink: for a real cube you would need 36 normals too! Or you recalculate your own normals for each face by his 3 vertices but then you get only flat faces (no normal-smoothing).

Johny
Posts: 27
Joined: Wed Apr 18, 2007 10:37 pm

Post by Johny » Mon May 07, 2007 12:34 am

Zuegs, thanks for reply :)
Can you give a suggestion how to calculate my own normal?

I tried to export my test cube to OBJ format. below is the result. As you can see normal numbers on OBJ file format are also same with vertex number (normal number = vertex number = 8).

I think it would be great if Indigo can automatic calculate normals value. or it's better if Indigo's mesh data can support normals value bigger than vertices number like we can see on OBJ file format.

Code: Select all

# File created by Luuv tsx 1.1.4
# Created on: Sun May 06 20:41:20 2007 -9
# Vertices: 8
# Texture vertices: 36
# Normals: 8
# Faces: 12

mtllib cube1.mtl
v 1.677037 0.000000 -2.201360
v 1.677037 0.880000 -2.201360
v 0.402191 0.000000 -2.201360
v 0.402191 0.880000 -2.201360
v 1.677037 0.000000 0.058925
v 0.402191 0.000000 0.058925
v 0.402191 0.880000 0.058924
v 1.677037 0.880000 0.058925

vt 0.000000 0.000000
vt 0.000000 1.000000
vt 1.000000 1.000000
vt 0.000000 0.000000
vt 1.000000 1.000000
vt 1.000000 0.000000
vt 0.000000 1.000000
vt 1.000000 1.000000
vt 1.000000 0.000000
vt 0.000000 1.000000
vt 1.000000 0.000000
vt 0.000000 0.000000
vt 1.000000 0.000000
vt 0.000000 0.000000
vt 0.000000 1.000000
vt 1.000000 0.000000
vt 0.000000 1.000000
vt 1.000000 1.000000
vt 1.000000 0.000000
vt 0.000000 0.000000
vt 0.000000 1.000000
vt 1.000000 0.000000
vt 0.000000 1.000000
vt 1.000000 1.000000
vt 1.000000 1.000000
vt 1.000000 0.000000
vt 0.000000 0.000000
vt 1.000000 1.000000
vt 0.000000 0.000000
vt 0.000000 1.000000
vt 1.000000 0.000000
vt 0.000000 0.000000
vt 0.000000 1.000000
vt 1.000000 0.000000
vt 0.000000 1.000000
vt 1.000000 1.000000

vn 0.465244 -0.321148 -0.824871
vn 0.465244 0.321148 -0.824871
vn -0.465244 -0.321148 -0.824871
vn -0.465244 0.321148 -0.824871
vn 0.465244 -0.321148 0.824871
vn -0.465244 -0.321148 0.824871
vn -0.465244 0.321148 0.824871
vn 0.465244 0.321148 0.824871

mtllib cube1.mtl

g Cube
s 1
usemtl Cube
f 4/3/4 2/2/2 1/1/1
f 3/6/3 4/5/4 1/4/1
f 6/9/6 3/8/3 1/7/1
f 5/12/5 6/11/6 1/10/1
f 4/15/4 3/14/3 6/13/6
f 7/18/7 4/17/4 6/16/6
f 8/21/8 2/20/2 4/19/4
f 7/24/7 8/23/8 4/22/4
f 6/27/6 5/26/5 8/25/8
f 7/30/7 6/29/6 8/28/8
f 8/33/8 5/32/5 1/31/1
f 2/36/2 8/35/8 1/34/1

# The end.
Thanks

User avatar
Kram1032
Posts: 6649
Joined: Tue Jan 23, 2007 3:55 am
Location: Austria near Vienna

Post by Kram1032 » Mon May 07, 2007 12:48 am

I don't really know, but shouldn't there be normals for both verticles and faces? -> -> ncount=vcount+fcount ?

zuegs
Posts: 380
Joined: Tue Jun 27, 2006 5:46 pm
Location: switzerland

Post by zuegs » Mon May 07, 2007 8:14 am

i don't know how indigo interpretes norrmals when normalsmoothing is deactivated. If not you need 3 normals per vertex for a cube, for a sphere you need only one normal per vertex. The count of normals depends on the object and the 3d-modeler software. If you like the represent a vertex with 3 normals in indigo you need the define 3 vertices with a normal each, 24 vertices in total for a cube. In Blender every face has a "smooth" flag. If a face is flat (non smooth) then i export all vertices of this face with the face normal. If face is smooth (in the case of a sphere) i use the vertex-normal for export instead.
Check in trueSpace if there's a possibility to define if faces are flat or smoothed/rounded. This normal should influence the nr. of normals generated.
How to calc. normals you will find in internet (normalized cross-product of two face-side-vectors)

Johny
Posts: 27
Joined: Wed Apr 18, 2007 10:37 pm

Post by Johny » Tue May 08, 2007 12:34 am

Thanks again Zuegs :D

User avatar
OnoSendai
Developer
Posts: 6243
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Post by OnoSendai » Tue May 08, 2007 12:35 am

With normal smoothing disabled, the normals used are the geometric normals of the triangles, constructed by taking the cross product of the edges.

Johny
Posts: 27
Joined: Wed Apr 18, 2007 10:37 pm

Post by Johny » Tue May 08, 2007 2:27 am

Thanks Ono.

Above cube info was got from cube uv map projection.
I already calculate 3 normal per vertex and apply uv values to all vertex, but got no desire result.

How Indigo manage material texture uv map?

on mesh date, we can see uv0, is there an uv1, uv2, or uv3 ?

Below is cube info with planar uv projection info. how to apply this to Indigo mesh data? Is Indigo have UV map data set?

Code: Select all

Object name is: /Project/test1/Cube
Number of Vertices : 8
Number of Triangles : 12
Number of faces : 12
Number of Normals : 8
Number of UV coords : 13
Number of Triangle UV coords : 12

UV Triangle stream data:0	-->0	1	3
UV Triangle stream data:1	-->0	3	2
UV Triangle stream data:2	-->0	2	5
UV Triangle stream data:3	-->0	5	4
UV Triangle stream data:4	-->5	8	9
UV Triangle stream data:5	-->5	10	6
UV Triangle stream data:6	-->3	1	7
UV Triangle stream data:7	-->11	12	6
UV Triangle stream data:8	-->7	4	5
UV Triangle stream data:9	-->7	5	6
UV Triangle stream data:10	-->0	4	7
UV Triangle stream data:11	-->0	7	1

UVCoords number :0	-->0.625		1
UVCoords number :1	-->0.625		0
UVCoords number :2	-->0.875		1
UVCoords number :3	-->0.875		0
UVCoords number :4	-->0.375		1
UVCoords number :5	-->0.125		1
UVCoords number :6	-->0.125		0
UVCoords number :7	-->0.375		0
UVCoords number :8	-->-0.125		1
UVCoords number :9	-->-0.125		0
UVCoords number :10	-->-0.125		0
UVCoords number :11	-->-0.125		0
UVCoords number :12	-->-0.625		0

Vertices number :0	-->1	-1	-1	Normal-->0.5773502588272095	-0.5773502588272095	-0.5773502588272095
Vertices number :1	-->1	-1	1	Normal-->0.3333333134651184	-0.6666666865348816	0.6666666865348816
Vertices number :2	-->-1	-1	-1	Normal-->-0.6666666865348816	-0.3333333134651184	-0.6666666865348816
Vertices number :3	-->-1	-1	1	Normal-->-0.5773502588272095	-0.5773502588272095	0.5773502588272095
Vertices number :4	-->1	1	-1	Normal-->0.6666666865348816	0.6666666865348816	-0.3333333134651184
Vertices number :5	-->-1	1	-1	Normal-->-0.5773502588272095	0.5773502588272095	-0.5773502588272095
Vertices number :6	-->-1	1	1	Normal-->-0.5773502588272095	0.5773502588272095	0.5773502588272095
Vertices number :7	-->1	1	1	Normal-->0.5773502588272095	0.5773502588272095	0.5773502588272095

Triangles number :0	-->0	1	3
Triangles number :1	-->0	3	2
Triangles number :2	-->0	2	5
Triangles number :3	-->0	5	4
Triangles number :4	-->5	2	3
Triangles number :5	-->5	3	6
Triangles number :6	-->3	1	7
Triangles number :7	-->3	7	6
Triangles number :8	-->7	4	5
Triangles number :9	-->7	5	6
Triangles number :10	-->0	4	7
Triangles number :11	-->0	7	1

Post Reply
8 posts • Page 1 of 1

Who is online

Users browsing this forum: No registered users and 53 guests