A random sentence for a random mind.

(Request) Fixing Brush Rounding Errors?

For questions and discussion about UnrealEd, UnrealScript, and other aspects of Unreal Engine design.

Moderators: Semfry, ividyon

User avatar Tarydax
Skaarj Elder Skaarj Elder
Posts: 1052
Joined: 11 Apr 2009, 04:10

Subject: (Request) Fixing Brush Rounding Errors?

Post Posted: 18 Feb 2014, 14:58

Something I've noticed when rotating brushes and pasting them into a text editor is that the vertices and origins become slightly warped so that the brush isn't precisely on the grid.

As an example, here are the properties of a regular cube brush:

[spoiler]Begin Map
Begin Actor Class=Brush Name=Brush1
CsgOper=CSG_Add

Begin Brush Name=Model2
Begin PolyList
Begin Polygon
Origin -00128.000000,-00128.000000,-00128.000000
Normal -00001.000000,+00000.000000,+00000.000000
TextureU +00000.000000,+00001.000000,+00000.000000
TextureV +00000.000000,+00000.000000,-00001.000000
Pan U=0 V=0
Vertex -00128.000000,-00128.000000,-00128.000000
Vertex -00128.000000,-00128.000000,+00128.000000
Vertex -00128.000000,+00128.000000,+00128.000000
Vertex -00128.000000,+00128.000000,-00128.000000
End Polygon
Begin Polygon
Origin -00128.000000,+00128.000000,-00128.000000
Normal +00000.000000,+00001.000000,+00000.000000
TextureU +00001.000000,+00000.000000,+00000.000000
TextureV +00000.000000,+00000.000000,-00001.000000
Pan U=0 V=0
Vertex -00128.000000,+00128.000000,-00128.000000
Vertex -00128.000000,+00128.000000,+00128.000000
Vertex +00128.000000,+00128.000000,+00128.000000
Vertex +00128.000000,+00128.000000,-00128.000000
End Polygon
Begin Polygon
Origin +00128.000000,+00128.000000,-00128.000000
Normal +00001.000000,+00000.000000,+00000.000000
TextureU +00000.000000,-00001.000000,+00000.000000
TextureV +00000.000000,+00000.000000,-00001.000000
Pan U=0 V=0
Vertex +00128.000000,+00128.000000,-00128.000000
Vertex +00128.000000,+00128.000000,+00128.000000
Vertex +00128.000000,-00128.000000,+00128.000000
Vertex +00128.000000,-00128.000000,-00128.000000
End Polygon
Begin Polygon
Origin +00128.000000,-00128.000000,-00128.000000
Normal +00000.000000,-00001.000000,+00000.000000
TextureU -00001.000000,-00000.000000,-00000.000000
TextureV +00000.000000,+00000.000000,-00001.000000
Pan U=0 V=0
Vertex +00128.000000,-00128.000000,-00128.000000
Vertex +00128.000000,-00128.000000,+00128.000000
Vertex -00128.000000,-00128.000000,+00128.000000
Vertex -00128.000000,-00128.000000,-00128.000000
End Polygon
Begin Polygon
Origin -00128.000000,+00128.000000,+00128.000000
Normal +00000.000000,+00000.000000,+00001.000000
TextureU +00001.000000,+00000.000000,+00000.000000
TextureV +00000.000000,+00001.000000,+00000.000000
Pan U=0 V=0
Vertex -00128.000000,+00128.000000,+00128.000000
Vertex -00128.000000,-00128.000000,+00128.000000
Vertex +00128.000000,-00128.000000,+00128.000000
Vertex +00128.000000,+00128.000000,+00128.000000
End Polygon
Begin Polygon
Origin -00128.000000,-00128.000000,-00128.000000
Normal +00000.000000,+00000.000000,-00001.000000
TextureU +00001.000000,+00000.000000,+00000.000000
TextureV +00000.000000,-00001.000000,+00000.000000
Pan U=0 V=0
Vertex -00128.000000,-00128.000000,-00128.000000
Vertex -00128.000000,+00128.000000,-00128.000000
Vertex +00128.000000,+00128.000000,-00128.000000
Vertex +00128.000000,-00128.000000,-00128.000000
End Polygon
End PolyList
End Brush
Brush=Model'MyLevel.Model2'
End Actor
End Map[/spoiler]

When the brush is rotated:

