CAR SHADOW TUTORIAL

Find here all the Skins of the Community. For more Skins you can go on Carpark : http://www.trackmania-carpark.com/

Moderator: TM-Patrol

User avatar
The Doctor
road tourist
road tourist
Posts: 91
Joined: 20 Sep 2007 16:00
Owned TM-games: United and TMN

CAR SHADOW TUTORIAL

Post by The Doctor » 20 Sep 2007 16:38

If you have been wondering how to make a custom shadow to appear under your car this is the tutorial for you.


Here are some examples of the effects you can accomplish.

ImageImage

ImageImage


What you will need:


1: You will need a way to open and edit and save .dds (Direct Draw Surface) files. Example; Photo Shop with the Nvidia plugin. Paint Shop Pro with its proper Plugin. Gimp is also said to be able to do this as well as "Paint.net". Or you can try some external file converters that can read and write .dds files and use your favorite editor. I will talk about using the Nvidia plugin.
http://developer.nvidia.com/object/nv_t ... tools.html
for using the Nvidia plugin with Paint Shop Pro go here:
http://http.download.nvidia.com/develop ... _Steps.pdf
Paint.Net is available at:
http://www.getpaint.net/

2: There are many flavors of .dds files so I will suggest that you download the WTV.exe viewer available on the Nvidia website because it will tell you what type of .dds file you are viewing. This is important because many of the plugins will default to the last type of .dds file that was saved and will not tell you which type was opened (whether it is a DXT1, DX3, DXT5. With or without an Alpha channel ect.)

3: You will need the original Shadow file for the environment available in the:
(YourDriveLetter):\Program Files\TrackMania Nations ESWC\GameData\Vehicles\Media\Texture\Image.
In United and the other Trackmania games it is just about the same.
Well…This is not truly necessary but it gives you the best chance for a good result.

First a short discussion of Direct Draw Surface files. DDS files are a compressed type of file that is used by video graphics processors (GPUs) to create and manipulate viedo content. They are usually used (but not limited to) in 16 bit increments because of the binary nature of the Compression scheme. This means that the number of pixels in the file is usually divisible by 16 or even 4. For example: 512x512, 512x64, 256x256 or even like icons used in the game 64x64. From what some programmers tell me it is just more efficient.
With this said it is easy to understand why the image files that are used in most games are the way they are.

Upon further investigation it seems that the shadow is stretched to fit the bounding box of the vehicle. Try using a 1: 1.5 ratio. so for stadium that would translate into a 340x512 image or even a 512x768 image would work. Then to make things efficient, resize the image to a 512x512 image (without constraining the proportions). This will make what you see is what you get out of your original image.

When saving a DDS file a set of mipmaps are usually created. Mipmaps are smaller and and smaller versions of the original image that are tacked on to the original image. This technique takes work off the GPU when rendering the image at varying distances and yields superior results. When opening a file to edit however, open it without the mipmaps visible to make things easier on yourself.

Alpha channel:
open a DDS file and you will probably see an alpha channel in addition to the Red Green and Blue channel. An alpha channel is used to store transparency (or really opacity) information in the image. While this is useful in other parts of Trackmania we will be saving the shadow file as a DXT1 No Alpha type.

Now for the How To:

1. Open a shadow file. or create a new file (either 512x512 pixels for Stadium or 256x256 for the other environments). They are located in the (YourHardDrive):\Program Files\TrackMania United\GameData\Vehicles\Media\Texture\Image directory. It seems non standard sizes can be used but the game will take the mipmap that is closest to the right size and either stretch it or squish it.

