ShootersForever.com Forum Index

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


N64 Multi-Part Textures Explained
Goto page 1, 2  Next
 
Post new topic   Reply to topic    ShootersForever.com Forum Index -> Mapping and Modelling
View previous topic :: View next topic  
radorn
007
007


Joined: 23 Sep 2007
Posts: 1424

 PostPosted: Tue Jun 16, 2009 3:56 pm    Post subject: N64 Multi-Part Textures Explained Reply with quote Back to top

OK, this can get quite long, but if you are interested in making textures for GE you should read it, specially if you need to make textures meant to be tiled like in a puzzle.

First let's take a look at how commercial games deal with this with some examples. I'm not very good at graphic editing, so this is done with Paint Razz.



Here we can see an example of 2 textures from Mario 64 that are meant to be put side by side (actually one on top of the other), on different contiguous surfaces.

The first example are the textures ripped from the ROM with toad's tool 64, and tiled toghether in Paint (after a 4x resizing with poin-interpolation). As you can see, they line up perfectly, but when they are displayed in the game, mapped to polygons, something is missing. The last line from each texture is left out of the polygons' surfaces.
This can be seen in the examples from toad's tool and the emulators.
The reason to do this is because of a side effect of the texture filtering.
If you map the texture to a surface so it lines perfectly, at the borders you'll see a glimpse of the oposite side of the texture because how the texture filtering interpolates colors. You can see this in the included sketchup example, where UV mapping doesn't account for this color "bleeding".
At the left and right of the textures you don't see this because these textures are designed loop horizontally in a seamless manner.

In modern 3d renderers the filtering is, usually, very uniform and if you would use N64 style tiled textures (which is unlikely since modern GPUs have a large texture cache and can load large multifeature texture maps like this) you would see that "color bleeding" arround all the borders of the surface if you fit the tiled textures tightly, but a real N64's filtering is not uniform, and only the lowermost and rightmost sides of the texture get the "bleeded" with the color of the neighboring pixels. These neighboring pixels are from the other side of the texture because, internally, the texture warps/loops infinitelly as many times as it's needed (well, actually there's a limit, but that's not important now).

Before I continue, here's another picture to look at, that will serve to demonstrate tiling textures that are properly generated for use in N64 games:



As you can see, they can also be anamorphic, which is a good thing to get the most of the limited texture cache.
Pay attention to how the lowermost and rightmost lines of the textures mirror the uppermost and leftmost lines of their neighboring tiles. While you do the UV mapping, the lowermost and rightmost lines must be LEFT OUT of the surface to avoid color bleeding caused by the interpolation between the oposite sides of the texture. Also, don't forget that the N64's texture filtering is "special" and not uniform. Notice how, in hardware, the "smoothed" texels look like an irregularly streched hexagon, instead of diffuse little points of light like in modern filters.



Now, here's the general explanation of how to make such overlapping tiled textures needed for our beloved N64 (and hence GE). The exact procedure depends on you tools, so I won't be explaining that. For the record, I used MSpaint, and it was a PAIN IN THE ASS to make all this Razz

Let's take this picture as an example:


I took it from the Goldfinger 64 thread, which is what prompted me to make this thread. A 4 part texture was made with 64x32 tiles, but these were non overlapping. Lets take a look at it:



And now for the overlapping one:



It could happen that, in your texture, the final lines in the last textures are important and you don't want to loose them.
Using this same texture as an example, instead of resizing to 127x63, you would resize to 126x62 instead, and, before you cut, you would double the last lines in order to make the whole block 127x63, and then cut like in the example. This way you don't loose the last lines if they are important.

In this tutorial we are making textures from existing pictures and so we resize and stuff, but it's the same if you are drawing them from scratch.

Decide how many tiles and of what size each you are needing and substract 1 pixel for each tile there is in both the X an Y dimensions (except for the last one, depending on what method you intend to use). Draw your texture and cut the overlapping tiles properly and map them well in your models.

Any questions?

If someone could, please, make examples and show the results IN HARDWARE, it would be greatly appreciated, since these examples were painstakingly approximated with PC tools, taking into account the behavior of the texture filteing in them, which differs from N64's.

EDIT: Title changed. I found Wreck's definition to be more clear than my previous "tiled textures" term.
EDIT: Another title change.


Last edited by radorn on Thu Jul 16, 2009 5:42 pm; edited 4 times in total
 
