Generating And Setting Up A Car Shadow

Tips, Tricks & Tutorials...

Moderator: VaiDuX461

Generating And Setting Up A Car Shadow

Huki
... as a Newt
Huki
... as a Newt
Joined: 30 Dec 2006, 04:01 PM

5 Apr 2012, 03:22 PM #1

This is a walkthrough on generating and setting up a car shadow for the upcoming v1.2 April release. Following these steps, a custom shadow could be added to your car in under 5 minutes. We will use Blender's plug-in support to automatically get most work done, so a basic understanding of this tool is recommended. If you'd prefer to use another tool, the general steps would still apply although the "5 minute" promise does not hold. ;) Get the Re-Volt plug-in for Blender 2.62 from here before proceeding.

NOTE: If your car is a stock car repaint, you'd rather want to use one of the default shadow presets than generating your own. In that case, you can skip the first 3 steps and go directly to Step 4.

Step 1: Generating the shadow
In Blender, press 'A' to select all objects and remove them using 'Delete' key. Go to 'File -> Import -> Re-Volt' and open the "Parameters.txt" file of your car. This will import the entire car into Blender. All objects should be selected by default (note that shadow will be generated only for the selected objects).

Select the "Object Data" pane in the Properties Window (the triangle icon right pane). See the picture below to locate it.



You'll find the Car Shadow Maker option by scrolling down to the end of this pane (see below picture). Use the 'Create Shadow Polygon' option which would, by default, create a 64x64 texture with a 4 pixel margin (more on this later). Then use the 'Soft Shadow' option, and finally 'Bake Shadow'. This would generate the required shadow map. There is one more option in the Car Shadow Maker panel called 'Get SHADOWTABLE' which you'll use later.



Step 2: Retrieving the shadow texture
To retrieve the generated shadow texture, press 'Shift + F10' in Blender to open the UV / Image Editor. Use the "Browse Image" option (highlighted in the picture below) and select the "shadow.bmp" texture from the popup list.



You'll notice that the shadow is black on a white background, while Re-Volt requires white shadow on black background. You could invert the colours right in Blender, or you could do it later in your image editor. For now, press 'F3' to save the image - the default format is PNG and it can be changed if required.

Step 3: Processing the shadow texture
Now that you have your shadow texture, a little bit of post-processing is required to get it in Re-Volt format. So open up the texture in your favorite image editor such as GIMP.

The first step is obviously to invert the colors to get a white shadow on a black background. As mentioned earlier, this can be done directly in Blender but most car designers would feel more convenient using their own image editor. In GIMP, this can be achieved through 'Colors -> Invert' menu option.

The second step is to apply a little bit of blurring to take care of any aliasing and noise in the texture. A 2-pixel blur should be more than enough for our purpose. In GIMP, use 'Filter -> Blur -> Gaussian Blur' menu option and set both the Horizontal and Vertial Blur Radius to 2px.

And then you're done. Be sure to save the result as BMP. In GIMP you can just use 'File -> Save As' and directly change the file name from "shadow.png" to "shadow.bmp". Picture below shows the original shadow generated by Blender and the final one for use with Re-Volt.



Step 4: Setting up the shadow
This is the last part of the walkthrough. Now you're going to update your car's Parameters.txt file with the following entries to finally add the shadow.

Set the TSHADOW parameter to the path of your shadow texture. This works the same way as setting the TPAGE and TCARBOX parameters.

Code: Select all

;)TSHADOW "cars\stealthxb\shadow.bmp"
If you've NOT generated a custom shadow (i.e., if you plan to use one of the stock car shadows), you should set TSHADOW to "NONE" (or just remove that line), and use the SHADOWINDEX parameter instead. After SHADOWINDEX, set a number from 0 to 27 for one of the stock shadows found in "cars\misc\Shadow.bmp" in your Re-Volt directory.

Code: Select all

;)SHADOWINDEX 0;for RC Bandit shadow
Then you need to position the shadow under the car by setting the offset and height values. Fortunately, Blender's Re-Volt plug-in automatically gets these values for you. Go back into Blender and press the 'Get SHADOWTABLE' option in the Car Shadow Maker panel (you'd remember this from Step 1). This option not only calculates the values for you, but also copies the required Parameters entry into clipboard, ready for use. So just paste it inside your Parameters.txt file below the TSHADOW line.

Code: Select all

;)SHADOWTABLE -39.3 39.4 66.7 -68.2 -5.0
In case you're not using Blender, here's a little more info to help you find these values. The first 4 numbers are the Left, Right, Front and Back edges of the shadow, relative to the model center. You don't have to worry about COM offsets, they are taken into account by the game. The last value is the shadow height, again relative to the model center. A value close to the bottom of the car would do.

Click here to see final result in Re-Volt, on Stealth XB by hi-ban.
Quote
Like
Share

Dave-o-rama
Methanolic
Dave-o-rama
Methanolic
Joined: 7 Jan 2007, 01:35 AM

5 Apr 2012, 05:48 PM #2