2. Edit the image: this is where you can be creative. Remember that white (#FFFFFF) is transparent or actually it allows all the light through it.

3. Flip the image horizontally(side to side) retaining the up and down orientation. This is important because the shadow is a projection and will have the text backward if it is not flipped. here is what a finished shadow look like:
Image


4. If you use PhotoShop saving the file as a .psd or if using Paint shop Pro a .psp file first before saving/converting it as a DDS file will make it easier to edit later as it will retain the layers such as text and blending options. If using an external converter it is a good idea to save the file to either a .jpg or .bmp or .tga file. These formats won’t retain layers but are usually supported by the majority of file converters.

5. using the Nvidia plugin for Photo Shop is a snap but save the file as a DXT1 No Alpha file. It is at the top of the list. Make sure the generate mipmaps switch is on.( I'm not sure if this is really necessary but it works well for me)

6. Now how to use the file. Create a skin for your car and save it ingame. Open the zip file it is located in (YourHardDrive):\Documents and Settings\(YOURNAME)\My Documents\TrackMania United\Skins\Vehicles\(WHATEVER ENVIRONMENT) and put the DDS shadow file into it.
Rename that file “ProjShad.dds” . This is important because if it is not named this way the game won’t pick it up and the default shadow will be used. So at the very least there will be:
Diffuse.dds
Icon.dds
ProjShad.dds

If the car skin has the geomerty in it too you can put it in the CarCommon directory. Otherwise it will just put you car skin on the default car for the environment.


7. Now go ingame and start up the vehicle selection in your profile. Note! You do not need to exit the game entirely, just the vehicle selection section for changes to appear. If done correctly your new shadow will appear on the rotating car in the preview.

8. Upload the zipped skin to the web. Make sure you have the proper ports open if you use a router. And your shadow will be visible to everyone who has car shadows turned on.

Note! Here is an interesting glitch that is very annoying to others but worth mentioning. If the graphic continues to the edge and is not bordered by white this is what results.
Image

User avatar
Mac Matrix
solid chaser
solid chaser
Posts: 1264
Joined: 24 Oct 2006 20:31
Owned TM-games: TMS, TMN and TMU. :)
Location: The Centre of Hell. In other words, Britain.

Re: CAR SHADOW TUTORIAL

Post by Mac Matrix » 21 Sep 2007 10:47

As, that explains why my brushes glitch up on my laptop.

(lol)

Posting as probably the guy that started the whole TMN-neon thing I have to say that's a tutorial worth reading (and should get stickied)

There's only one thing I don't understand:
Upon further investigation it seems that the shadow is stretched to fit the bounding box of the vehicle. Try using a 1: 1.5 ratio. so for stadium that would translate into a 340x512 image or even a 512x768 image would work. Then to make things efficient, resize the image to a 512x512 image (without constraining the proportions). This will make what you see is what you get out of your original image.
Is that in relation to using images taken from other files? i.e. the first screenshot?

You also didn't post how to make the 'famed' neon-bar glow but lucky for me I still have psd's of the one I did for my Formula_United car so could I add that on?
System Specs

AMD Phenon 9950 @ 2.85 Ghz
4GB Kingston DDR2 RAM
Gigabyte GA-M750SLI-DS4 mobo
250GB SATA HDD
Gigabyte GTX275 Super Overclock Edition
Logic 3 USB Rumble Pad
Windows 7 Professional 64-Bit

Mac Matrix: Author of the TMN Neon Craze

xturbo
wheelbarrow operator
wheelbarrow operator
Posts: 19
Joined: 04 Nov 2006 13:48

Re: CAR SHADOW TUTORIAL

Post by xturbo » 21 Sep 2007 18:36

cool, bad thing thou that people online wont see it.

User avatar
f*ckfish
Pit Crew
Pit Crew
Posts: 1302
Joined: 15 Jun 2007 07:59
Owned TM-games: TMNF, TMUF
Location: Dresden, Germany
Contact:

Re: CAR SHADOW TUTORIAL

Post by f*ckfish » 21 Sep 2007 19:09

That's not entirely true, if your account is authenticated and you manage to do all the locator and port forwarding stuff there's a good chance for others to see your car and shadows.
inactive, sorry

User avatar
The Doctor
road tourist
road tourist
Posts: 91
Joined: 20 Sep 2007 16:00
Owned TM-games: United and TMN

Re: CAR SHADOW TUTORIAL

Post by The Doctor » 21 Sep 2007 19:30

Excellent qestion and one worth delving into Mac Matrix.
First of all the DDS file for shadows under cars is expected to be square by the program so the graphic should be resized(squished) into a square.
For example:
I take a 256x256 pixel image and make it 256x384 px.
OriginalImage Stretched LongImage
Im streching it so it is 1.5x longer about the proportins of the cars bounding box. If I use this file for my projection the game will pick it up but then errors occur ingame Much the same with the glitch that I reported earlier.Note that i placed a grid on the image so you can see how the file is stretched ingame later.

This is what they look like ingame:
OriginalImage StretchedImage

Ugly.... but notice how the squares of the grid in the second stretched one are still nice and square and not rectangles.
So the solution is to resize the image into a square
OriginalImage Resized LongImage LongImage

Now for the result:
OriginalImage Resized LongImage
Notice how the grid is nice and square in the second one.

I hope this helps to clarify the earlier post. I'll show how to do the Neon bars later but how to do it in a nutshell is to make a square white image. then put rectangles of any color( I suggest black) you want positioned where you want them then use the magic wand and touch the white background. Invert the selection so that the bars are selcted. then feather the selection about 10 pixels or less. use the bucket to fill the selection with whatever color you want.
Done.

xturbo; People can see my shadow just fine. I post it (the skin's Zip file) to the web at an uploader(FileDen for example) then I copy the link and paste it into a text file. I rename it "(Zip file name).zip.loc" and then you put this into the same directory as your skin Zip file on your machine. The game will pick it up and then pass the super small file to other players and then their machine will load it in due course. In order to rename the text file which is called a locator correctly you must have the windows settings for the folders look like this:
Image

As f*ckfish says If you are behind a router you need to Forward ports 2350 and 3450 in TCP-IP and UDP on your router to the IP address of your machine for you to pass the locator to those other palyers.
Last edited by The Doctor on 22 Sep 2007 22:25, edited 1 time in total.

xturbo
wheelbarrow operator
wheelbarrow operator
Posts: 19
Joined: 04 Nov 2006 13:48

Re: CAR SHADOW TUTORIAL

Post by xturbo » 22 Sep 2007 19:09

i know that but now i have another prob, i insert my edited BayCarShadowProj.dds into a my bay car but still the shadow doesent show up, how to fix? i know i can replace files but i want a special color on a special car.

User avatar
T.O.M.
smooth traffic navigator
smooth traffic navigator
Posts: 299
Joined: 15 Mar 2006 13:43
Owned TM-games: TMO,TMS,TMN,TMU
Manialink(s): T.O.M.
Location: Czech Republic

Re: CAR SHADOW TUTORIAL

Post by T.O.M. » 22 Sep 2007 20:08

in any car(if its directly in zip of model) it must have name “ProjShad.dds
MANIAPAGE : T.O.M.
ImageImage
sQs.TrackMania.cz
T.O.M.

User avatar
Mac Matrix
solid chaser
solid chaser
Posts: 1264
Joined: 24 Oct 2006 20:31
Owned TM-games: TMS, TMN and TMU. :)
Location: The Centre of Hell. In other words, Britain.

Re: CAR SHADOW TUTORIAL

Post by Mac Matrix » 22 Sep 2007 20:22

That explains it, yep.
The Doctor wrote:I hope this helps to clarify the earlier post. I'll show how to do the Neon bars later but how to do it in a nutshell is to make a square white image. then put rectangles of any color( I suggest black) you want positioned where you want them then use the magic wand and touch the white background. Invert the selection so that the bars are selcted. then feather the selection about 10 pixels or less. use the bucket to fill the selection with whatever color you want.
Done.
I actually did it another way, and altogether I had about ten layers with different blurs.

I also just added a hue-saturation layer to the top of the photoshop image which controls the color of the 'neon' so it's simple to change the psd image to something such as green, or possibly maybe a multicolored neon if you use more layer masks. O_o
System Specs

AMD Phenon 9950 @ 2.85 Ghz
4GB Kingston DDR2 RAM
Gigabyte GA-M750SLI-DS4 mobo
250GB SATA HDD
Gigabyte GTX275 Super Overclock Edition
Logic 3 USB Rumble Pad
Windows 7 Professional 64-Bit

Mac Matrix: Author of the TMN Neon Craze

UKFC»ACE
smooth traffic navigator
smooth traffic navigator
Posts: 203
Joined: 08 Jun 2007 19:50
Owned TM-games: TMUF, TMNF
Location: Dublin, IRELAND

Re: CAR SHADOW TUTORIAL

Post by UKFC»ACE » 22 Sep 2007 20:33

Great tutorial.

I have a question though. How come the file must be called ProjShad.dds and not StadiumCarShadowProj.dds like it is in the game (TMN) ?? I ask because I want to have red wheels on my car (default tmn car) but when I edit StadiumCarPilot.dds and add it to the zip it doesn't work. I have tried renaming it to Pilot.dds but still won't work. Any ideas?

User avatar
T.O.M.
smooth traffic navigator
smooth traffic navigator
Posts: 299
Joined: 15 Mar 2006 13:43
Owned TM-games: TMO,TMS,TMN,TMU
Manialink(s): T.O.M.
Location: Czech Republic

Re: CAR SHADOW TUTORIAL

Post by T.O.M. » 22 Sep 2007 21:07

Its depends on game "programing" , original shadows (in game directory) are StadiumCarShadowProj.dds BayCarShadowProj.dds becouse the game need to know which shadow is for what ingame original car but in zip its obvious the shadow is for the car in zip , so the name is only ProjShad.dds without the environment specifications.

Pilot.dds - i think it cannot be used becouse of previous game versions (TMo/TMs) there were no pilots... so in TMU is not the possibility to use it in ZIP of new cars...
MANIAPAGE : T.O.M.
ImageImage
sQs.TrackMania.cz
T.O.M.

User avatar
The Doctor
road tourist
road tourist
Posts: 91
Joined: 20 Sep 2007 16:00
Owned TM-games: United and TMN

Re: CAR SHADOW TUTORIAL

Post by The Doctor » 22 Sep 2007 21:34

Ace. you need to edit the details.dds file for the pilot thing to work I think. Nadeo released the files for the Stadium car a while back. I downloaded it but forgot where, but for now(until I edit this post) you can get the stadium car files here.
http://www.fileden.com/files/2006/9/25/ ... iumCar.zip
Im not sure why they included the stadiumcarpilot.dds file in the united release but i suspect it was to make higher quality edits possibe. Like I said earlier GPU's like to use square texture files. edit that file and shove it in to your zip and the game should pick it up.
later----
No that is not right...... I just checked. But it may be that the file I saved it as is incorrect.
Check that... as long as you include the MainbodyHigh.Solid.Gbx file in the zip package along with the details it seems to work.

UKFC»ACE
smooth traffic navigator
smooth traffic navigator
Posts: 203
Joined: 08 Jun 2007 19:50
Owned TM-games: TMUF, TMNF
Location: Dublin, IRELAND

Re: CAR SHADOW TUTORIAL

Post by UKFC»ACE » 23 Sep 2007 11:03

Ty for your help guys. It works fine in TMU but I can't get it to work in TMN. If I include the MainbodyHigh.Solid.Gbx file in my TMN car ZIP the game crashes... lol.

User avatar
T.O.M.
smooth traffic navigator
smooth traffic navigator
Posts: 299
Joined: 15 Mar 2006 13:43
Owned TM-games: TMO,TMS,TMN,TMU
Manialink(s): T.O.M.
Location: Czech Republic

Re: CAR SHADOW TUTORIAL

Post by T.O.M. » 23 Sep 2007 12:48

i think u try use MainbodyHigh.Solid.Gbx from TMU model in TMN ... and thats not possible.. :!:
MANIAPAGE : T.O.M.
ImageImage
sQs.TrackMania.cz
T.O.M.

User avatar
Mac Matrix
solid chaser
solid chaser
Posts: 1264
Joined: 24 Oct 2006 20:31
Owned TM-games: TMS, TMN and TMU. :)
Location: The Centre of Hell. In other words, Britain.