View user's profile Send private message
monkeyface
Moderator
Moderator


Joined: 05 Apr 2008
Posts: 275

 PostPosted: Thu Jun 18, 2009 2:15 am    Post subject: Reply with quote Back to top

Okay, if I understand this correctly, the texture filtering destroys the tiling for textures not adjusted to the N64 interpolation. What I don't quite understand is how to fix this. Scale the texture to separate it 1 pixel from the bottom and the right side? Re-size the texture, make it 31*31? Other than that, really informative. Even though the filter effect is what made N64 (in comparison to Playstation, for example) I'm happy we've moved on, it's rather smudgy...
 
View user's profile Send private message Send e-mail MSN Messenger
radorn
007
007


Joined: 23 Sep 2007
Posts: 1424

 PostPosted: Thu Jun 18, 2009 8:22 am    Post subject: Reply with quote Back to top

Post updated, "tutorial" added Wink
 
View user's profile Send private message
TimEh
Agent
Agent


Joined: 08 May 2009
Posts: 187
Location: oakville. ONT, Canada

 PostPosted: Thu Jun 18, 2009 8:57 am    Post subject: Reply with quote Back to top

wow good eye, seein the double same line. That makes perfect sence though. Separated images on different tris cant blur together so you need to add one line from each to keep the continuation going. cool
 
View user's profile Send private message
radorn
007
007


Joined: 23 Sep 2007
Posts: 1424

 PostPosted: Thu Jun 18, 2009 9:29 am    Post subject: Reply with quote Back to top

It's amazing how you condensed such a long post in a couple of sentences xDDD Wink
I'll consult you for my next one Cool haha
 
View user's profile Send private message
monkeyface
Moderator
Moderator


Joined: 05 Apr 2008
Posts: 275

 PostPosted: Sat Jun 20, 2009 4:48 am    Post subject: Reply with quote Back to top

This is very useful, but it only applies to textures which are supposed to tile with other images, right?
 
View user's profile Send private message Send e-mail MSN Messenger
radorn
007
007


Joined: 23 Sep 2007
Posts: 1424

 PostPosted: Sat Jun 20, 2009 8:14 am    Post subject: Reply with quote Back to top

Well, it can also be applied to other kinds of textures.
Imagine, for example, a portrait of someone. the bottom of the picture is going to end with the chest or neck of that person, and the top of the texture is probably going to have some background colored differently. Unless the texture has a included border, if you fit the texture prefectly to a surface the top of the picture and the leftmost side are going to bleed into the lowermost and rightmost parts of it unless you occlude the last line. For this reason it's better if that last line is a repetition of the last or something else equally prescindible.

Additionally, I would like to add a last note to this subject.
This (ocllude the last lines) method works best with N64's native filtering, but PC GPU's filter somewhat differently, so if you don' expect to use your mod on an n64 (or a future emulator that somehow accounts for this and dynamically shifts uv mapping to adapt it better to emulators on a PC) it may be better to occlude HALF A PIXEL from every side of the texture, intead of a full pixel at the bottom and the right.

I prefer the n64 method since we are mapping for an n64 game after all, but you may have other priorities...
 
View user's profile Send private message
Wreck
Administrator
Administrator


Joined: 14 Dec 2005
Posts: 7197
Location: Ontario, Canada

 PostPosted: Fri Jul 03, 2009 1:13 am    Post subject: Reply with quote Back to top

