Snapping part of brush vertices to grid

Tutorials and discussions about Mapping - Introduce your own ones!
Post Reply
Buggie
Godlike
Posts: 2733
Joined: Sat Mar 21, 2020 5:32 am

Snapping part of brush vertices to grid

Post by Buggie »

How to snap to grid some (not all vertices) from brush?

Assume I build cube, disable grid snap, move little.
And now I want one plane snap to grid, not touch or move another cube.

How to do this?
User avatar
Barbie
Godlike
Posts: 2802
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Snapping part of brush vertices to grid

Post by Barbie »

Export to T3D, round the decimal places, reimport it. If the brush is not too complex, it works acceptable fast; even faster if your editor has a "Replace All" command.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
Buggie
Godlike
Posts: 2733
Joined: Sat Mar 21, 2020 5:32 am

Re: Snapping part of brush vertices to grid

Post by Buggie »

Maybe I am wrong, it will destroy textures align and scale?

When edit vertices I can use MODE TEXTURELOCK=1 for prevent this.

Also it is huge terrain brush. Very hard decide where located need vertices. I do not want touch any vertices which already connected with another brushes.

In general I want remove some polygons by drag vertices in one point.

Testing for cube show this remove polygons, and nothing bad happens. Maybe I am wrong again.
User avatar
Barbie
Godlike
Posts: 2802
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Snapping part of brush vertices to grid

Post by Barbie »

Editor crashes if I want to reduce vertices; here I tried to reduce an orthogonal square prism to a triangle prism by dropping 2 vertices on 2 existing ones:
CriticalError.jpg
CriticalError.jpg (16.34 KiB) Viewed 372 times
How do you try to reduce vertices?
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
Buggie
Godlike
Posts: 2733
Joined: Sat Mar 21, 2020 5:32 am

Re: Snapping part of brush vertices to grid

Post by Buggie »

v436 crash. v469 not crash.

Map from v469 loaded in v436.

Copy brush to text show it is look like normal brush without any problem.

Code: Select all

Begin Map
Begin Actor Class=Brush Name=Brush0
     CsgOper=CSG_Subtract
     MainScale=(SheerAxis=SHEER_ZX)
     PostScale=(SheerAxis=SHEER_ZX)
     Level=LevelInfo'MyLevel.LevelInfo0'
     Tag="Brush"
     Region=(Zone=LevelInfo'MyLevel.LevelInfo0',iLeaf=-1)
     Location=(X=-128.000000,Y=-128.000000,Z=-128.000000)
     bSelected=True
    Begin Brush Name=Model4
       Begin PolyList
          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
             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
             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.707107,-00000.707107,+00000.000000
             TextureU -00001.000000,-00000.000000,-00000.000000
             TextureV +00000.000000,+00000.000000,-00001.000000
             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
             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
             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.Model4'
     PrePivot=(X=-128.000000,Y=-128.000000,Z=-128.000000)
     Name="Brush0"
End Actor
End Map
Buggie
Godlike
Posts: 2733
Joined: Sat Mar 21, 2020 5:32 am

Re: Snapping part of brush vertices to grid

Post by Buggie »

I found way get rid of unnecessary polygons. Even on v436.

This hack based on BSP optimization: if distance between vertices less 0.25, then its merged to one.

So you just need drag vertices to near each one in distance less 0.25.

So you need make maximal zoom. Drag vertices with enabled grid step=1 max close.
After that type
MODE SPEED=0.1 TEXTURELOCK=1 SNAPDIST=1
for set speed very low and possible drag more over 1/3 uu.
Drag vertices without grid lock very close.

For return proper speed for mouse - use button on UEd panel. Also do not forget enable grid lock back.

Now on build this poly will be eliminated during optimization process. Even on v436.

Checked on cube. Before: 6 polys, 6 nodes. After: 5 Polys, 5 Nodes.
UT run fine, UEd too. No any crash.
------
But it is very dangerous trick.You can not revert geometry after this.
So be very careful.
Also you can produces bad geometry with a lot a fake zones.
I ended on it.

Finally I cropped terrain with brush clipping with good results.
Post Reply