Hey all,
Here's a little tutorial on how it all works.
So, what's important to check before exporting your skinned mesh :
- your mesh should be closed/solid (all vertices merged)
- your skeleton (the root joint) must be at 0,0,0
- your animations are all on the same timeline, one after the other (done it at 24fps)
- your hands animation should start from the left & animate to the extrem right
- be careful with your keys, the more you have, the longer the conversion process into anim file, so just keyframe the joints which really moves at an interval of every 6st frame, so for 1s you have 4 keyframes to set for the desired joints to animate. All depends on how you want to interpolate the keys, the more the smoother/preciser your animation will be.
Once done, select your mesh & export it as usual in ase format. With the Max Racer script, export the skeleton which becomes a Dskeleton ASCII file.
Open Modeler, load ASE file, check Information for your textures, edit name if needed & go to animation. Load skeleton (Dskeleton file exported from Max) & execute "Reduce Tracks" which will get rid of the root joint.
If the whole animation doesn't loop perfectly, cut it (Add button to add a new sequence & choose the start & the end frames in both input boxes). Remember the index number after your sequences names, that's the number to use in car.ini pilot {}.
In car.ini, create :
In steer_range, I've put -900 for a driver hands sequence that animates from the left to the right in the pilot position view (+Z).
Lastly, compile your material file (car.shd) & implement the standard_skinned_f.cg & standard_skinned_v.cg as follow :
Few ideas for future implementations :
steer_left_seq=
steer_right_seq=
steer_idle_seq= (pilot fingers moving slighty)
steer_speed_factor=
For nice drifting pilots anims, we would need something like : (in case we steer quicker ? => some listener to set in code ? )
steer_360_seq=
steer_180_seq=
pedals_throttle&brake_seq= (lol this one...the feet would push both pedals)
if shiftmode=manual
then :
In case we have semi-automatic :
shift_manual_up_seq=
shift_manual_down_seq=
and
gear_1_seq=
gear_2_seq=
gear_3_seq=
gear_4_seq=
gear_5_seq=
gear_6_seq=
.
.
shiftspeed_factor=
throttle_seq=
brake_seq=
handbrake_seq=
clutch_seq=
pedals_speed_factor=
or :
throttle_speed_factor=
brake_speed_factor=
handbrake_speed_factor=
clutch_speed_factor=
idle_pilot_seq= (when he/car stands still => fingers slightly moving)
if we simulate our steering wheels (G25/G27) ingame, we would have 2 red buttons to be mapped :
nos_seq= (we would need a new "nos" particle system + sound + texture) => finger animation
nos_speed_factor=
starter_seq= (left red button on logitech wheels) => left finger animation
starter_speed_factor=
Maybe putting the steering wheel in pilot {} + the e-shifters to align everything easily ?
About Racer limitations of bones, I would increase to 75...2 hands with 3 bones per finger is already 30 bones, so not much place remaining for the rest.
The max script could be updated to convert quicker, same for Modeler Animation when encoding the animation in binary format (anim).
Maybe a easy new feature to implement like DIRT2 :
copilot {}
in animation :
inrace_seq=
idle_seq=
speed_factor=
We could even go further & apply the same to the entity passengers {} where there would be model0, model1, model2 with the 2 same props of copilot etc.. in cases like buses, with the new traffic feature coming out soon, that would be perfect.
Also, we might need some kind of visual debugging ingame (wireframe & wireframephys don't work) for checking bones, normals, skinned mesh !?
Hope it'll help !
Here's a little tutorial on how it all works.
So, what's important to check before exporting your skinned mesh :
- your mesh should be closed/solid (all vertices merged)
- your skeleton (the root joint) must be at 0,0,0
- your animations are all on the same timeline, one after the other (done it at 24fps)
- your hands animation should start from the left & animate to the extrem right
- be careful with your keys, the more you have, the longer the conversion process into anim file, so just keyframe the joints which really moves at an interval of every 6st frame, so for 1s you have 4 keyframes to set for the desired joints to animate. All depends on how you want to interpolate the keys, the more the smoother/preciser your animation will be.
Once done, select your mesh & export it as usual in ase format. With the Max Racer script, export the skeleton which becomes a Dskeleton ASCII file.
Open Modeler, load ASE file, check Information for your textures, edit name if needed & go to animation. Load skeleton (Dskeleton file exported from Max) & execute "Reduce Tracks" which will get rid of the root joint.
If the whole animation doesn't loop perfectly, cut it (Add button to add a new sequence & choose the start & the end frames in both input boxes). Remember the index number after your sequences names, that's the number to use in car.ini pilot {}.
In car.ini, create :
In steer_seq, put your sequence number index from Modeler Animation.pilot
{
body
{
model
{
file=your_driver.dof
offset
{
x=0
y=0
z=0
}
animation
{
; STEERING
; sequence number of steering
steer_seq=0
; Animated steering range in degrees
steer_range=200
; SHIFTING
; 0 is sequential, 1 is manual (manual is NYI)
shiftmode=0
; sequence number of upshift
seq_up_seq=2
; sequence number of downshift
seq_down_seq=1
; How fast to play the animation
shiftspeed_factor=1.5
; blend speed between all animations
blendspeed_factor=10.0
}
}
}
}
In steer_range, I've put -900 for a driver hands sequence that animates from the left to the right in the pilot position view (+Z).
Lastly, compile your material file (car.shd) & implement the standard_skinned_f.cg & standard_skinned_v.cg as follow :
A big thx to Mitch !;==================================
; Vertex/fragment shader templates
;==================================
vf_skin
{
vertex_shader
{
file=standard_skinned_v.cg
}
fragment_shader
{
file=standard_skinned_f.cg
}
}
;=========================
; Racer shaders/materials
;=========================
shader_your_material_name~vf_skin
{
layer0
{
map=your_driver_texture.tga
}
}
;========================================================
Few ideas for future implementations :
steer_left_seq=
steer_right_seq=
steer_idle_seq= (pilot fingers moving slighty)
steer_speed_factor=
For nice drifting pilots anims, we would need something like : (in case we steer quicker ? => some listener to set in code ? )
steer_360_seq=
steer_180_seq=
pedals_throttle&brake_seq= (lol this one...the feet would push both pedals)
if shiftmode=manual
then :
In case we have semi-automatic :
shift_manual_up_seq=
shift_manual_down_seq=
and
gear_1_seq=
gear_2_seq=
gear_3_seq=
gear_4_seq=
gear_5_seq=
gear_6_seq=
.
.
shiftspeed_factor=
throttle_seq=
brake_seq=
handbrake_seq=
clutch_seq=
pedals_speed_factor=
or :
throttle_speed_factor=
brake_speed_factor=
handbrake_speed_factor=
clutch_speed_factor=
idle_pilot_seq= (when he/car stands still => fingers slightly moving)
if we simulate our steering wheels (G25/G27) ingame, we would have 2 red buttons to be mapped :
nos_seq= (we would need a new "nos" particle system + sound + texture) => finger animation
nos_speed_factor=
starter_seq= (left red button on logitech wheels) => left finger animation
starter_speed_factor=
Maybe putting the steering wheel in pilot {} + the e-shifters to align everything easily ?
About Racer limitations of bones, I would increase to 75...2 hands with 3 bones per finger is already 30 bones, so not much place remaining for the rest.
The max script could be updated to convert quicker, same for Modeler Animation when encoding the animation in binary format (anim).
Maybe a easy new feature to implement like DIRT2 :
copilot {}
in animation :
inrace_seq=
idle_seq=
speed_factor=
We could even go further & apply the same to the entity passengers {} where there would be model0, model1, model2 with the 2 same props of copilot etc.. in cases like buses, with the new traffic feature coming out soon, that would be perfect.
Also, we might need some kind of visual debugging ingame (wireframe & wireframephys don't work) for checking bones, normals, skinned mesh !?
Hope it'll help !