Excellent information and wonderful examples, Radorn.
I had actually been a bit puzzled by how this works, myself. Looking at the recon photos in each mission folder, as well as the character select images (all taken from the GoldenEditor's Image Tools), I did end up noticing a double-line in there, which made things seem a bit off once put together in Photoshop. By overlapping the images at the side and bottom by a single pixel, it looked much better. I still haven't tested anything yet, but I'm sure this data will be very useful when I do. Smile

Edit: I just fooled around with a picture on my brother's computer. It was the four-parter, like the character select images. After breaking it up into four different sections and sticking them all together, you do have the doubled-up edges. Once you move the lower images up one pixel, and the right images over to the left one pixel, it looks proper - just like the character photos.

What's interesting is that, even though each texture is 64x32, when you add them all together and allign them correctly, your completed image is only 127x63. Or is it 126x62 in-game, since you lose the bottom and right edge from each image? Is the game using only 63x31 of each texture, discarding the bottom and right pixels? That's very important information to have when creating multi-part textures. Thanks again for sharing this with us, Radorn. Smile
_________________

YOUTUBE | FACEBOOK | VAULT | MOD DB | RHDN
 
View user's profile Send private message Visit poster's website
radorn
007
007


Joined: 23 Sep 2007
Posts: 1424

 PostPosted: Fri Jul 10, 2009 2:41 am    Post subject: Reply with quote Back to top

Wreck wrote:
What's interesting is that, even though each texture is 64x32, when you add them all together and allign them correctly, your completed image is only 127x63. Or is it 126x62 in-game, since you lose the bottom and right edge from each image? Is the game using only 63x31 of each texture, discarding the bottom and right pixels? That's very important information to have when creating multi-part textures. Thanks again for sharing this with us, Radorn. Smile


It's not that the game doesn't use the last lines, it's just that, if you try to use them, you'll get the nasty color contamination from the opposite side of the texture, so it's better to do the overlapping doubled lines across the different tiles and do proper UV mapping.
Effectively, for a proper display, you have to sacrifice the rightmost column and lowermost line of each tile of your multipart texture, so the visible area gets reduced by one pixel line and one pixel column for each tile both vertically and horizontally.
A 2x2 tile multipart texture composed of 64x32 textures, would yield a visible area of 126x62 after doing all the work. But to say the game only uses that is inexact.

Of course normal looping textures meant to "paint" large surfaces, such as grass, tiles, wood patterns, etc, properly generated to have their opposite sides match, don't need any of this.
This is just meant for when you need to make large texture maps because they need to be made into multiparts because of the limited texture cache and use of techniques such as mip mapping on the n64.
 
View user's profile Send private message
radorn
007
007


Joined: 23 Sep 2007
Posts: 1424

 PostPosted: Tue Apr 20, 2010 3:37 pm    Post subject: Reply with quote Back to top

Perhaps this thread could be stickied so it's easy to find for those that interested in it.
Saw Trevor at RWP asking about related things.

EDIT: Thanks, magic fairies that stickify threads Very Happy
 
View user's profile Send private message
Trevor
007
007


Joined: 15 Jan 2010
Posts: 926
Location: UK, Friockheim OS:Win11-Dev PerfectGold:Latest

 PostPosted: Sat Sep 25, 2010 3:42 am    Post subject: Reply with quote Back to top

Yay and now Im here Smile

Anyway, the aztech wall tiles, shouldnt the file be 128*48 with the last line of pixles the same as the first on the next image?
The file attributes show as 128*47, bit of a weird number?

If this is a mistake it might explain why the sun one doesn't match up (the one with the circle at the top with rays of light or ribbons comeing from the bottom (Being Aztech Id assume it was a sungod))

Trev
_________________
 
View user's profile Send private message
Trevor
007
007


Joined: 15 Jan 2010
Posts: 926
Location: UK, Friockheim OS:Win11-Dev PerfectGold:Latest

 PostPosted: Tue Jul 09, 2013 3:59 am    Post subject: Reply with quote Back to top

Yeah double post, but its new info.

NEW INFO for Multi-part Texturing : CLAMP

The above tutorial is not wrong, but I have an update to add to it.

You may have heard about Clamping but before now it wasnt known in GE.

However we now have CLAMP.

This changes the tutorial and simplifies it a little.

If you want to have a 128x128x4 image then you need to split the polly into 4 and then split the image into 4 64x64x4 images.

This is where it simplifies:

All you need to do is split the image, apply each to their pollies with UV's of 0,0 and 1,1 and set mtl name to include the word CLAMP.


All blending problems described above should be history and you get an extra pixle for your work Smile


CLAMP Explained:
Clamp takes the last texles of a texture and repeats them indefinatly in all directions.

Beter demonstrated by numbers, here we will asume a 4x1 texture:

Normal:
012301230123

CLAMP:
0123333333

If the texture was in the middle of the poly it would be :
000123333


On the same subject as CLAMP, MIRROR was found.

If mirror is used:
012332100123


All these options are available in PerfectGold 2.5
Just go to Visual, RoomPositions, RtClick a tri, ReplaceTriangle/GroupTexture/Details

Trev
_________________
 
View user's profile Send private message
MultiplayerX
007
007


Joined: 29 Jan 2006
Posts: 1210
Location: USA

 PostPosted: Tue Jul 09, 2013 5:36 am    Post subject: Reply with quote Back to top

this is very useful! That is correct. I actually had to figure this out on my own from changing textures on my Isla Sorna map. many images contain a 4 part split. You have to GRID your textures/ picture (whatever) then cut and make a top, top middle, bottom middle, and bottom piece of that image into four images. SOME images use ONE picture and some even use TWO but the idea is still the same. As for the poly stuff very helpful!

Here's a highly modified AZTEC I did with SORNA:

DOWNLOAD WALK THROUGH XDELTA PATCH:



I will be releasing an almost finished BETA with weapons today . I'm moving and my time is being swallowed with packing Crying or Very sad
_________________
http://codelegends.proboards.com/
 
View user's profile Send private message Visit poster's website
Sogun
General
General


Joined: 15 Dec 2010
Posts: 659
Location: Valencia, Spain

 PostPosted: Tue Jul 09, 2013 5:49 am    Post subject: Reply with quote Back to top

Hi Trevor,

Yeah, the Clamp and Mirror textures features were included in Editor recently. I used them for the Peach's Castle map.

Are you sure the "double line of pixels" isn't needed anymore? Peach's and Bowser's portraits are 4 32x32 colored textures and they have the extra row of pixels in the sides were the images meet.

I think what Clamp does is forget about the other pixels when it comes to texture flitering and "reuses" the one in the sides so there's no bleeding. It actually bleeds but with the same pixel, so you don't notice it. Heh, I don't know how to explain it, I hope everyone understands.

There's another use for Clamp, aside from multi textures. Heh, this one is even harder to explain. All the pixels with UVs higher or lower than [0,1] will have the same color than 0 or 1, so you can "draw" the texture in the middle of a tri and color the gaps with the colors of the texture borders.
If you still don't understand it try to experience it yourself. Model a square (two tris) and set UVs from -1 to 2. Then activate and deactivate Clamp to see what it does.
Peach's Castle uses this kind of Clamp for the "sky" ceilings:
With clamp off:
http://i1185.photobucket.com/albums/z345/Sogunesp/GE_Editor_lightissues2a_zps3a75e5d2.png
http://i1185.photobucket.com/albums/z345/Sogunesp/GE_Editor_lightroom02_zps32a6b77c.png
with clamp on:
http://i1185.photobucket.com/albums/z345/Sogunesp/GE_Promo_CastleKakariko2_zps5077d11e.png
 
View user's profile Send private message Visit poster's website
Trevor
007
007


Joined: 15 Jan 2010
Posts: 926
Location: UK, Friockheim OS:Win11-Dev PerfectGold:Latest

 PostPosted: Tue Jul 09, 2013 12:04 pm    Post subject: Reply with quote Back to top

Yes, Sub and I took a day or two (or was it more...(lol)) to figure out this command back in April-ish
C0 0800020 0 000 DA7

In the end Sub noticed that Zoink had already translated it, however zoink himself writes in code so we couldnt read his doc properly at first.

The end result was (though I cant remember now)
DrawTexture
bitflags for clampS
Bitflags for mirrorS
bitflags for shift S&T (used for Detailmaps)
bitflags for clampT
Bitflags for mirrorT
type 0-4 (Mip-Map, DetailMap, etc)
PrimColor (LOD_Fraction, used for Detailmaps)
Detail Texture
Base Texture



Yes, I am just testing that now (we did at the time but ill confirm again now). You do explain it yourself, clamp 'bleads' on the same texles so isnt noticed anymore.
Without clamp you get lines at joins because the joins are blended with the opposit side of the image.
With clamp the joins shouldnt have lines because there is effectivly no bleading at join.


Oh, to use these commands Sub reminded me its
mtlname followed by:
ClampS
ClampT

MirrorS
MirrorT

the reason they are seperate is so you can mirror x and clamp y etc

Trev
_________________
 
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ShootersForever.com Forum Index -> Mapping and Modelling All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
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

Cobalt 2.0 BB theme/template by Jakob Persson.
Copyright © 2002-2004 Jakob Persson


Powered by BB © 01, 02 BB Group

 


Please Visit My Other Sites: GoldenEyeForever.com | GrandTheftAutoForever.com

Got kids? Check out my Dora The Explorer site with games and coloring pages!

Our forums feature Nintendo 64 games, GoldenEye 007 N64 New Maps and Missions, GoldenEye Cheats, N64 Emulator, Gameshark, GoldenEye Multiplayer and more!

[ Privacy Policy ]