Better Wheel Blur through Bumpmapping

I was fiddling around with editing the normals on a model to help the light play off a spinning wheel. It picks up the specular fine, but it's a pain to work with and apparently can't be done in Blender.

So I looked through how bumpmaps work, and made one that's physically impossible as a flat surface, to produce the effect I wanted.

This texture, used as a bumpmap, represents a 45 degree slope at every point on the plane.
wheelgradient.png


Interestingly, the way this texture is rotated changes the direction of the slope. The way it is now, or a 180 degree rotation, are clockwise/counterclockwise slopes around the centre. Rotating it 90 degrees in either direction produces inward/outward slopes. Other angles end up somewhere in between.

blurwheel3.jpg

This, for example, is the counterclockwise slope. Since it's angled toward the light at the top right, it's brighter, and it's dimmer on the bottom left since it's facing away from the light. The object it's mapped to is flat - the "point" at the centre is entirely a result of the texture.

This is useful, because on a blurred wheel, you effectively have the angled parts of the spokes spreading out into a flat surface, that reflects as if it were at an angle. (I note that brushed metal can also have reflections like this, so maybe this has other applications).

In order to use the effect ingame, I split the wheel into a few layers. The first is plain and simple - flat surfaces. The tire and outer rim of the wheel, as well as the face of the spokes, are flat.
blura.png

A radial blur in the GIMP produces the texture.

Slightly behind that (at roughly the average depth of the sides of the spokes) is the interesting layer. It's mapped to another circular flat surface.
blurbm.png

(this one might be hard to see on the forum, since it's light gray and mostly transparent)
This is a picture of the clockwise-facing polygons of the wheel, flattened out to face the viewer more directly (mostly a matter of making them wider), and blurred similarly to the previous image. This layer gets the bumpmapping from earlier applied - there are actually a pair of these, one clockwise and one counterclockwise, representing the corresponding sides of the spokes. When they catch the light, as in the earlier image of the composite wheel, they light up at an angle from the surface's normals, so you get the proper lighting on the spokes even though they're mapped to a flat object.

Behind these would be the brakes, axle, etc.. - which I didn't model.

The shaders are pretty easy - standard_f/v for the regular surfaces, bump_f/v for the angled ones. I haven't tried with reflections but I expect they would work.

I hope this makes sense, and is useful to someone.

(and then there was more)
To produce the radial gradient, there are 4 compass colours - +red, +green, -red, -green.
Since the bumpmap is expected to be normalized, step 1 is to decide the angle you want (eg. 45 degrees). Take sin/cosine of that angle -> .707/.707. Assuming 0 degrees to be normal (and 90 at a right angle to that), blue is cos and red/green are sin.
rgb triplets for the 4 points are:
+red: (128+128*sin(a), 128, 128+128*cos(a)) = (219, 128, 219)
+green: (128, 128+128*sin(a), 128+128*cos(a)) = (128, 219, 219)
-red: (128-128*sin(a), 128, 128+128*cos(a)) = (36, 128, 219)
-green: (128, 128-128*sin(a), 128+128*cos(a)) = (128, 36, 219)
Once you have these you can just make a gradient with them in that order, counterclockwise. For example, in the image above, I have +red pointing down, then +green pointing right, -red pointing up, -green pointing left.
If you switch them (clockwise) you end up with conflicting directions, and ingame the specular will rotate twice as fast as the wheel, instead of staying still. Easy to fix though, just mirror the texture (if your object is mapped mirrored, you'd need to do this in reverse to compensate, horizontal mirror works fine).
The direction of +red determines what angle to the surface the normals take (I think it's down - clockwise, right - inward, up - counterclockwise, left - outward but I'm not sure).


It's probably possible to combine the transparency of the various spoke parts with the "flat" bumpmap colour (128, 128, 255) to produce a composite bumpmap that handles more than one surface (and would give a single reflection at any point on the wheel instead of blending them ingame) but I don't know whether that's a good idea.


I also had a question. What are the blur models (and corresponding speed to switch) called in car.ini? I couldn't find any reference to it on racer.nl.
 
I still think glass shader needs a fix for 090f, but my attempts at rewriting them were foiled with depth render issues that I don't know how to fix. In simple scenes where you can't see those problems, Racer looks very real to me.

I feel you, at least you've tried...
When looking at Cg code, the fact you have to program with conditions, like for ATI or Nvidia, or when CSM is triggered, that makes things even more complicated...hardcore stuff really !
 
Glass is a pain still really. But Stereo's shader did look right. It just needs Mitch or Ruud to kinda make it work right for all the systems etc I guess... same with the headlight emission shader (that I used on the Lambo, but doesn't work on ATI, grrr)


As per motion blur... there WAS a good one that worked fine in every way. I'm pretty sure I posted a post last night but it's gone now!? Anyway, Racer did have good blur that worked with wheels and didn't blur the car etc, in a past beta... will try find the version and post a video later :D (had one on my iPhone showing it off (never got round to uploading it) but deleted it a month or so ago to free up memory :( )
 

Latest News

Are you buying car setups?

  • Yes

  • No


Results are only viewable after voting.
Back
Top