 |
 |
GoldenEye 007 Nintendo 64 Community, GoldenEye X, Nintendo 64 Games Discussion GoldenEye Cheats, GoldenEye X Codes, Tips, Help, Nintendo 64 Gaming Community
|
 |
 |
 |
 |
|
 |
 |
 |
 |
 |
Trevor 007


Joined: 15 Jan 2010 Posts: 926 Location: UK, Friockheim OS:Win11-Dev PerfectGold:Latest  |
Posted: Sun May 22, 2016 1:31 pm Post subject: Visibility, Fog, Object Bounding Volumes and Fade-in |
 |
|
I was looking for info on this subject and searched the forums and net for answers.
It seems as though there is no documentation on the subject though I did find one post from Sogun which I have updated with my findings.
Ammendments are welcome if I have missed anything
=============
=============
NOTE
Level.Scale actually means "Scale everything by Level.Scale"
This is why Dam works, it doesn't make the BG bigger (thereby overflowing the 65,357 limit) but instead it scales EVERYTHING ELSE.
eg. Level.Scale = 0.2
Bond Height = 180
BG door height = 42
cardboard box height = 100
after scaling :
Bond Height = 36
BG door height = 42
cardboard box height = 20
therefor because everything is scaled, bonds apparent height doesn't change, he remains 1.8m tall relative to the BG
This applies to all physics too, a grenade thrown will only travel 0.2 the distance it should - again, thereby apparently traveling the correct distance.
This all works because the RSP is a s15.16 fixed point machine meaning we can use 16bits of fractional units (though pre-scaled models are still limited to Integer vertex co-ords)
All references to exceeding 65,357 below can now be ignored, instead scale all values by level.Scale
this document is in the process of being updated!!! 29/12/18
=============
=============
Key:
X - Sogun (original text I copied)
X - Myself
X - Wreck
X - Zoinkity
--------
Draw Distance = Bounding Volume Radius.
This is not part of Level/Sky but part of Model, however equally related and affected by sky data.
Bounding Volume Radius is a number (Small crate = 727) that defines the Radius from model center, defined by Position, that must be on-screen for the object to draw.
The Radius defining Bounding Volume Sphere round the model must encompase the whole model without being so big that the model never culls outside of the view frustum.
This value is also used in far-clip and fade-in distance calculations later.
-------
Visibility - Scale factor for some skylevel boxes greater 1 makes them smaller, while less than 1 makes them bigger.
Visibility seems to Scale Fog but not Object distances. - VisScale is thus used to define:
- ScaledFarFog = level.FarFogDist/level.VisScale
- ScaledNearFog = (level.FarFogDist * Level.VisScale) * BlendMult
- See FarFog Below for more details
-------
Unknown Float - No visible effect
-------
BlendMult is a simple multiplier and used in NearFog calculations.
See FarFog below for details.
-------
Far Fog - Drawing distance. The higher the value the further you can see background generating.
Affected by Visibility.
FarFog = Distance in cm / level.VisScale, eg:
- 15000/1 = 150m to clipping,
- 15000/0.2 = 750m (theoretically Never clip since > 65535)
- Oddly enough this last number excedes the RSP 65535 limit...
Equally oddly was my ability to test this distance at all, in fact, with MoveView you can keep going untill the whole Dam is 5 pixels wide before the N64 crashes.
Manually setting FarFog to 75000 causes large areas to crash the game while in smaller rooms causes a "fisheye-lense" effect in a small square window. gun and hud un-affected.
Setting farfog to 65000 causes a fullscreen fisheye lense effect (Not true fisheye by the way, just odd round edges of screen)
- Both of these effects are caused by an overrun in Signed Short actually causing the farclip to be "behind" the camera.
- Both of these were tested with scale = 1 only
Setting FarFog to 32000 shows screen normal, however dam still crashes.
-Setting scale to 0.5 sets FarClip to 64000, still crash
Setting FarFog to 16000 plays normal and glitch free. Short View.
-Setting scale to 0.25 sets farClip to 64000
Dams default FarFog of 15000 and scale of 0.2 make far-clip 75000 and as everyone knows, dam plays glitch free
setting farfog to 8000 shows screen normal. Even shorter view.
-Setting FogScale at 0.125 sets farclip distance to 64000
-Interestingly "near Fog" starts at 8000, this number is a coincedence since at higher values the near fog is closer.
-Alarm Z-Fights with wall.
FarFog and FogScale need to be ballenced, while 32000 @ VisScale 1 is the same as 16000 @ VisScale 0.5, VisScale adds a bias to the z-Buffer. This means that as VisScale decreases the Near z-buffer looses accuriacy while the far z-buffer increases accuriacy. This is seen in example with the alarm on the wall. At VisScale 0.2, the alarm remains on-top, but at 0.1 the alarm starts to fight with the wall when within 1 meter of the wall.
True "NearFog" is calculated directly from FarFog and BlendMult since:
Setting blendmult to 2.5 brings nearfog to 3000
Setting blendmult to 0.625 brings nearfog to 600
Therefor: Code: |
Nearfog = (FarFog * Level.VisScale)*BlendMult
= (8000 * 0.125) * 2.5 = 2500
= (8000 * 0.125) * 0.625 = 625
= (15000 * 0.2)* 5 = 15000
// test large farfog numbers and scales. Both FarClips are equal however nearfog differs and both crash game.
// Test "Fisheye" farclip
= (65000 * 1 ) * 5 = 325000 // OVERFLOW (-2680 or 62856)
// Test Crashing "normal" number
= (32000 * 0.5)* 5 = 80000 // OVERFLOW (14494)
|
NearFog Calculations must be In-Range, Overflows will crash the game, this is why Sogun noted that large BlendMult values crashed the game.
-------
Near Fog = "Fade Dististance Multiplier" is used in congunction with ObjVisClipMult and FarObjOfusc to blend all objects at certian distance with correct fade-out.
Code: | // Presumed workings for object fading, some parts missing
//Calculate Fade Distance for object
ObjFadeDist = (((Model.BoundingVolRadius / Model.Scale)* Object.Scale)*(FadeDist/111))
// if camera in fade zone, calculate transparency and add to EnvCol
if DistanceToObject >> ObjFadeDist then
//Use EnvCol to store fade transparency
//Unfortunatly models will not be able to use Environment colour register. Use PrimCol instead.
//This was proved to be true as using EnvCol on an object for Colour results in the object always being black.
gDPSetEnvColor(Currentmodel, 0,0,0, INT(255/((ObjClipDist - ObjFadeDist)/(Dist - ObjFadeDist)));
// -- For a working example lets use Clip of 1000 and fade of 800 : 255/((1000-800)/(Dist-800))
// -- Lets say we are standing 900 from object and for simplicity, sums are Pre-Calculated: 255/((200)/(100)) = 128
// -- Assigning an alpha value of 128 to EnvColor will allow the object to be 1/2 transparent.
//Finally Set the rendermode to use a transparent (XLU) mode
gDPSetRenderMode(Currentmodel, G_RM_FOG_PRIM_A, G_RM_AA_ZB_XLU_SURF2);
|
Rare has this value between 0.75 and 0.8 that of MaxObjVis
Or, perhaps MaxObjVis is 1.2-1.3 times that of this value.
Which way round doesnt matter at this point, only that there is a 3:4 ratio between the two though personally I'd go for "FadeMultiplier is 3/4 ObjBoundRadVisClipMultiplier"
Tested, Perfect!
By keeping the 3:4 ratio between FadeMultiplier and ObjBoundRadVisClipMultiplier, objects fade into view nicely even at short distances.
Now to test obfuscation to try to compress large objects into a closer fade distance.
-------
Max Obj Vis = ObjVisClipMult (Object Bounding Volume Radius Multiplier for Far Clip Distance)
This is the Multiplier value for the Object Bounding Radius for use as a Far Clip Distance.
Its usage is, as previously described in the Note on "Near Fog" (the real near fog, Not FadeMult):
ObjClipDist = (((Model.BoundingVolRadius / Model.Scale)* Object.Scale)*(ObjVisClipMult/111))
That is to say, it multiplies the Model Bounding Radius after scaling for each object and culls the model if the distance between the camera and object are greater.
To take the small crate as an example, its bounding radius is 727mm
Scaled to cm thats 72cm.
each "Object" in the setup can have its own scale, leave this at 100% (x1)
The Multiplier itself is divided by 111 (not sure why) so, a value of 1111 = 10
72 * 10 = 720
if camera and crate distance is > 720cm the crate will not draw.
Lets then try another distance multiplier, lets use 4444 as used in dam.
4444/111 = 40 * 72 = 2880 or 28m to cull, again correct.
Dams crates are 1.3x sized. 72*1.3 = 93 * 40 = 3720. This is very close to my original finding, though Id really need to re-test dam without objobfusc
-------
Far Obj Obfusc Dist - If FarObjObfusc = MaxObjVis then all objects cull at maxObjVis.
This overrides the cull distance as calculated before in MaxObjVis, so even objects
that normally cull sooner will cull late and not fade.
if farObjObfusc = 0 then Model.BoundingVolRadius * ScaledMaxObjVis = Cull Dist.
For best results, leave at 0 to let objects fade into view rather than "pop" into view
-------
Near Obj Obfusc Dist - Needs more testing
No Visible changes
-------
Intensity Diff - GE has it always at 0x3E7 (999)
Changing value has no visible effect.
Far Intensity - GE usually has it as 0x3E4 (996), which is maximun value. Minimun value is Surface 2 with 0x3BD (957)
Decreasing it to 0 makes a lot of fog to appear. Seems to be the same as to have Blend Mult to 0.
Making it bigger than 0x3E4 removes fog, but it seems it causes flickering where the "cut" of drawing distance is done, at least in very big maps.
The value doesn't seem to be a distance in hex.
---Concur
Near Intensity - GE has it usually as 0x3E8 (1000). Exception is Bunker 2 with 0x41A (1050)
Making it 0 removes fog. Actually, going lower than 0x3E8 removes fog, while increasing it makes it lighter, until at 0x400 is almost unnoticeable.
If Far Intensity is 0, no matter the value of Near Intensity; fog will reign.
But it seems going higher than 0x3E8 causes flickering where the "cut" of drawing distance is done, at least in very big maps.
----Near Intencity at 3e7 is normal, 007 is foggy at close non foggy far
Cloud Repeat = Cloud / Ceiling Height
This kind of acts as the ceiling of the stage. The lower the value, the closer the clouds (appearing larger). The higher the value, the further away (appearing smaller and more repetitive). I think if the player POV goes above this height, glitching will occur.
Offset Sky Img = Texture used for sky. Default value is 0000. Some other values are valid too:
0001 display a clear sky with small non moving round clouds
0002 display long and thin clouds with animation
0003 and on use game textures with corrupted results. Some might be interesting.
Water Repeat = Water / Bottom Height
Like the Cloud Height, this also acts like the bottom of the stage. When water is toggled on, you'll see it moving higher/lower, easily noticeable in Frigate. However, this value still affects the level when water is not in use. See Cradle for instance. I think Rare set something like -10000.0 on it. If you raise that higher, once the player crosses through the "bottom", graphical glitching occurs. I found this out when setting up Cradle in GoldenEye X.
Water Img Offset = Texture used for water. Valid value is 0002. Other values display as corrupted garbage.
Water Enable - 00 disables water, 01 enables it. You need to enable clouds in order to see water.
Concavity = ....
Kind of hard to describe. Most useful in exterior levels that use clouds. If you try a stage like Streets and lower the concavity to zero, buildings in the background will be obscured by sky and clouds. But if you raise it up, the building shows fine, and clouds show only above them. Again, found this out during GE-X testing. Probably useful for some custom made maps.
Positive concavity values make the world concave and negative convex. Set high enough it will look like a fishlens.
Maybe both these descriptions mean "Clouds meet horizon" where concave means they dont because they bend away while convex means they do since they bend down to horizon?
=========================
Working Tables:
Code: |
Truck Bounding Volume Radius = 4589 *1.09765625= 5037
obrv ob*.2 fmult fobs| fade f-c clip
8888 2076 6666 15570 |
4444 1038 3333 778 600 |
2222 519 1666 389 1200| 2500 5000
2222 519 1666 389 0 |
1111 259 833 194 0 | 3600 1400 5000
1000 N/A 750 N/A 0 | 3500 1076 4576
crate Bounding Volume Radius = 727 *1.296875= 943
obrv ob*.2 fmult fobs| fade F-Clip clip
8888 2076 6666 1557 0 | 1000 7600 8
4444 1038 3333 778 600 | 1000 3900 4
2222 519 1666 389 1200| 500 2000 2
2222 519 1666 389 0 | 1000 3900 ???????????
1111 259 833 194 0 | 683 254 937 1
1000 N/A 750 N/A 0 | 643 233 876 0.9
Drum Bounding Volume Radius = 745 This table is invalid as 2 drums were 2 scales...
obrv ob*.2 fmult fobs| fade clip
8888 2076 6666 1557 0 |
4444 1038 3333 778 600 | 3400
2222 519 1666 389 1200| 850 2500
2222 519 1666 389 0 | 800 2300
1111 259 833 194 0 |
1000 N/A 750 N/A 0 |
Alarm Bounding Volume Radius = 208
obrv ob*.2 fmult fobs| fade f-c clip
8888 2076 6666 1557 0 | 450 1700
4444 1038 3333 778 600 | 300 1300
2222 519 1666 389 1200| 200 1400
2222 519 1666 389 0 | 300 1300
1111 259 833 194 0 | 110 80 190
1000 N/A 750 N/A 0 | 124 51 175 |
last entries show N/A, this was after I realised these numbers had no affect anyway so I ignored them thereafter.
Trev
Last edited by Trevor on Sat Dec 29, 2018 7:49 am; edited 10 times in total |
|
|
|
|
|
 |
 |
 |
 |
 |
Wreck Administrator


Joined: 14 Dec 2005 Posts: 7244 Location: Ontario, Canada  |
Posted: Sat Aug 05, 2017 4:08 pm Post subject: |
 |
|
Thanks for linking this thread when I mentioned the weird fisheye effect happening in another members Cradle mod. I had a couple updates to add here, which may require some further testing to better describe.
Cloud Repeat = Cloud / Ceiling Height
This kind of acts as the ceiling of the stage. The lower the value, the closer the clouds (appearing larger). The higher the value, the further away (appearing smaller and more repetitive). I think if the player POV goes above this height, glitching will occur.
Water Repeat = Water / Bottom Height
Like the Cloud Height, this also acts like the bottom of the stage. When water is toggled on, you'll see it moving higher/lower, easily noticeable in Frigate. However, this value still affects the level when water is not in use. See Cradle for instance. I think Rare set something like -10000.0 on it. If you raise that higher, once the player crosses through the "bottom", graphical glitching occurs. I found this out when setting up Cradle in GoldenEye X.
Concavity = ....
Kind of hard to describe. Most useful in exterior levels that use clouds. If you try a stage like Streets and lower the concavity to zero, buildings in the background will be obscured by sky and clouds. But if you raise it up, the building shows fine, and clouds show only above them. Again, found this out during GE-X testing. Probably useful for some custom made maps. |
|
|
|
|
|
 |
 |
 |
 |
 |
zoinkity 007


Joined: 24 Nov 2005 Posts: 1729
 |
Posted: Sat Aug 05, 2017 5:19 pm Post subject: |
 |
|
From the actual doc on this (NTSC--PAL is different):
Code: | 0x4 4 (float) odd blend multiplier. pervasiveness of fog on rendered surfaces (ie. ground) closer than near fog value. Also affects the z index for the viewport to some degree but not on PAL.
0x8 4 (float) far fog value; beyond this is complete obscurity
0xC 4 (float) near fog value; distance from player to start of fog gradient
0x10 4 (float) max obj vis. range; furthest dist standard (non-door) obj and actors are visible at
0x14 4 (float) obj obfuscation range; objs start to 'fade' at this distance
0x18 4 (float) default 0 min obj vis range; nearest stand. objs are visible at. Always set to zero!
0x1C 4 long default 999 All Objects: difference between near and far ambient light. Intensity, in other words
0x20 4 long default 996 BG: dif. in light. smaller # = foggier near player
0x24 4 long default 1000 far ambient light value value. used with above two values
|
Note that stages 1A, 36, and default omit this block of fog data (0x4-0x24), jumping directly from stage ID to fog colour.
Defaults for water texture are either 1 or 2. You can always change the global textures and add in another one, of course.
Positive concavity values make the world concave and negative convex. Set high enough it will look like a fishlens. _________________ (\_/) Beware
(O.o) ze
(> <) Hoppentruppen! |
|
|
|
|
|
 |
 |
 |
 |
 |
Wreck Administrator


Joined: 14 Dec 2005 Posts: 7244 Location: Ontario, Canada  |
Posted: Sat Aug 05, 2017 5:58 pm Post subject: |
 |
|
I'm really not sure what the "concavity" setting does technically, but the only effect I have personally noticed was to do with the sky + clouds showing through or above level geometry. If I remember correctly, only exterior levels that have clouds toggled on actually use this setting. You'll see a noticeable difference when changing this value to zero. You just have to be aware of what you're looking for (which took me a while to do). Level geometry (buildings or trees) at a distance and how they fade vs. the clouds. Almost seems the clouds may be pushed higher when using this setting somehow. |
|
|
|
|
|
 |
 |
 |
 |
 |
Trevor 007


Joined: 15 Jan 2010 Posts: 926 Location: UK, Friockheim OS:Win11-Dev PerfectGold:Latest  |
Posted: Sun Aug 06, 2017 10:54 am Post subject: |
 |
|
Ive updated the doc with your findings, thanks.
Zoink, I found that
Code: | 0x10 4 (float) max obj vis. range; furthest dist standard (non-door) obj and actors are visible at
0x14 4 (float) obj obfuscation range; objs start to 'fade' at this distance |
are wrong through my own experiments as documented in top post, could you confirm please.
Trev _________________
   |
|
|
|
|
|
 |
 |
 |
 |
 |
Wreck Administrator


Joined: 14 Dec 2005 Posts: 7244 Location: Ontario, Canada  |
Posted: Sun Aug 06, 2017 4:55 pm Post subject: |
 |
|
I can't recall off hand, but the "objfusc" or other obj labelled setting impacts regular objects and secondary draws on doors and such. Bunker ii is a great example of this. Secondary textures will disappear at a certain distance, on doors and crates. Destroyed objects also fade out. I started to notice this in GoldenEye X, when creating a custom sky block for Bunker i, combining aspects of Surface i and Bunker ii.
Some of my info may be more noticeable on console, as not everything is treated quite right via emulation. |
|
|
|
|
|
 |
 |
 |
 |
 |
Trevor 007


Joined: 15 Jan 2010 Posts: 926 Location: UK, Friockheim OS:Win11-Dev PerfectGold:Latest  |
Posted: Mon Aug 07, 2017 2:29 am Post subject: |
 |
|
Wreck wrote: | I can't recall off hand, but the "objfusc" or other obj labelled setting impacts regular objects and secondary draws on doors and such. Bunker ii is a great example of this. Secondary textures will disappear at a certain distance, on doors and crates. Destroyed objects also fade out. I started to notice this in GoldenEye X, when creating a custom sky block for Bunker i, combining aspects of Surface i and Bunker ii.
Some of my info may be more noticeable on console, as not everything is treated quite right via emulation. |
Of course, all docs should be from N64 and not emu therefore I will stipulate that my findings were on real HW.
As for objofusc, can we get actual examples, better yet, if the asm is known please post so we can close this confusing issue.
to re-cap my own experiments:
maxobjvis seemed to be more of a multiplier (lets assume calculated value 10 after all scaling) for the bounding radius
crate at 727 * 10 = clip at 727m
alarm at 100 * 10 = clip at 10m
these were all tested on Dam incase that makes a difference.
Far Objobfusc stopped fading if >= maxobjvis result
if objobfusc < maxobjvis_result then compress fading between the values.
Near ObjObfusc = 0, editing seemed to have no affect.
Trev _________________
   |
|
|
|
|
|
 |
 |
 |
 |
 |
|
 |
 |
 |
 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
 |