And if a car maker, due to lack of sleep, alien attack, or some other random consequence decide not to go through all this for their custom car, will the shadow turn out to be the same square shadow it's always been from day 1?
One must never underestimate the awesome power of food. -BlazBlue: Continuum Shift
Quote
Like
Share

urnemanden
... as a Newt
urnemanden
... as a Newt
Joined: 21 Apr 2008, 05:03 PM

5 Apr 2012, 07:31 PM #3

Wow, that sounds so easy! Thanks for this write-up Huki, I'll make custom shadows to all my custom cars as soon as the new alpha release is around the corner. :)

Jigebren also deserves some credits for making things so easy in Blender through his plug-in!
Quote
Like
Share

Skarma
Everclear-Addict
Skarma
Everclear-Addict
Joined: 20 Jul 2004, 01:05 PM

5 Apr 2012, 11:01 PM #4

Sounds like a nifty thing I could be doing for my massive collection of cars, but I'll probably be too lazy for it.
Quote
Like
Share

jigebren
... as a Newt
jigebren
... as a Newt
Joined: 5 Dec 2009, 11:38 PM

5 Apr 2012, 11:46 PM #5

@Dave
Yes, custom cars with no custom shadow will still use the generic square shadow.

@Urne
Thanks. :) But I have to say I'm actually glad Huki took the time to write this very detailed walkthrough, as I tend to spend more time on my addon development than on its documentation.

@Skarma
Well, think about Huki who did it for all stock cars...
Quote
Like
Share

urnemanden
... as a Newt
urnemanden
... as a Newt
Joined: 21 Apr 2008, 05:03 PM

7 Apr 2012, 10:17 AM #6

I just had a go at generating a car shadow and it takes no time - the tutorial is well written and easy to understand too which helps a lot. I generated a shadow for MOH's Thunder Tiger BX:



Looking forward to the next release so I can try it out in-game. ;)
Quote
Like
Share

MythicMonkey
Alcoholic
Joined: 19 Dec 2011, 12:55 PM

8 Apr 2012, 08:07 AM #7

I'm lovin' these custom shadows. Thanks Huki! :D

urnemanden ~
Shouldn't that image be inverted? :)
Airplane
Quote
Like
Share

urnemanden
... as a Newt
urnemanden
... as a Newt
Joined: 21 Apr 2008, 05:03 PM

8 Apr 2012, 09:01 AM #8

@MythicMonkey: Yes, that picture is just the output from Blender so you are completely right. :)

After post-processing the shadow in GIMP I ended up with this result:

http://i.imgur.com/iW2XD.png
Quote
Like
Share

MythicMonkey
Alcoholic
Joined: 19 Dec 2011, 12:55 PM

8 Apr 2012, 10:21 AM #9

That looks right nice, urne. :)

Here's the one I made for my new car. I figured I would post it here as well. :D



Even though some might say the difference between this and the standard rectangle are small, I sure like the fact that it more closely matches the shape of the vehicle, personally.
Airplane
Quote
Like
Share

Huki
... as a Newt
Huki
... as a Newt
Joined: 30 Dec 2006, 04:01 PM

8 Apr 2012, 01:39 PM #10

For reference, here are the SHADOWTABLE offsets that can be used for the stock car repaints.
// rc
    -37.1 37.1 60.1 -60.1 1.75
// mite
    -39.2 39.2 54.8 -50.2 -2.85
// phat
    -54.0 54.0 58.3 -70.6 -11.73
// col
    -39.8 39.8 56.0 -63.1 -12.15
// harvester
    -44.2 44.2 60.6 -55.0 -21.29
// doc
    -45.0 45.0 57.2 -56.6 -9.37
// volken
    -44.4 44.4 82.6 -72.7 -9.67
// sprinter
    -40.7 40.7 69.9 -73.9 -7.74
// rc san
    -42.5 42.5 56.8 -56.9 -3.77
// candy
    -49.2 49.2 58.5 -59.4 -15.86
// genghis
    -50.4 50.4 71.6 -70.3 -7.88
// aquasonic
    -45.3 45.3 72.2 -81.9 -6.75
// mouse
    -59.9 59.9 66.0 -65.4 -11.14
// evil weasil
    -38.8 38.8 64.5 -62.7 -4.05
// panga tc
    -40.4 40.4 72.0 -80.7 -6.91
// r6
    -34.4 34.4 55.7 -57.1 7.44
// ny54
    -39.7 39.7 66.7 -77.0 -7.74
// bertha
    -56.1 56.2 75.3 -64.7 -25.22
// pest control
    -42.2 42.3 72.6 -79.7 -7.18
// adeon
    -39.6 39.6 77.2 -63.7 -9.90
// polepoz
    -50.7 50.7 57.3 -61.6 -11.70
// zipper
    -40.3 40.3 77.7 -81.0 -6.91
// rotor
    -65.4 65.4 56.1 -57.1 -2.45
// cougar
    -45.9 45.9 72.3 -68.9 -3.04
// humma
    -40.8 40.8 77.3 -65.6 -9.45
// toyeca
    -42.0 42.0 72.5 -68.3 -10.45
// amw
    -46.8 46.8 79.8 -60.0 -9.68
// panga
    -81.1 81.1 82.8 -85.9 -1.19