[spoiler]Begin Map
Begin Actor Class=Brush Name=Brush1
CsgOper=CSG_Add

Begin Brush Name=Model2
Begin PolyList
Begin Polygon
Origin -00181.019333,-00128.000000,-00000.000009
Normal -00000.707107,+00000.000000,+00000.707107
TextureU +00000.000000,+00001.000000,+00000.000000
TextureV -00000.707107,+00000.000000,-00000.707107
Pan U=0 V=0
Vertex -00181.019333,-00128.000000,-00000.000009
Vertex -00000.000009,-00128.000000,+00181.019333
Vertex -00000.000009,+00128.000000,+00181.019333
Vertex -00181.019333,+00128.000000,-00000.000009
End Polygon
Begin Polygon
Origin -00181.019333,+00128.000000,-00000.000009
Normal +00000.000000,+00001.000000,+00000.000000
TextureU +00000.707107,+00000.000000,-00000.707107
TextureV -00000.707107,+00000.000000,-00000.707107
Pan U=0 V=0
Vertex -00181.019333,+00128.000000,-00000.000009
Vertex -00000.000009,+00128.000000,+00181.019333
Vertex +00181.019333,+00128.000000,+00000.000009
Vertex +00000.000009,+00128.000000,-00181.019333
End Polygon
Begin Polygon
Origin +00000.000009,+00128.000000,-00181.019333
Normal +00000.707107,+00000.000000,-00000.707107
TextureU +00000.000000,-00001.000000,+00000.000000
TextureV -00000.707107,+00000.000000,-00000.707107
Pan U=0 V=0
Vertex +00000.000009,+00128.000000,-00181.019333
Vertex +00181.019333,+00128.000000,+00000.000009
Vertex +00181.019333,-00128.000000,+00000.000009
Vertex +00000.000009,-00128.000000,-00181.019333
End Polygon
Begin Polygon
Origin +00000.000009,-00128.000000,-00181.019333
Normal +00000.000000,-00001.000000,+00000.000000
TextureU -00000.707107,+00000.000000,+00000.707107
TextureV -00000.707107,+00000.000000,-00000.707107
Pan U=0 V=0
Vertex +00000.000009,-00128.000000,-00181.019333
Vertex +00181.019333,-00128.000000,+00000.000009
Vertex -00000.000009,-00128.000000,+00181.019333
Vertex -00181.019333,-00128.000000,-00000.000009
End Polygon
Begin Polygon
Origin -00000.000009,+00128.000000,+00181.019333
Normal +00000.707107,+00000.000000,+00000.707107
TextureU +00000.707107,+00000.000000,-00000.707107
TextureV +00000.000000,+00001.000000,+00000.000000
Pan U=0 V=0
Vertex -00000.000009,+00128.000000,+00181.019333
Vertex -00000.000009,-00128.000000,+00181.019333
Vertex +00181.019333,-00128.000000,+00000.000009
Vertex +00181.019333,+00128.000000,+00000.000009
End Polygon
Begin Polygon
Origin -00181.019333,-00128.000000,-00000.000009
Normal -00000.707107,+00000.000000,-00000.707107
TextureU +00000.707107,+00000.000000,-00000.707107
TextureV +00000.000000,-00001.000000,+00000.000000
Pan U=0 V=0
Vertex -00181.019333,-00128.000000,-00000.000009
Vertex -00181.019333,+00128.000000,-00000.000009
Vertex +00000.000009,+00128.000000,-00181.019333
Vertex +00000.000009,-00128.000000,-00181.019333
End Polygon
End PolyList
End Brush
Brush=Model'MyLevel.Model2'
End Actor
End Map[/spoiler]

And finally, when the brush is back in its original position:

[spoiler]Begin Map
Begin Actor Class=Brush Name=Brush1
CsgOper=CSG_Add

