It is currently Sat Jan 20, 2018 1:47 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: N2k3 LODs
PostPosted: Tue May 16, 2006 10:53 pm 
Offline
US Pits Crew
US Pits Crew
User avatar

Joined: Fri Apr 29, 2005 3:28 pm
Posts: 2251
Location: Tulsa, Oklahoma
I've had a couple of recent questions come up about LODs for N2k3. While I've answere those questions specifically, I thought it migh be worth posting a little blurb here with a comment or two on what was being done and why.

Below is a sample of the LOD buildup for TPTCC 2.x Under the code I'll do a quick explanation as to how this would be done with damage.

Code:
# Make Groups (Each Exterior Group makes up an LOD for that Make, So Make0 has 3 LODs while Make1 has 7)
#     The LODs are repeated to create all 11 LOD distance switches that are hard coded in N2k3.

# Make 0
Exterior1_make0: GROUP (driverSwitch_make0, wheelSwitch_make0, lfmake0, rfmake0, lrmake0, rrmake0, bcg1_make0)
Exterior2_make0: GROUP (external_driver_static_make0, lfmake0, rfmake0, lrmake0, rrmake0, bcg2_make0)
Exterior3_make0: GROUP (body3_make0)

# Make 1
Exterior1_make1: GROUP (driverSwitch_make1, wheelSwitch_make1, lfmake1, rfmake1, lrmake1, rrmake1, body1_make1, chassis1_make1, glass1_make1)
Exterior2_make1: GROUP (driverSwitch_make1, wheelSwitch_make1, lfmake1, rfmake1, lrmake1, rrmake1, body2_make1, chassis1_make1, glass1_make1)
Exterior3_make1: GROUP (driverSwitch_make1, wheelSwitch_make1, lfmake1, rfmake1, lrmake1, rrmake1, body3_make1, chassis1_make1, glass1_make1)
Exterior4_make1: GROUP (external_driver_static_make1, lfmake1, rfmake1, lrmake1, rrmake1, body4_make1, chassis1_make1, glass1_make1)
Exterior5_make1: GROUP (external_driver_static_make1, lfmake1, rfmake1, lrmake1, rrmake1, body5_make1, chassis1_make1, glass1_make1)
Exterior6_make1: GROUP (external_driver_static_make1, lfmake1, rfmake1, lrmake1, rrmake1, body6_make1, chassis1_make1, glass1_make1)
Exterior7_make1: GROUP (body7_make1)

# Make 2
Exterior1_make2: GROUP (driverSwitch_make2, wheelSwitch_make2, lfmake2, rfmake2, lrmake2, rrmake2, bcg1_make2)
Exterior2_make2: GROUP (external_driver_static_make2, lfmake2, rfmake2, lrmake2, rrmake2, bcg2_make2)
Exterior3_make2: GROUP (body3_make2)

# Make 3
Exterior1_make3: GROUP (driverSwitch_make3, wheelSwitch_make3, lfmake3, rfmake3, lrmake3, rrmake3, bcg1_make3)
Exterior2_make3: GROUP (external_driver_static_make3, lfmake3, rfmake3, lrmake3, rrmake3, bcg2_make3)
Exterior3_make3: GROUP (body3_make3)


# Make State Swithes (Creating 11 of the carMakeIdx switches, one for each LOD).
extLOD1: STATE_SWITCH Var carMakeIdx (0 Exterior1_make0,1 Exterior1_make1,2 Exterior1_make2,3 Exterior1_make3, 4)
extLOD2: STATE_SWITCH Var carMakeIdx (0 Exterior1_make0,1 Exterior1_make1,2 Exterior1_make2,3 Exterior1_make3, 4)
extLOD3: STATE_SWITCH Var carMakeIdx (0 Exterior1_make0,1 Exterior2_make1,2 Exterior1_make2,3 Exterior1_make3, 4)
extLOD4: STATE_SWITCH Var carMakeIdx (0 Exterior1_make0,1 Exterior3_make1,2 Exterior1_make2,3 Exterior1_make3, 4)
extLOD5: STATE_SWITCH Var carMakeIdx (0 Exterior2_make0,1 Exterior3_make1,2 Exterior2_make2,3 Exterior2_make3, 4)
extLOD6: STATE_SWITCH Var carMakeIdx (0 Exterior2_make0,1 Exterior4_make1,2 Exterior2_make2,3 Exterior2_make3, 4)
extLOD7: STATE_SWITCH Var carMakeIdx (0 Exterior2_make0,1 Exterior5_make1,2 Exterior2_make2,3 Exterior2_make3, 4)
extLOD8: STATE_SWITCH Var carMakeIdx (0 Exterior2_make0,1 Exterior5_make1,2 Exterior2_make2,3 Exterior2_make3, 4)
extLOD9: STATE_SWITCH Var carMakeIdx (0 Exterior2_make0,1 Exterior6_make1,2 Exterior2_make2,3 Exterior2_make3, 4)
extLOD10: STATE_SWITCH Var carMakeIdx (0 Exterior2_make0,1 Exterior6_make1,2 Exterior2_make2,3 Exterior2_make3, 4)
extLOD11: STATE_SWITCH Var carMakeIdx (0 Exterior3_make0,1 Exterior7_make1,2 Exterior3_make2,3 Exterior3_make3, 4)

# LODs
extView_makes:    STATIC_LOD extMinMax POS(0,0,0) (0 extLOD1, 2 extLOD2, 4.5 extLOD3, 6.8 extLOD4, 9.2 extLOD5, 12.3 extLOD6, 16.4 extLOD7, 20.9 extLOD8, 30.5 extLOD9, 48.2 extLOD10, 70 extLOD11)


The first four sections of groupings is where I put together the car for each of the LODs being built. In the case of Make0 (the Corvette), there were three basic meshes, so I created three groups and added in the wheels, driver, etc. For Make1 (the Viper), Michael built 7 meshes total for the main car, and thus 7 groups are built.

The next section is where I build the carMakeIdx switches for each of the LODs. If you look at each of the switches, you'll see how the three or seven actual LODs are duplicated from one switch to the next in order to create 11 occurances for the 11 LODs that are hard coded in N2k3.

If you have damage models coded up, you would basically duplicate the above code for each of the damage levels that are being used (level 1 damage being a vehicle with bent panels only, level 2 damage being a vehicle with bent and removed panels). Once you had your LOD switches for undamaged and damaged built, you would then include them in a state switch with variable "damaged".




As time permits, I'll be posting some more N2k3 psg scripting information here, as well as some other rFactor vehicle modding info. I do have some hopefully helpful info on N2k3 damage scripting, along with a couple of tricks that both Michael (Cynical Saint) and myself developed to take the damage to the next level (unfortunately things never got finalized for all of the makes, and thus there was no damage release for TPTCC). I'll also share how I moved backfires around and a few other little tricks that we came up with during development.

_________________
Tah Tah For Now!
Scott Stockton

www.theuspits.com

"I can do all things through Christ who strengthens me."  Phil 4:13


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group