| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
hpl2:tutorials:level_editor:tutorial_6 [2011/10/05 12:35] khyrpa |
hpl2:tutorials:level_editor:tutorial_6 [2011/10/06 15:57] (current) khyrpa [Billboards] |
||
|---|---|---|---|
| Line 6: | Line 6: | ||
| ===== Billboards ===== | ===== Billboards ===== | ||
| + | |||
| + | |||
| + | [[http://www.youtube.com/watch?v=Sw4du21rNqc|Demonstration]] | ||
| Line 23: | Line 26: | ||
| - | Then align your billboards properly into your window. | + | Then align your billboards properly into your window. Some videos about creating billboards. These are done without the connection to light, but the placement should be okay: |
| - | {{http://i1237.photobucket.com/albums/ff478/Khyrpa/WikiTutorial/BB_02.jpg?800x480}} | + | [[http://www.youtube.com/watch?v=Jb0xJRBO2d8&t=3m37s|Office hlp2 level editor[P2] (billboards, lighting)]] |
| + | |||
| + | |||
| + | [[http://www.youtube.com/watch?v=u8EhP59tmjA|Billboard Action Amnesia level editor ]] | ||
| + | |||
| + | |||
| + | {{http://i1237.photobucket.com/albums/ff478/Khyrpa/WikiTutorial/BB_02.jpg?direct&800x480}} | ||
| Line 32: | Line 41: | ||
| - | {{http://i1237.photobucket.com/albums/ff478/Khyrpa/WikiTutorial/BB_03.jpg?800x482}} | + | {{http://i1237.photobucket.com/albums/ff478/Khyrpa/WikiTutorial/BB_03.jpg?direct&800x482}} |
| Line 38: | Line 47: | ||
| - | To create better looking billboards, not all of them should be of the same color, so create another point light and connect the billboards that you think need different colors to other point lights. For simplicitys sake I keep them connected to only 2 point lights. (Colors changed so you can see better what I did) | + | To create nice billboards, not all of them should be of the same color, so create another point light and connect the billboards that you think need different colors to other point lights (here the billboards on the edges were picked). For simplicitys sake I keep them connected to only 2 point lights, but if you think you need more variation go for more. (Colors changed so you can see better what I did) |
| - | {{http://i1237.photobucket.com/albums/ff478/Khyrpa/WikiTutorial/BB_04.jpg?800x479}} | + | {{http://i1237.photobucket.com/albums/ff478/Khyrpa/WikiTutorial/BB_04.jpg?direct&800x479}} |
| Line 50: | Line 59: | ||
| - | [[:http:i1237.photobucket.com:albums:ff478:khyrpa:wikitutorial:bb_05.jpg?direct&}}|{{http://i1237.photobucket.com/albums/ff478/Khyrpa/WikiTutorial/BB_05.jpg}}]] | + | {{http://i1237.photobucket.com/albums/ff478/Khyrpa/WikiTutorial/BB_05.jpg?nolink&}} |
| Line 59: | Line 68: | ||
| - | window_light_bright_1 (spot light with gobo, I want this bright) | + | window_light_bright_1 (spot light with gobo (**Rotate the gobo if its upside down**), I want this bright) |
| - | window_light_bright_2 (point light close to window) | + | window_light_bright_2 (point light close to window, bright also) |
| Line 68: | Line 77: | ||
| - | {{http://i1237.photobucket.com/albums/ff478/Khyrpa/WikiTutorial/BB_06.jpg?800x480}} | + | {{http://i1237.photobucket.com/albums/ff478/Khyrpa/WikiTutorial/BB_06.jpg?direct&800x480}} |
| Line 74: | Line 83: | ||
| - | <code> | + | <code c>void FlickerTimer(string &in asTimer) |
| - | void FlickerTimer(string &in asTimer) { float ftimer = RandFloat(0.6f,1.6f); | + | { |
| - | FadeLightTo("bb_bright", RandFloat(0.2f,0.3f), RandFloat(0.2f,0.35f), RandFloat(0.3f,0.39f), 1, -1, ftimer); | + | float ftimer = RandFloat(0.6f,1.6f); |
| - | FadeLightTo("bb_dark", RandFloat(0.15f,0.29f), RandFloat(0.18f,0.35f), RandFloat(0.35f,0.39f), 1, -1, ftimer); | + | FadeLightTo("bb_bright", RandFloat(0.2f,0.3f), RandFloat(0.2f,0.35f), RandFloat(0.3f,0.39f), 1, -1, ftimer); |
| - | + | FadeLightTo("bb_dark", RandFloat(0.15f,0.29f), RandFloat(0.18f,0.35f), RandFloat(0.35f,0.39f), 1, -1, ftimer); | |
| - | for(int i=0;i<2;i++) FadeLightTo("window_light_bright_"+i, RandFloat(0.55f,0.7f), RandFloat(0.69f,0.8f), RandFloat(0.8f,0.9f), 1, -1, ftimer); | + | for(int i=0;i<2;i++) FadeLightTo("window_light_bright_"+i, RandFloat(0.55f,0.7f), RandFloat(0.69f,0.8f), RandFloat(0.8f,0.9f), 1, -1, ftimer); |
| - | for(int i=0;i<2;i++) FadeLightTo("window_light_dark_"+i, RandFloat(0.4f,0.5f), RandFloat(0.5f,0.6f), RandFloat(0.6f,0.7f), 1, -1, ftimer); | + | for(int i=0;i<2;i++) FadeLightTo("window_light_dark_"+i, RandFloat(0.4f,0.5f), RandFloat(0.5f,0.6f), RandFloat(0.6f,0.7f), 1, -1, ftimer); |
| AddTimer("repeat", ftimer, "FlickerTimer"); | AddTimer("repeat", ftimer, "FlickerTimer"); | ||
| } | } | ||
| Line 89: | Line 98: | ||
| - | {{http://i1237.photobucket.com/albums/ff478/Khyrpa/WikiTutorial/BB_07.jpg?800x483}} | + | {{http://i1237.photobucket.com/albums/ff478/Khyrpa/WikiTutorial/BB_07.jpg?direct&800x483}} |
| - | <code c> | + | |
| + | |||
| + | <code c>void OnEnter() | ||
| + | { | ||
| + | AddTimer("start", 0, "FlickerTimer"); //Starts the loop | ||
| + | SetLocalVarInt("EventInt", 1); //sets the timer to loop case 1 | ||
| + | //Spawn particles to bb_particle_+i areas and fog_particle_+i areas | ||
| + | for(int i=0;i<3;i++) CreateParticleSystemAtEntityExt("blue_particles", "ps_light_dust_large.ps", "bb_particle_"+i, true, 0.6f, 0.75f, 1.0f, 1, true, 1, 2, 8, 11); | ||
| + | for(int i=0;i<3;i++) CreateParticleSystemAtEntityExt("blue_fog_particles", "ps_area_fog.ps", "fog_particle_"+i, true, 0.6f, 0.75f, 1.0f, 0.8f, true, 1, 2, 8, 11); | ||
| + | } | ||
| + | void FlickerTimer(string &in asTimer) | ||
| + | { | ||
| + | //This stores the rand float into VarFloat so the amount can be checked later | ||
| + | SetLocalVarFloat("CheckBrightness", RandFloat(0.20f,0.32f)); | ||
| + | //This takes the random float from VarFloat so it can be easily placed into functions | ||
| + | float fMainColor = GetLocalVarFloat("CheckBrightness"); | ||
| + | //This is the color for the bloody red lights for case 2 | ||
| + | float fBloodColor = RandFloat(0.3f,0.45f); | ||
| + | //This tells how long fading the lights in takes and when the loop timer triggers this again | ||
| + | float ftimer = RandFloat(0.4f,0.7f); | ||
| + | //This switch function is placed here so you can easily control the lights and later if necessary, add more cases to have more control | ||
| + | switch(GetLocalVarInt("EventInt")) | ||
| + | {case 1: //This part loops forever when EventInt is 1 | ||
| + | //These 2 below are for the lights that only control billboards, billboards look brighter than the light source | ||
| + | FadeLightTo("bb_bright", fMainColor+0.08f, fMainColor+0.05, fMainColor+0.1, 1, -1, ftimer); | ||
| + | FadeLightTo("bb_dark", fMainColor+0.01f, fMainColor, fMainColor+0.04, 1, -1, ftimer); | ||
| + | //To get greater sync and effect, I made these to check when the billboards were bright or dark | ||
| + | if(GetLocalVarFloat("CheckBrightness") <0.26f){ | ||
| + | for(int i=0;i<2;i++) FadeLightTo("window_light_bright_"+i, fMainColor+0.22f, fMainColor+0.27f, fMainColor+0.43f, 1, -1, ftimer); | ||
| + | for(int i=0;i<2;i++) FadeLightTo("window_light_dark_"+i, fMainColor+0.13f, fMainColor+0.19f, fMainColor+0.24f, 1, -1, ftimer); | ||
| + | } | ||
| + | //If you dont use something similar to this, the change in lights stay way too small and it can look stupid | ||
| + | if(GetLocalVarFloat("CheckBrightness")>= 0.26f){ | ||
| + | for(int i=0;i<2;i++) FadeLightTo("window_light_bright_"+i, fMainColor+0.31f, fMainColor+0.36f, fMainColor+0.58f, 1, -1, ftimer); | ||
| + | for(int i=0;i<2;i++) FadeLightTo("window_light_dark_"+i, fMainColor+0.2f, fMainColor+0.27f, fMainColor+0.3f, 1, -1, ftimer); | ||
| + | } | ||
| + | break; | ||
| + | case 2: //Changes colors to red when EventInt is 2 | ||
| + | FadeLightTo("bb_bright", fBloodColor+0.08f, fBloodColor-0.3f, fBloodColor-0.3f, 1, -1, ftimer+0.3f); | ||
| + | FadeLightTo("bb_dark", fBloodColor+0.02f, fBloodColor-0.3f, fBloodColor-0.3f, 1, -1, ftimer+0.3f); | ||
| + | for(int i=0;i<2;i++) FadeLightTo("window_light_bright_"+i, fBloodColor+0.28f, fBloodColor-0.3f, fBloodColor-0.3f, 1, -1, ftimer+0.5f); | ||
| + | for(int i=0;i<2;i++) FadeLightTo("window_light_dark_"+i, fBloodColor+0.15f, fBloodColor-0.3f, fBloodColor-0.3f, 1, -1, ftimer+0.5f); | ||
| + | break; | ||
| + | } | ||
| + | //This is the actual loop here, there is nothing that will stop this timer so it will all the time (unless RemoveTimer is used) | ||
| + | AddTimer("repeat", ftimer, "FlickerTimer"); | ||
| + | } | ||
| + | |||
| + | |||
| + | //Below is the script I used to jump to case 2 and red lighting, (Interact callback set inside level editor) | ||
| + | void Touched(string &in asEntity) | ||
| + | { | ||
| + | //Sets EventInt to 2 so case 2: is triggered when the looping timer next time triggers | ||
| + | SetLocalVarInt("EventInt", 2); | ||
| + | //just a quick effect to make things look better for demonstrations sake... | ||
| + | StartScreenShake(0.01f, 0.9f, 0.2f, 0.2f); | ||
| + | //destroyParticles, removes the old light particles outta the way. Takes a long time for the fog to disappear, but I can't help that | ||
| + | DestroyParticleSystem("blue_particles"); | ||
| + | DestroyParticleSystem("blue_fog_particles"); | ||
| + | //create new ones, this had to be placed inside the callback because looping timer would just create new ones ontop each time it loops | ||
| + | for(int i=0;i<3;i++) CreateParticleSystemAtEntityExt("red_particles", "ps_light_dust_large.ps", "bb_particle_"+i, true, 1.0f, 0.1f, 0.1f, 1, true, 1, 2, 8, 11); | ||
| + | for(int i=0;i<3;i++) CreateParticleSystemAtEntityExt("red_particles", "ps_area_fog.ps", "fog_particle_"+i, true, 1.0f, 0.1f, 0.1f, 0.9f, true, 1, 2, 8, 11); | ||
| + | } | ||
| </code> | </code> | ||
| + | |||
| + | |||
| + | So in the end that loop could control all the billboards and lights needed in a map. The flickering effect might be very small buff to levels looks for the headache it could cause, but keeping billboards connected into lights makes changing colors **MILLION ** times more pleasant. It can also be used to for example: cool scares and changing light coming from outside from day to night | ||