Begin Brush Name=Model2
Begin PolyList
Begin Polygon
Origin -00127.999962,-00128.000000,-00128.000015
Normal -00001.000000,+00000.000000,-00000.000000
TextureU +00000.000000,+00001.000000,+00000.000000
TextureV +00000.000000,+00000.000000,-00001.000000
Pan U=0 V=0
Vertex -00127.999962,-00128.000000,-00128.000015
Vertex -00128.000015,-00128.000000,+00127.999962
Vertex -00128.000015,+00128.000000,+00127.999962
Vertex -00127.999962,+00128.000000,-00128.000015
End Polygon
Begin Polygon
Origin -00127.999962,+00128.000000,-00128.000015
Normal +00000.000000,+00001.000000,+00000.000000
TextureU +00001.000000,+00000.000000,+00000.000000
TextureV +00000.000000,+00000.000000,-00001.000000
Pan U=0 V=0
Vertex -00127.999962,+00128.000000,-00128.000015
Vertex -00128.000015,+00128.000000,+00127.999962
Vertex +00127.999962,+00128.000000,+00128.000015
Vertex +00128.000015,+00128.000000,-00127.999962
End Polygon
Begin Polygon
Origin +00128.000015,+00128.000000,-00127.999962
Normal +00001.000000,+00000.000000,+00000.000000
TextureU +00000.000000,-00001.000000,+00000.000000
TextureV +00000.000000,+00000.000000,-00001.000000
Pan U=0 V=0
Vertex +00128.000015,+00128.000000,-00127.999962
Vertex +00127.999962,+00128.000000,+00128.000015
Vertex +00127.999962,-00128.000000,+00128.000015
Vertex +00128.000015,-00128.000000,-00127.999962
End Polygon
Begin Polygon
Origin +00128.000015,-00128.000000,-00127.999962
Normal +00000.000000,-00001.000000,+00000.000000
TextureU -00001.000000,+00000.000000,-00000.000000
TextureV +00000.000000,+00000.000000,-00001.000000
Pan U=0 V=0
Vertex +00128.000015,-00128.000000,-00127.999962
Vertex +00127.999962,-00128.000000,+00128.000015
Vertex -00128.000015,-00128.000000,+00127.999962
Vertex -00127.999962,-00128.000000,-00128.000015
End Polygon
Begin Polygon
Origin -00128.000015,+00128.000000,+00127.999962
Normal -00000.000000,+00000.000000,+00001.000000
TextureU +00001.000000,+00000.000000,+00000.000000
TextureV +00000.000000,+00001.000000,+00000.000000
Pan U=0 V=0
Vertex -00128.000015,+00128.000000,+00127.999962
Vertex -00128.000015,-00128.000000,+00127.999962
Vertex +00127.999962,-00128.000000,+00128.000015
Vertex +00127.999962,+00128.000000,+00128.000015
End Polygon
Begin Polygon
Origin -00127.999962,-00128.000000,-00128.000015
Normal +00000.000000,+00000.000000,-00001.000000
TextureU +00001.000000,+00000.000000,+00000.000000
TextureV +00000.000000,-00001.000000,+00000.000000
Pan U=0 V=0
Vertex -00127.999962,-00128.000000,-00128.000015
Vertex -00127.999962,+00128.000000,-00128.000015
Vertex +00128.000015,+00128.000000,-00127.999962
Vertex +00128.000015,-00128.000000,-00127.999962
End Polygon
End PolyList
End Brush
Brush=Model'MyLevel.Model2'
End Actor
End Map[/spoiler]

Rotating brushes screws up the vertices, and any rotated brushes aren't perfectly on the grid; this is a problem because brush rotating needs to happen in order to align textures properly. I've gotten the feeling that this has been the cause of a lot of BSP issues I've been having lately (particularly with supercuts). I tried the Actor Align command, but it hasn't been as useful as I hoped it would be (Origins and vertices can still have issues).

If it's possible and is not too much trouble, could someone make a script that clamps the vertices so that they'll end up being exactly on the grid all the time? Or maybe something that would round numbers like 00127.999962 up or down to the nearest whole number?
Image

User avatar Gizzy
Skaarj Berserker Skaarj Berserker
Posts: 450
Joined: 02 Feb 2010, 12:55

Subject: Re: (Request) Fixing Brush Rounding Errors?

Post Posted: 18 Feb 2014, 22:01


User avatar Tarydax
Skaarj Elder Skaarj Elder
Posts: 1052
Joined: 11 Apr 2009, 04:10

Subject: Re: (Request) Fixing Brush Rounding Errors?

Post Posted: 19 Feb 2014, 23:22

Sorry, but I'm not sure how that helps me. I mentioned that actor align can still have issues with origins and vertices.
Image


Who is online

Users browsing this forum: No registered users and 48 guests

Copyright © 2001-2024 UnrealSP.org

Powered by phpBB® Forum Software © phpBB Limited