Re: CAR SHADOW TUTORIAL

Post by Mac Matrix » 23 Sep 2007 13:13

The Doctor wrote:Ace. you need to edit the details.dds file for the pilot thing to work I think. Nadeo released the files for the Stadium car a while back. I downloaded it but forgot where, but for now(until I edit this post) you can get the stadium car files here.
http://www.fileden.com/files/2006/9/25/ ... iumCar.zip
Im not sure why they included the stadiumcarpilot.dds file in the united release but i suspect it was to make higher quality edits possibe. Like I said earlier GPU's like to use square texture files. edit that file and shove it in to your zip and the game should pick it up.
later----
No that is not right...... I just checked. But it may be that the file I saved it as is incorrect.
Check that... as long as you include the MainbodyHigh.Solid.Gbx file in the zip package along with the details it seems to work.
well the reason they put the Pilot.dds texture into the Details.dds file on the released Stadiumcar model was because the model couldn't fetch those textures from the game's Stadiumcar folder, but only from the Diffuse or Details image files in the car's zip itself. If they didn't put the wheel and pilot textures in one of those files then there would be no texture on the wheels / driver in-game.

It's much the same as how in custom car models, in either of the files you'll find the textures for the wheels. it's the same reason. It's just good for me that they did it because I was getting annoyed with the fact I couldn't modify the wheel tread.

edit

The released StadiumCar model is TMU only. Unfortunately it causes a crash in TMN, most likely due to the suspension pieces.
System Specs

AMD Phenon 9950 @ 2.85 Ghz
4GB Kingston DDR2 RAM
Gigabyte GA-M750SLI-DS4 mobo
250GB SATA HDD
Gigabyte GTX275 Super Overclock Edition
Logic 3 USB Rumble Pad
Windows 7 Professional 64-Bit

Mac Matrix: Author of the TMN Neon Craze

cow
smooth traffic navigator
smooth traffic navigator
Posts: 216
Joined: 20 Mar 2007 02:53
Owned TM-games: TMU, TMS, TMO
Contact:

Re: CAR SHADOW TUTORIAL

Post by cow » 28 Sep 2007 17:44

awesome doc
MOOOOOOOO of approval.
:pil
join me at the music tower
Tet19's MusicTower

Post Reply