![]() |
| CAR SHADOW TUTORIAL. |
|
TheDoctor
Project Manager
|
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. ![]()
![]()
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. Paint.Net is an excellent choice. Gimp is also said to be able to do this. Or you can try some external file converters that can read and write .dds files and use your favorite editor. http://developer.nvidia.com/object/nv_texture_tools.html for using the Nvidia plugin with Paint Shop Pro go here: http://http.download.nvidia.com/developer/NVTextureSuite/Paint_Shop_Pro_Steps.pdf 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. 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 in 16 bit increments because of the binary nature of the processing. This means that the number of pixels in the file is usually divisible by 16. For example: 512x512, 512x64, 256x256 or even like icons used in the game 64x64. With this said it is easy to understand why the image files that are used in most games are the way they are. Edit: 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 mip maps 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:
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. 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.
This section of the shadow tutorial ws first posted at the TM-Forum
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. Original Stretched Long
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: Original Stretched
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 Original Resized Long Long
Now for the result: Original Resized Long
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:
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 TheDoctor on Sat Dec 20, 2008 1:20 am; edited 5 times in total |
|||||||||||||||||
|
mario2112
Team [ATS] member
|
Great !
That should be move in the editors thread. |
||||||||||||
|
|
|||||||||||||
| pretty! |
|
[ATP] STEVE0
Trackmaniac
|
ohhhh, thats pretty
|
||||||||||||
|
_________________ http://steve0s-world.myminicity.com/ ![]() |
|||||||||||||
|
[ATP] STEVE0
Trackmaniac
|
could you post some shadows on the forum that we can all download, some that are just [ATP] in general
|
||||||||||||
|
_________________ http://steve0s-world.myminicity.com/ ![]() |
|||||||||||||
| "Animated" skins. |
|
TheDoctor
Project Manager
|
I have figured out a way to make a changing skin and shadow. What I did was to edit the mipmaps for the .dds images for the car. Here is an example:Opalescent Sport Car the shadow could also be animated in the same fashion. This is what I did. 1) I made 5 different Skins and made them different colors. They are basically just square images to start. I did 2048 x 2048 pixels. 2) I saved each file as a .dds file. 3) I loaded them into a editor such as Photoshop and included the MIP maps. The red one looks like this.
4) I then cut part of each mip map(the progressively smaller and smaller suares) and the pasted them together to make something that looks like this.
5) I then Save the result as Diffuse.dds and put it into a zip file with a 64x64 pixel icon and optionally a shadow. finished. You can shade(prelight) and sticker the car in game without changing the color of the mip maps. Why this works: A bit about DDS files. Direct Draw Surface files are a innovation that speeds up frame rates and quality in a game. They do this by figuring out the optimal appearance of an object at varying distances(MIP Maps). An object at a farther distance will use a smaller number of pixels than a closer object. by figuring this out ahead of time that takes alot of workload off the video card and produces sharper rendering and higher frame rates. By editing the mip maps I have made the car change color as the distance to the car changes. This is my workaround. It will also work in sign files and car shadows. But the file won't flip like a frame in a video. You will see part of 2 (or more) different mip maps at the same time. But that can be cool too. ![]() ![]() ![]() ![]() |
||||||||||||||
|
_________________ ![]() |
|||||||||||||||
|
Crawdaddy79
Team [ATS] member
|
Heh. It's actually pretty easy (what I did was use the square tool to modify a skin... so I had a template. Less user error to worry about that way.).
Playing around, here is what I did to my skin: http://www.crawspace.com/ss/videos/TMF_skin_experiment.jpg And a video of zooming in/out. http://www.crawspace.com/ss/videos/TMF_skin_experiment.avi (~8M) (turn down your volume. My onboard sound's recording device is pretty crappy) |
||||||||||||
|
|
|||||||||||||
| CAR SHADOW TUTORIAL. |
|
||
|





Stretched Long
Stretched
Long