Quote
Like
Share

MythicMonkey
Alcoholic
Joined: 19 Dec 2011, 12:55 PM

9 Apr 2012, 03:39 PM #11

Yep, those shadows make a right nice addition to the game. Nice one, Huki! :D


Uploaded with ImageShack.us

Let me know if you need me to change that to a thumb...it's only about 83kb, though. :)
Airplane
Quote
Like
Share

Kenny
Methanolic
Kenny
Methanolic
Joined: 1 Jun 2010, 04:18 PM

9 Apr 2012, 05:21 PM #12

Omg you can also do the shadows in color? :o
Then we can do some kind of NFS:Underground mod :lol:

Or maybe some kind of total conversation where you can "tune and upgrade" your cars with different wheels for different underground, spoilers and different kinds of engines... *keeps dreaming*

Btw thats a very nice looking car Mythic, did you already release it? If not then please tell me once you do, I would love to drive it :D
Quote
Like
Share

MythicMonkey
Alcoholic
Joined: 19 Dec 2011, 12:55 PM

9 Apr 2012, 08:17 PM #13

Thanks. :)

No, it's not released quite yet. It keeps expanding...now I'm planning on a separate car with a different skin for every class. Mostly because I've come to like it so much I want a chance to see it no matter what class I decide to race in, lol. That, and I've got like nine different skins now (eleven if you count the two other xbox variants) and I seriously can't decide which one I like more. :D

I am heavily diggin' that xbox one, though...especially now with the tricked out lighting rig. :lol:

I had the bright idea to put the neon tubing that is creating the under-lighting on the shadow as part of the skin underneath the car, but that front bumper thing is actually a separate piece with different mapping than the main underside of the vehicle, so it's kind of getting cut off at the front. I haven't decided whether or not it would be worth the trouble of doing something about it or not. :unsure:
Airplane
Quote
Like
Share

Nieger33@
Regular
Joined: 20 Jan 2012, 03:05 PM

15 May 2012, 12:50 PM #14

Urne what shadowtable is TTBX Buggycar? :huh:

greetings : Nieger33@
RVRO Nieger33@
https://www.box.com/s/db47945d86aad0f928bc Download custom battle tag tracks now!
Quote
Like
Share

urnemanden
... as a Newt
urnemanden
... as a Newt
Joined: 21 Apr 2008, 05:03 PM

15 May 2012, 08:05 PM #15

Nieger33@:

Below I have quoted the code I have written in TTBX's parameters.txt file to get my car shadow to appear in Re-Volt:

Code: Select all

;)TSHADOW "cars\ttbx\shadow.bmp"
;)SHADOWTABLE -46.9 46.9 66.1 -59.7
Hope it works for you!
Quote
Like
Share

Nieger33@
Regular
Joined: 20 Jan 2012, 03:05 PM

16 May 2012, 09:52 AM #16

Thx Urne. Now going create carbox for TTBX buggycar.


greetings : Nieger33@


P.S : Passion he taught me how can create carbox.
RVRO Nieger33@
https://www.box.com/s/db47945d86aad0f928bc Download custom battle tag tracks now!
Quote
Like
Share

MythicMonkey
Alcoholic
Joined: 19 Dec 2011, 12:55 PM

16 May 2012, 12:37 PM #17

P.S : Passion taught me how I can create carboxes.
That's great, Nieger33@! That makes me very happy, my friend. :D

Passion is a very nice person and I am grateful he was able to help you learn that. :)

Mythic
Airplane
Quote
Like
Share

Nieger33@
Regular
Joined: 20 Jan 2012, 03:05 PM

16 May 2012, 05:23 PM #18

Now created carbox for TTBX buggycar





Hope you like it. ;)


greetings : Nieger33@
RVRO Nieger33@
https://www.box.com/s/db47945d86aad0f928bc Download custom battle tag tracks now!
Quote
Like
Share

MythicMonkey
Alcoholic
Joined: 19 Dec 2011, 12:55 PM

17 May 2012, 02:01 AM #19

I do like it! :D

Nice job, Nieger33@! B)

Be sure to let me know if you need help writing the readme files, okay? :)

Mythic
Airplane
Quote
Like
Share

Nieger33@
Regular
Joined: 20 Jan 2012, 03:05 PM

29 May 2012, 03:48 PM #20

Zone Patrol shadow is ready!




Download shadow : https://www.box.com/s/3de8f1352f39f2046bb4


greetings : Nieger33@
RVRO Nieger33@
https://www.box.com/s/db47945d86aad0f928bc Download custom battle tag tracks now!
Quote
Like
Share

MythicMonkey
Alcoholic
Joined: 19 Dec 2011, 12:55 PM

29 May 2012, 05:24 PM #21

Hi Nieger33@ :)

Both the car and the shadow look great, my friend. <smiles> You should post these pictures in one of your own threads, though...in this forum. This thread is meant to be about setting up and creating custom shadows in general, okay?

I only posted a picture of my car in here so people could see what a custom shadow looks like in-game. I'm sorry if this caused you any confusion. :)

Mythic
Airplane
Quote
Like
Share