BVE WorldWide
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Displaying a non-planar face

4 posters

Go down

Displaying a non-planar face Empty Displaying a non-planar face

Post by Dexter Sat Jul 20, 2019 8:06 am

Hello,

I remember this was not possible in BVE and openBVE as it was creating artifacts and the texture was never applied correctly. Is that still the case? Can it be fixed, or not at all?

Thanks. :-)


Last edited by Dexter on Sat Jul 20, 2019 9:07 pm; edited 2 times in total
Dexter
Dexter

Posts : 2153
Join date : 2011-07-08
Age : 38
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

Displaying a non-planar face Empty Re: Displaying a non-planar face

Post by leezer3 Sat Jul 20, 2019 11:03 am

I can't think why it wouldn't work, certainly shouldn't be any technical reason why not.

If you find it doesn't, produce a simple example and I'll take a look.

leezer3

Posts : 1960
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Displaying a non-planar face Empty Re: Displaying a non-planar face

Post by Dexter Sat Jul 20, 2019 8:13 pm

Ok, I will try to do that. Just give me a few. Rolling Eyes
Dexter
Dexter

Posts : 2153
Join date : 2011-07-08
Age : 38
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

Displaying a non-planar face Empty Re: Displaying a non-planar face

Post by Dexter Sat Jul 20, 2019 8:39 pm

Well, this has a  concave part and it does not display properly with a rectangular texture.

Code:
;;sleeper1
CreateMeshBuilder,
Addvertex,-0.76, -0.169, 0.295,
Addvertex,-0.76, -0.169, 0.491,
Addvertex,-0.63, -0.169, 0.491,
Addvertex,-0.35, -0.195, 0.491,
Addvertex,0.35, -0.195, 0.491,
Addvertex,0.63, -0.169, 0.491,
Addvertex,0.76, -0.169, 0.491,
Addvertex,0.76, -0.169, 0.295,
Addvertex,0.63, -0.169, 0.295,
Addvertex,0.35, -0.195, 0.295,
Addvertex,-0.35, -0.195, 0.295,
Addvertex,-0.63, -0.169, 0.295,
AddFace,0,1,2,3,4,5,6,7,8,9,10,11
LoadTexture,Prazec1.png,
SetTextureCoordinates,0, 0, 1,
SetTextureCoordinates,1, 0, 0,
SetTextureCoordinates,2, 0.1, 0,
SetTextureCoordinates,3, 0.28, 0,
SetTextureCoordinates,4, 0.72, 0,
SetTextureCoordinates,5, 0.9, 0,
SetTextureCoordinates,6, 1, 0,
SetTextureCoordinates,7, 1, 1,
SetTextureCoordinates,8, 0.9, 1,
SetTextureCoordinates,9, 0.72, 1,
SetTextureCoordinates,10, 0.28, 1,
SetTextureCoordinates,11, 0.1, 1,

The shape of the object gets f***** up...
Displaying a non-planar face Distor10


Yet when I separate the Meshes, it gets displayed normally... there is no difference between the two in terms of shape.
Code:
CreateMeshBuilder,
Addvertex,-0.76, -0.169, 0.295,
Addvertex,-0.76, -0.169, 0.491,
Addvertex,-0.63, -0.169, 0.491,
Addvertex,-0.63, -0.169, 0.295,
AddFace,0,1,2,3
LoadTexture,Prazec1.png,
SetTextureCoordinates,0, 0, 1,
SetTextureCoordinates,1, 0, 0,
SetTextureCoordinates,2, 0.1, 0,
SetTextureCoordinates,3, 0.1, 1,

CreateMeshBuilder,
Addvertex,-0.63, -0.169, 0.295,
Addvertex,-0.63, -0.169, 0.491,
Addvertex,-0.35, -0.195, 0.491,
Addvertex,-0.35, -0.195, 0.295,
AddFace,0,1,2,3
LoadTexture,Prazec1.png,
SetTextureCoordinates,0, 0.1, 1,
SetTextureCoordinates,1, 0.1, 0,
SetTextureCoordinates,2, 0.28, 0,
SetTextureCoordinates,3, 0.28, 1,

CreateMeshBuilder,
Addvertex,-0.35, -0.195, 0.295,
Addvertex,-0.35, -0.195, 0.491,
Addvertex,0.35, -0.195, 0.491,
Addvertex,0.35, -0.195, 0.295,
AddFace,0,1,2,3
LoadTexture,Prazec1.png,
SetTextureCoordinates,0, 0.28, 1,
SetTextureCoordinates,1, 0.28, 0,
SetTextureCoordinates,2, 0.72, 0,
SetTextureCoordinates,3, 0.72, 1,

