[Gtkradiant] shift/scale/rotate to BP translation

SmallPileofGibs spog at planetquake.com
Sat Mar 4 01:23:03 CST 2006


Hi,

The algorithm you need is Q3_to_BP() here:
https://zerowing.idsoftware.com/svn/radiant/GtkRadiant/trunk/radiant/brush_primit.cpp

The appearance of a texture on a face depends on the plane of
projection. The planes of projection differ between BP and regular
texdefs, so you can't simply convert between texdefs - you need to
take the face-normal into account.
Regular texdefs get their projection plane from Normal_GetTransform(),
and BP texdefs use ComputeAxisBase. The code in Q3_to_BP() combines
the regular plane-of-projection transform and the shift/scale/rotate
to get a full 3d transform in world space, and then splits it back
into a BP plane-of-projection transform and the BP 2D matrix.

-SPoG

Saturday, March 4, 2006, 4:10:06 AM, you wrote:

> Hi all,

> I've been trying to write a quick-n-dirty command line conversion tool
> to help in the regular brush mode to brush primitive mode using the 
> FakeTexCoordsToTexMat() procedure found in brush_primit.cpp. The 
> maddening thing is that it *almost* works, but not quite. For example,
> take the following brush:

> // brush 156
> {
> //This is the face we're concerned with
> ( 637 193 126 ) ( 788 193 126 ) ( 788 193 62 ) 01narshadda/00abb3-4 116
> 30 270 0.250000 -0.220000 0 0 0
> //The rest just defines the scope of the brush
> ( 781 596 126 ) ( 781 610 126 ) ( 781 610 62 ) common/caulk 0 0 0 
> 0.250000 0.250000 0 4 0
> ( 670 609 126 ) ( 670 595 126 ) ( 670 595 62 ) common/caulk 0 0 0 
> 0.250000 0.250000 0 4 0
> ( 817 197 126 ) ( 666 197 126 ) ( 666 197 62 ) common/caulk 0 0 0 
> 0.250000 0.250000 0 4 0
> ( 778 610 92 ) ( 778 596 92 ) ( 627 596 92 ) common/caulk 0 0 0 0.250000
> 0.250000 0 4 0
> ( 640 596 62 ) ( 791 596 62 ) ( 791 610 62 ) common/caulk 0 0 0 0.250000
> 0.250000 0 4 0
> }

> The size of the texture for the face we're interested in is 128 x 512
> and fits the face for exactly one copy of the texture. Note the 
> shift/scale/rotate for that face is (83, -304) / (0.25, -0.22) / 270.
> When you take this same exact brush and put it into a BP map, the values
> the surface inspector reports for a one copy exact fit is (147, -304) /
> (0.2168, -0.22656) / 270 which doesn't match at all; this implies that
> the transform done by FakeTexCoordsToTexMat() (and it's inverse) aren't
> accurately converting from one form to the other.

> I guess my question is, then, how can I do the tranformation? Is it even
> possible?

> -- Shamus

> _______________________________________________
> Gtkradiant mailing list
> Gtkradiant at zerowing.idsoftware.com
> http://zerowing.idsoftware.com/cgi-bin/mailman/listinfo/gtkradiant





More information about the Gtkradiant mailing list