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

Suggestion: Mirrored face command

5 posters

Go down

Suggestion: Mirrored face command Empty Suggestion: Mirrored face command

Post by Quork Mon Feb 05, 2018 4:15 pm

This post here https://bveworldwide.forumotion.com/t1474-a-small-wip-teaser#16020 made me think. Wouldn't it be sensible to add a command for faces interpreted the other way round, something along the lines of RevFace or similar? While using 3D editors like Blender can safely be assumed to be the long-term future, hand-coding won't disappear anytime soon. A mirrored face command would, I guess, streamline and ease the manual process a lot with negligible preloading time impact and absolutely no performance impact in-sim.
Quork
Quork

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

Back to top Go down

Suggestion: Mirrored face command Empty Re: Suggestion: Mirrored face command

Post by Dexter Mon Feb 05, 2018 8:12 pm

I am not sure I get the point correctly, but if so, you can already do this.

You can use:

  • AddFace2,0,1,2,3 (shows both sides of the face, but with incorrect lighting)
  • AddFace,0,1,2,3 + AddFace,3,2,1,0 in the same MeshBuilder section, which creates correct lighting
Dexter
Dexter

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

http://www.brnobve.eu

Back to top Go down

Suggestion: Mirrored face command Empty Re: Suggestion: Mirrored face command

Post by graymac Mon Feb 05, 2018 8:28 pm

I think Quork meant the texture was to be flipped horizontally, same as swapping the co-ordinate values.
graymac
graymac

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

http://www.celtictrainsim.com

Back to top Go down

Suggestion: Mirrored face command Empty Re: Suggestion: Mirrored face command

Post by Dexter Mon Feb 05, 2018 8:35 pm

Well, you can just swap the values then... :-)
Dexter
Dexter

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

http://www.brnobve.eu

Back to top Go down

Suggestion: Mirrored face command Empty Re: Suggestion: Mirrored face command

Post by Quork Mon Feb 05, 2018 8:36 pm

Wrong and wrong. I was thinking along the lines of RevFace,0,1,2,3 = AddFace,3,2,1,0. This would make it way easier to mirror one vehicle side to the other. "Replace all 'AddFace' in selection with 'RevFace'" can be done with few clicks in any text editor. Reversing the vertices in the AddFace command on the other hand is tedious, manual, non automatisable labour.
Quork
Quork

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

Back to top Go down

Suggestion: Mirrored face command Empty Re: Suggestion: Mirrored face command

Post by Dexter Mon Feb 05, 2018 8:39 pm

But you still need to set some parameters... how far in width you need the face to be displayed etc. RevFace on its own would not help, as you would still need to take into account - OK, this vehicle is 2.5 meters wide, so the RevFace needs to be placed elsewhwre than the AddFace...

And if you think reverting faces is tedious, try building custom length curved rail / switch. Smile
Dexter
Dexter

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

http://www.brnobve.eu

Back to top Go down

Suggestion: Mirrored face command Empty Re: Suggestion: Mirrored face command

Post by Quork Mon Feb 05, 2018 8:47 pm

You'd copy the whole code for one vehicle side into a new MeshBuilder, multiply all x coordinates with -1 (can be automated in any csv editor) - and then you'd simply replace all AddFace with RevFace instead of editing all faces manually. Of course you'd need manual adjustments still for nonsymmetrical parts (text etc.), but the biggest part of the work would be way easier.
Quork
Quork

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

Back to top Go down

Suggestion: Mirrored face command Empty Re: Suggestion: Mirrored face command

Post by Delsin Mon Feb 05, 2018 9:33 pm

I just either flip faces (0,1,2,3 becomes 3,2,1,0, 1,4,5,2 becomes 2,5,4,1 (that's a special "knitting" technique for complex objects in the second example - makes keeping track of what's happening waaaay easier), these "normal face" and "flipped face" sequences are usually repeating and after some time you just remember them and write "2,5,4,1" or so almost subconsciously) or swap vertex coordinates. I don't think we need this command, but some tool to automate the process would be very handy.
Delsin
Delsin

Posts : 313
Join date : 2016-08-20

Back to top Go down

Suggestion: Mirrored face command Empty Re: Suggestion: Mirrored face command

Post by leezer3 Mon Feb 05, 2018 10:25 pm

It'd be relatively trivial to run up an app which reverses *all* the face statements in any given file, but doing it in a more fine-grained manner would be more problematic.

RevFace is an interesting concept, but it feels to me like a solution looking for a problem....

A more interesting concept I've thought of on a tangent though is a specific Mirror command for use in object files.
Something like this:
Mirror X,Y,Z,Normals
Where each parameter (X, Y, Z.....) is either 1 for true or 0 for false

I've used Smace's convertor for this a large amount, and I suspect others have too.

Will play with some prototyping tomorrow and see what I get.

leezer3

Posts : 1980
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Suggestion: Mirrored face command Empty Re: Suggestion: Mirrored face command