CreateMeshBuilder,
Addvertex,0.35, -0.195, 0.295,
Addvertex,0.35, -0.195, 0.491,
Addvertex,0.63, -0.169, 0.491,
Addvertex,0.63, -0.169, 0.295,
AddFace,0,1,2,3
LoadTexture,Prazec1.png,
SetTextureCoordinates,0, 0.72, 1,
SetTextureCoordinates,1, 0.72, 0,
SetTextureCoordinates,2, 0.9, 0,
SetTextureCoordinates,3, 0.9, 1,

CreateMeshBuilder,
Addvertex,0.63, -0.169, 0.295,
Addvertex,0.63, -0.169, 0.491,
Addvertex,0.76, -0.169, 0.491,
Addvertex,0.76, -0.169, 0.295,
AddFace,0,1,2,3
LoadTexture,Prazec1.png,
SetTextureCoordinates,0, 0.9, 1,
SetTextureCoordinates,1, 0.9, 0,
SetTextureCoordinates,2, 1, 0,
SetTextureCoordinates,3, 1, 1,


I believe it's the marked angle that causes the problem (the frame is taken from the separate meshes version, otherwise it wouldn't have been displayed)
Displaying a non-planar face Angle10
Dexter
Dexter

Posts : 2153
Join date : 2011-07-08
Age : 38
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

Displaying a non-planar face Empty Re: Displaying a non-planar face

Post by Dexter Sat Jul 20, 2019 8:57 pm

I changed the topic name as it seems the problem is not the texture itself, but the actual render displaying the set of verticies incorrectly. It creates some bizarre messed up shape as you can see.
Dexter
Dexter

Posts : 2153
Join date : 2011-07-08
Age : 38
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

Displaying a non-planar face Empty Re: Displaying a non-planar face

Post by Dexter Sat Jul 20, 2019 9:02 pm

This is not working either, it displays broken...

Code:
CreateMeshBuilder,
Addvertex,-0.63, -0.169, 0.295,
Addvertex,-0.63, -0.169, 0.491,
Addvertex,-0.35, -0.195, 0.491,
Addvertex,0.35, -0.195, 0.491,
Addvertex,0.63, -0.169, 0.491,
Addvertex,0.63, -0.169, 0.295,
Addvertex,0.35, -0.195, 0.295,
Addvertex,-0.35, -0.195, 0.295,
AddFace,0,1,2,3,4,5,6,7
LoadTexture,Prazec1.png,
SetTextureCoordinates,0, 0.1, 1,
SetTextureCoordinates,1, 0.1, 0,
SetTextureCoordinates,2, 0.28, 0,
SetTextureCoordinates,3, 0.72, 0,
SetTextureCoordinates,4, 0.9, 0,
SetTextureCoordinates,5, 0.9, 1,
SetTextureCoordinates,6, 0.72, 1,
SetTextureCoordinates,7, 0.28, 1,
Dexter
Dexter

Posts : 2153
Join date : 2011-07-08
Age : 38
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

Displaying a non-planar face Empty Re: Displaying a non-planar face

Post by Dexter Sat Jul 20, 2019 9:05 pm

I might be doing something wrong, but it seems that a non-planar face is displayed as something broken.
Dexter
Dexter

Posts : 2153
Join date : 2011-07-08
Age : 38
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

Displaying a non-planar face Empty Re: Displaying a non-planar face

Post by Dexter Sat Jul 20, 2019 9:24 pm

This (below) is not working either and creates a weirdly displayed thing. Laughing Weirdly textured as well. You can try all the examples with your random rectangular texture (no transparency).
Code:
CreateMeshBuilder,
Addvertex,-0.76, -0.21, 0.295, ;0
Addvertex,-0.76, -0.169, 0.295, ;1
Addvertex,-0.63, -0.169, 0.295, ;2
Addvertex,-0.35, -0.195, 0.295, ;3
Addvertex,0.35, -0.195, 0.295, ;4
Addvertex,0.63, -0.169, 0.295, ;5
Addvertex,0.76, -0.169, 0.295, ;6
Addvertex,0.76, -0.21, 0.295, ;7
AddFace,0,1,2,3,4,5,6,7
LoadTexture,Prazec1.png,
SetTextureCoordinates,0, 0, 0.9,
SetTextureCoordinates,1, 0, 1,
SetTextureCoordinates,2, 0.1, 1,
SetTextureCoordinates,3, 0.28, 1,
SetTextureCoordinates,4, 0.72, 1,
SetTextureCoordinates,5, 0.9, 1,
SetTextureCoordinates,6, 1, 1,
SetTextureCoordinates,7, 1, 0.9,


