Page 1 of 2

MeshVertexPosition - What am I doing wrong?

Posted: Mon Jul 29, 2013 9:23 am
by Lexicon
Hi guys,
I can't understand why the 2 and 3 textures looks inside the mesh. Please explain me. :(

Code: Select all

CreateMesh(22, #PB_Mesh_TriangleList, #PB_Mesh_Dynamic)

MeshVertexPosition(0, 0, 0)
MeshVertexTextureCoordinate(0, 0)
MeshVertexPosition(1, 0, 0)
MeshVertexTextureCoordinate(0.1, 0)
MeshVertexPosition(0, 0, 20)
MeshVertexTextureCoordinate(0, 2)
MeshVertexPosition(1, 0, 20)
MeshVertexTextureCoordinate(0.1, 2)
MeshFace(0, 1, 3)
MeshFace(3, 2, 0)

MeshVertexPosition(0, 0, 0)
MeshVertexTextureCoordinate(0, 0)
MeshVertexPosition(0, 2, 0)
MeshVertexTextureCoordinate(0.2, 0)
MeshVertexPosition(0, 0, 20)
MeshVertexTextureCoordinate(0, 2)
MeshVertexPosition(0, 2, 20)
MeshVertexTextureCoordinate(0.2, 2)

MeshFace(4, 5, 7)
MeshFace(7, 6, 4)

MeshVertexPosition(0, 2, 0)
MeshVertexTextureCoordinate(0.2, 0)
MeshVertexPosition(1, 2, 0)
MeshVertexTextureCoordinate(0.3, 0)
MeshVertexPosition(0, 2, 20)
MeshVertexTextureCoordinate(0.2, 2)
MeshVertexPosition(1, 2, 20)
MeshVertexTextureCoordinate(0.3, 2)
MeshFace(11, 10, 8)
MeshFace(8, 9, 11)

MeshVertexPosition(1, 2, 0)
MeshVertexTextureCoordinate(0.4, 0)
MeshVertexPosition(1, 0, 0)
MeshVertexTextureCoordinate(0.6, 0)
MeshVertexPosition(1, 2, 20)
MeshVertexTextureCoordinate(0.4, 2)
MeshVertexPosition(1, 0, 20)
MeshVertexTextureCoordinate(0.6, 2)
MeshFace(15, 13, 12)
MeshFace(12, 14, 15)

FinishMesh(#True)
NormalizeMesh(22)

CreateEntity(22, MeshID(22), MaterialID(20), 5230, 50, 5169)

Re: MeshVertexPosition - What am I doing wrong?

Posted: Mon Jul 29, 2013 12:41 pm
by Olliv
Within Meshface() arguments.
Interchange 2 of the 3 arguments in the matching MeshFace functions.

Re: MeshVertexPosition - What am I doing wrong?

Posted: Mon Jul 29, 2013 7:50 pm
by Olliv
Please explain me
An aircraft goes forward because its propeller turns one way.
If the propeller turns opposite way, the same aircraft goes backward!

On spatial rendering, the three vertices of a face (triangular) seem to turn around a fictive center, from the first vertex, through the second one, to the third one.

According to this rotation way, the face will be visible either before or behind, propeller effect akin.

Nota: interchange (or "exchange" I do not know the right word) 2 vertices in the "MeshFace" function has as result to invert the turning way, and so swaps the visible side!

Re: MeshVertexPosition - What am I doing wrong?

Posted: Tue Jul 30, 2013 6:27 am
by Lexicon
Olliv wrote:
Please explain me
Nota: interchange (or "exchange" I do not know the right word) 2 vertices in the "MeshFace" function has as result to invert the turning way, and so swaps the visible side!
Thanks. I did it. Now I have some black artefacts on the opposite side of box. :(
I will try again bit later.

Re: MeshVertexPosition - What am I doing wrong?

Posted: Tue Jul 30, 2013 7:20 pm
by Olliv
Do not worry.

In the current life, we could see lots of artefacts. What is necessary is keep stand up and keep a little place for the coffee.

Re: MeshVertexPosition - What am I doing wrong?

Posted: Tue Jul 30, 2013 7:42 pm
by Olliv
Do not worry... EXCEPTED if these artifacts are aligned and seem to be black right-angle triangles.
Do not they do?

Re: MeshVertexPosition - What am I doing wrong?

Posted: Thu Aug 01, 2013 5:42 am
by Lexicon
Olliv wrote:Do not worry... EXCEPTED if these artifacts are aligned and seem to be black right-angle triangles.
Do not they do?
Yes. I compiled my 1st cube correctly. Thanks. :D

Code: Select all


CreateMesh(30, #PB_Mesh_TriangleList, #PB_Mesh_Static) ; FileCustomMesh$

MeshVertexPosition(1.000000, -1.000000, -1.000000)
MeshVertexPosition(1.000000, -1.000000, 1.000000)
MeshVertexPosition(-1.000000, -1.000000, 1.000000)
MeshVertexPosition(-1.000000, -1.000000, -1.000000)
MeshVertexPosition(1.000000, 1.000000, -1.000000)
MeshVertexPosition(1.000000, 1.000000, 1.000001)
MeshVertexPosition(-1.000000, 1.000000, 1.000000)
MeshVertexPosition(-1.000000, 1.000000, -1.000000)

MeshFace(0,1,2)
MeshFace(2,3,0)

MeshFace(4,7,6)
MeshFace(6,5,4)

MeshFace(0,4,5)
MeshFace(5,1,0)

MeshFace(1,5,6)
MeshFace(6,2,1)

MeshFace(2,6,7)
MeshFace(7,3,2)

MeshFace(4,0,3)
MeshFace(3,7,4)

FinishMesh(#True)
NormalizeMesh(30)

CreateEntity(30, MeshID(30), MaterialID(21), 10180, 120, 6112)


Re: MeshVertexPosition - What am I doing wrong?

Posted: Wed Nov 06, 2013 4:42 pm
by Lexicon
Hi mates!
I did it! :D
My 3D Engine that programming via PB 5.11!
Full terrain have this resolution: 30x30km.
The tree "betula" (classical russian tree) have from 16 000 polygones to 56 000 polygons and 5-6 meters in height. On the left statistic window you can see xCam and zCam. This is meters on the map of terrain.

https://www.youtube.com/watch?v=IrsZfVgVbkc

Please look and comments. Oh, and as you see my engine supports 2 500 000 polygons without freeze. :wink:
PS. Please pay attention! Each trees's leaf is a separate object in the trees's structure. No sprites as branch and leafs! NumTri is the current number of polygons.

Thanks for your criticism.
All this is PB 5.11! :D

Re: MeshVertexPosition - What am I doing wrong?

Posted: Wed Nov 06, 2013 4:52 pm
by Fred
Looks good !!

Re: MeshVertexPosition - What am I doing wrong?

Posted: Wed Nov 06, 2013 6:53 pm
by Lexicon
Fred wrote:Looks good !!
Thanks Fred.

Re: MeshVertexPosition - What am I doing wrong?

Posted: Wed Nov 06, 2013 8:30 pm
by Samuel
Lexicon wrote: Please look and comments. Oh, and as you see my engine supports 2 500 000 polygons without freeze. :wink:
PS. Please pay attention! Each trees's leaf is a separate object in the trees's structure. No sprites as branch and leafs! NumTri is the current number of polygons.
Looks good, but if you don't mind me asking what are your computer specs? Just curious if it runs well on lower and higher end computers.

Re: MeshVertexPosition - What am I doing wrong?

Posted: Wed Nov 06, 2013 8:45 pm
by Lexicon
Samuel wrote:Looks good, but if you don't mind me asking what are your computer specs? Just curious if it runs well on lower and higher end computers.
Processor - i3, GeForce GT240 1Gb, RAM - 2Gb, WinXP SP3 32Bit. Not very high parameters. :wink:

Re: MeshVertexPosition - What am I doing wrong?

Posted: Thu Nov 07, 2013 6:42 pm
by applePi
nice tour and good performance, is your terrain and trees have physics properties?. if not i suggest to have a look at the nice game hoveracer by Kelebrindae http://www.purebasic.fr/english/viewtop ... hovercraft its latest version for pb 5.10 and it works okay for pb 5.11, it has large terrain, trees, explosions, the cars can collide with the trees. and much more. the source code with media files available there.

Re: MeshVertexPosition - What am I doing wrong?

Posted: Fri Nov 08, 2013 9:43 pm
by Lexicon
applePi wrote:nice tour and good performance, is your terrain and trees have physics properties?. if not i suggest to have a look at the nice game hoveracer by Kelebrindae http://www.purebasic.fr/english/viewtop ... hovercraft its latest version for pb 5.10 and it works okay for pb 5.11, it has large terrain, trees, explosions, the cars can collide with the trees. and much more. the source code with media files available there.
Thanks applePi, very nice! :)

Re: MeshVertexPosition - What am I doing wrong?

Posted: Sat Nov 09, 2013 1:22 pm
by Lexicon
oops... :(

Ogre.log
18:14:19: Warning: shadow index buffer size to small. Auto increasing buffer size to380880

And stop program.
This warning was after set BuildMeshShadowVolume on the tree model. Why it happens?