Post by Quork Tue Feb 06, 2018 7:49 am

I wasn't aware of the mentioned converter, if that's automating face flipping then, indeed, the problem I was thinking to solve isn't nearly as bad as I thought it is. Also it seems most don't consider the flipping process as tedious as I do - I'd be less than thrilled to do it manually for a 100+ face object, but the fact is, I haven't done anything that complex, so naturally I'm less competent on that field than you guys.

The mirror command sounds really interesting, as it'd allow for mirroring over diagonals as well. That's certainly more versatile. I'd add an optional fifth parameter though - a new texture file path. That'd allow for using the command for objects which are symmetrical as far as the mesh is concerned, but not in texture.
Quork
Quork

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

Back to top Go down

Suggestion: Mirrored face command Empty Re: Suggestion: Mirrored face command

Post by leezer3 Tue Feb 06, 2018 12:10 pm

Texture editing is more of a PITA I'm afraid.
What you need to remember is that the file cascades downwards, and so the texture has no knowledge (per-se) that the face above it has been mirrored.

I've implemented basic mirroring for this build:
https://vps.bvecornwall.co.uk/OpenBVE/Builds/OpenBVE-2018-02-06.zip

Usage:
Mirror X, Y, Z, nX, nY, nZ
X - Vertex X co-ordinates
Y - Vertex Y co-ordinates
Z - Vertex Z co-ordinates
nX - Vertex normal X co-ordinates
nY - Vertex normal Y co-ordinates
nZ - Vertex normal Z co-ordinates
Each parameter must either be 0 - False, or 1 - True.

If nX, nY and nZ are omitted, it is assumed that the normals are to be processed identically to the vertex. If one (or more) of these is set, it is assumed that the others are 0 - False.

MirrorAll X, Y, Z, nX, nY, nZ
This command behaves identically to Mirror, but is applied to all previous faces declared in the object

I've tested it with some reasonably complex loco parts, and this appears to work as expected, but anyone else testing would be interesting Smile

leezer3

Posts : 1980
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Suggestion: Mirrored face command Empty Re: Suggestion: Mirrored face command

Post by Delsin Tue Feb 06, 2018 2:49 pm

To make a mirror version of an object, you'll still have to repeat its code and then apply mirroring to it. So you can simply change texture name in the copy-pasted code and have a mirrored object with different texture.

Never heard of this converter, where can I get it? Googling didn't give any results.

Speaking of *All commands, I thought it'd be helpful for building complex models to have a command doing a translation/rotation/mirroring/etc on all objects within some range defined by some kind of brackets (similar to a*3 + b*3 + c*3 vs (a+b+c)*3 in math equations) or set by number in the command itself (n objects before the command, 1 by default)
Delsin
Delsin

Posts : 313
Join date : 2016-08-20

Back to top Go down

Suggestion: Mirrored face command Empty Re: Suggestion: Mirrored face command

Post by graymac Tue Feb 06, 2018 3:01 pm

Tell me about it!!!  Rolling Eyes Rolling Eyes Rolling Eyes 

Suggestion: Mirrored face command Captur10
graymac
graymac

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

http://www.celtictrainsim.com

Back to top Go down

Suggestion: Mirrored face command Empty Re: Suggestion: Mirrored face command

Post by leezer3 Fri Feb 09, 2018 12:06 pm

Delsin wrote:To make a mirror version of an object, you'll still have to repeat its code and then apply mirroring to it. So you can simply change texture name in the copy-pasted code and have a mirrored object with different texture.

Never heard of this converter, where can I get it? Googling didn't give any results.

Speaking of *All commands, I thought it'd be helpful for building complex models to have a command doing a translation/rotation/mirroring/etc on all objects within some range defined by some kind of brackets (similar to a*3 + b*3 + c*3 vs (a+b+c)*3 in math equations) or set by number in the command itself (n objects before the command, 1 by default)

Both versions of the convertor attached.

These data from ~2002 or so (The file dates say 2003 and 2004, but I think they're actually older than that)

Does rotation, moving, scaling and mirroring- V3 introduces per-axis scaling, but conversion between formats is disabled. (IIRC the conversion to X and vice-versa was never written anyway)

Smace (Sanford Mace) was one of the original pioneers of BVE1 / BVE2, but vanished rather suddenly. If something unusual could be done, he'd probably tried it Razz
Attachments
Suggestion: Mirrored face command Attachment
Convertors.zip You don't have permission to download attachments.(36 Kb) Downloaded 6 times

leezer3

Posts : 1980
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Suggestion: Mirrored face command Empty Re: Suggestion: Mirrored face command

Post by Delsin Fri Feb 09, 2018 5:24 pm

Ahh, the times when I already had a bunch of train design ideas, but never knew of BVE until 10 years later Wink thanks!
Delsin
Delsin

Posts : 313
Join date : 2016-08-20

Back to top Go down

Suggestion: Mirrored face command Empty Re: Suggestion: Mirrored face command

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