Separate meshes with same shape work as intended:
Code:
CreateMeshBuilder,
Addvertex,-0.76, -0.21, 0.295,
Addvertex,-0.76, -0.169, 0.295,
Addvertex,-0.63, -0.169, 0.295,
Addvertex,-0.63, -0.21, 0.295,
AddFace,0,1,2,3
LoadTexture,Prazec1.png,
SetTextureCoordinates,0, 0, 0.9,
SetTextureCoordinates,1, 0, 1,
SetTextureCoordinates,2, 0.1, 1,
SetTextureCoordinates,3, 0.1, 0.9,

CreateMeshBuilder,
Addvertex,-0.63, -0.21, 0.295,
Addvertex,-0.63, -0.169, 0.295,
Addvertex,-0.35, -0.195, 0.295,
Addvertex,-0.35, -0.21, 0.295,
AddFace,0,1,2,3
LoadTexture,Prazec1.png,
SetTextureCoordinates,0, 0.1, 0.9,
SetTextureCoordinates,1, 0.1, 1,
SetTextureCoordinates,2, 0.28, 1,
SetTextureCoordinates,3, 0.28, 0.9,

CreateMeshBuilder,
Addvertex,-0.35, -0.21, 0.295,
Addvertex,-0.35, -0.195, 0.295,
Addvertex,0.35, -0.195, 0.295,
Addvertex,0.35, -0.21, 0.295,
AddFace,0,1,2,3
LoadTexture,Prazec1.png,
SetTextureCoordinates,0, 0.28, 0.9,
SetTextureCoordinates,1, 0.28, 1,
SetTextureCoordinates,2, 0.72, 1,
SetTextureCoordinates,3, 0.72, 0.9,

CreateMeshBuilder,
Addvertex,0.35, -0.21, 0.295,
Addvertex,0.35, -0.195, 0.295,
Addvertex,0.63, -0.169, 0.295,
Addvertex,0.63, -0.21, 0.295,
AddFace,0,1,2,3
LoadTexture,Prazec1.png,
SetTextureCoordinates,0, 0.72, 0.9,
SetTextureCoordinates,1, 0.72, 1,
SetTextureCoordinates,2, 0.9, 1,
SetTextureCoordinates,3, 0.9, 0.9,

CreateMeshBuilder,
Addvertex,0.63, -0.21, 0.295,
Addvertex,0.63, -0.169, 0.295,
Addvertex,0.76, -0.169, 0.295,
Addvertex,0.76, -0.21, 0.295,
AddFace,0,1,2,3
LoadTexture,Prazec1.png,
SetTextureCoordinates,0, 0.9, 0.9,
SetTextureCoordinates,1, 0.9, 1,
SetTextureCoordinates,2, 1, 1,
SetTextureCoordinates,3, 1, 0.9,
Dexter
Dexter

Posts : 2153
Join date : 2011-07-08
Age : 38
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

Displaying a non-planar face Empty Re: Displaying a non-planar face

Post by Quork Sat Jul 20, 2019 11:36 pm

Oh! Now I get what you're trying to do. No, faces have to be planar, non-planar faces aren't possible. The border vertices don't define the face, the renderer can't know how to connect which vertices. You'll always have to break those down.
Quork
Quork

Posts : 1438
Join date : 2012-05-05
Age : 32
Location : Hofheim a.T., Hessen (Hesse), European Union

Back to top Go down

Displaying a non-planar face Empty Re: Displaying a non-planar face

Post by graymac Sun Jul 21, 2019 10:46 am

I had the same thing on carriage roof corners where I had to show double curvature, the answer was to break it down in to triangles. With a custom normal or two thrown in the result was acceptable.
graymac
graymac

Posts : 2134
Join date : 2011-08-28
Location : Co Mayo, Eire

http://www.celtictrainsim.com

Back to top Go down

Displaying a non-planar face Empty Re: Displaying a non-planar face

Post by Dexter Sun Jul 21, 2019 11:56 am

Yeah, I believe "double curvature" is the correct reference. It is very unfortunate this cannot be done.
Anyhow, the last example is actually planar, the problem there is the concave angle... Chris mentioned that should be working.
Dexter
Dexter

Posts : 2153
Join date : 2011-07-08
Age : 38
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

Displaying a non-planar face Empty Re: Displaying a non-planar face

Post by leezer3 Sun Jul 21, 2019 7:44 pm

I think what you're forgetting is the winding of the face.
Think of it as a connect the dots puzzle working in threes, which must *always* go anti-clockwise to produce correct results.
Anything enclosed by the current set of three dots will be filled.

openGL in general just doesn't work the way you're trying to make it.

leezer3

Posts : 1960
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Displaying a non-planar face Empty Re: Displaying a non-planar face

Post by Dexter Sun Jul 21, 2019 7:46 pm

Yep, that explains a lot. Laughing
Dexter
Dexter

Posts : 2153
Join date : 2011-07-08
Age : 38
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

Displaying a non-planar face Empty Re: Displaying a non-planar face

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum