Talk:CULL

From GTAMods Wiki
Jump to navigation Jump to search

SA Mirrors

Stub which should get to the article later - please correct me if I am wrong! I still need to do some tests.

San Andreas does support mirrors. They can be created using culling zones. In general a mirror is a zone where one of the box side planes is used to project the objects inside and outside the box reflected by this side plane. The projection view itself can be translated in the world, but only into the direction from the zone center the direction vector points. The Cm value descripes the position of the mirror plane into the direction the direction vector points. This vector is descriped by Vx, Vy and Vz. But it can only point along the axis. So there are 6 different possibilities for the vector:

  • -1, 0, 0 – The plane along the negative x-axis is used for mirror projection
  • 1, 0, 0 – The plane along the positive x-axis is used for mirror projection
  • 0, -1, 0 – The plane along the negative y-axis is used for mirror projection
  • 0, 1, 0 – The plane along the positive y-axis is used for mirror projection
  • 0, 0, -1 – The plane along the negative z-axis is used for mirror projection
  • 0, 0, 1 – The plane along the positive z-axis is used for mirror projection

(need to test things like [1, 1, 0]... but they should also work. The only thing impossible is to reflect an mirror inside an other on the other side - perhaps this is wanted since it may cause an endless recursion... just R* knows ^^)

Now Cm translates the view plane (which is just as large as the side plane of the cull zone used for reflection) to it's final position along the direction vector. Note that Cm is not relative to the zones center. It is an absolute value descriping the planes final position.

Update: [0, 0, 0] is used once in San Andreas - if the direction "points nowhere" the mirror information gets ignored.

Update: IV got a similar format to San Andreas. Anyway I could only find 1 cull zone :p. So it is not confirmed, if mirrors are working, too or if the cull zones are simply ignored. --Aschratt - oO 09:35, 15 July 2010 (UTC)

SA Cull Zone Rotations

GTASA Cull.IPL line format as it appears on the wiki page:

CenterX, CenterY, CenterZ, Unknown1, Length, Bottom, Width, Unknown2, Top, Flag, Unknown3


The wiki article for GTASA cull zones mentions that Unknown1 and Unknown2 are always 0. This is not true. Look at line 878 in Cull.IPL (below):

287.916, -1608.9, 30.9127, 2.62643, 15.1336, 30.9127, 20.0683, -3.48285, 46.6127, 8, 0


In this example the values are as follows:

Unknown1 = 2.62643

Unknown2 = -3.48285


Those values actually are for skewing the cull zone box which is like a crude form of rotation.


The line I referenced (line 878 from Cull.IPL) is for a cull zone above Santa Maria Beach in Los Santos. There is a tall building there that is rotated by 10 degrees.

[1] (Note that it is slightly different from the default GTASA building as it has been modified to add an interior for SA-MP)


Some corrections to the definitions on the wiki page:

Width = X axis distance from CenterX

Length = Y axis distance from CenterY

Unknown1 is actually XSkewValue

Unknown2 is actually YSkewValue


The formula for skewing the cull zone box is as follows:

Top Left Corner: X = (CenterX - Width) + Unknown1 and Y = (CenterY + Length) + Unknown2

Top Right Corner: X = (CenterX + Width) + Unknown1 and Y = (CenterY + Length) - Unknown2

Bottom Left Corner: X = (CenterX - Width) - Unknown1 and Y = (CenterY - Length) + Unknown2

Bottom Right Corner: X = (CenterX + Width) - Unknown1 and Y = (CenterY - Length) - Unknown2


This picture helps to visualize the skewing: [2]


I hope this helps some other people.


Last number of VC cull zone description

Last number of cull zone description (that comes after flags) is crime penalty reduction percentage. It is always 0 in any zone in original game, but values between 0 and 100 are correct. For example, if this value is 100 for some zone, no chaos points are awarded to player if he commits a crime (unless it was witness by cops). If it is 20, and player shoots ped, he is awarded 24 chaos points instead of 30. I assume the similar value is used in GTA III cullzone.dat. Also it looks like this value is obtained by function CCullZones::GetWantedLevelDrop according to original function names list. --Nick007J (talk) 14:46, 20 January 2016 (UTC)

It is also worth noting that Vice City truncates all coordinate values from cull.ipl (of course except center position, which is not stored at all). So game interprets -357.922 as -357. --Nick007J (talk) 15:54, 20 January 2016 (UTC)