how to turn off lights


(Qualmi) #1

tried a lot of things (target_kill, scriptcommands, scriptmover with shaders etc), but no success. so how to turn them on/off (via script would be cool) ?

aw: qualmi, use search :mad:

always happens to me :slight_smile:


(kamikazee) #2

So I take it you found a solution? Can you post the link?
If so, someone who happens to enter this thread later on did not completely waste his time but can just click through.


(Qualmi) #3

here what ive found. -->

http://www.splashdamage.com/forums/showthread.php?t=14521&highlight=turn+lights

the problem with this method is that i want to enlight and delight a complete hall. this is ofc much work, but also maybe a performance issue.

ok. here are 2 ideas of mine how to solve this another way. maybe someone can help me with this.

the first idea is to make a shader (which emites light) script_mover and let him disappear. ive tried that, but when i make the script_mover dissapear, the light will still shine on the ground. is the light baken into bsp there ? oO maybe someone can help me, or give me a proper shader.

the second method is my favorite :cool:, but it dont work :frowning: ive made 2 screenshots of that.

the idea is to make the box script_mover and hermetical seal the light entity. the problem is that the light shines still through the box with my tries. someone have an idea. maybe there exist a shader which prevents the light to shine out the box. im not a shaderexpert :confused:

so could someone give me a good shader to this :smiley: i hope it is doable. - would be ugly if this wont work :frowning:


(Pande) #4

Lighting is not saved as entities… it is ‘baked’ as you say into the .bsp in what is called a lightgrid. You can see this grid by trying -dump once when your compiling and it will make the grid files for you to look at.


(Qualmi) #5

damn :frowning:

ok, this method in the thread is the only way i think. to create a lit and a unlit room is definetly not a bad idea. what about performance isues. will it be a performance drop if i make my unlit room in a caulk box somewhere outside the map. imagine, this will not just be a room. this will be a complete hall, quiete big. will this cause fps drops or sth ?


(Pande) #6

How many lights do you have? if the lights displayed in your picture are all that is there, just use dlights. Use the room thing if you have 20+ lights.
you want to avoid brush moving because of course if one player hits switch and another is inside, they will be moved with it, not to mention thrown around like crazy and probably killed.
I would suggest you just use dlights, 60% of your audience is going to be running a computer newer than 2002 and will be able to handle the performance issues. Also note that as long as you don’t set a flicker on the dlight, the fps drop will only occur when the switch is hit, and will last (0.1)-(2) seconds depending on CPU usage and processing speed.

edit: if you are willing to do it, make a new shader for every texture/shader used in the hallway and give it surfaceparm nonsolid, use nodrawnonsolid instead of caulk, and put those shaders in your duplicate room AND the real room and use a func_door with ‘toggle’ (or spawnflags/2) that involves both hallways, and link any models or other entities other than lights to that func_door, and link the func_door to a button. (which i am told is NOT a func_useable or a trigger_multiple, but some func_invisible_user or something)

Next, copy the structural brushes and detail brushes of one of the hallways, make sure its aligned, and caulk it completely. Make ALL stuff in your hallway detail EXCEPT the structural caulk brushes.

Voila.


(Qualmi) #7

hm…dlight aint working with my tries :confused:

and what exactly is the point with the shaders ? isnt it working without too ?


(nUllSkillZ) #8

In the link you’ve mentioned there’s a link to the following tutorial:
Switchable lights tutorial
The link there ien’t working anymore.
But I’ve found the tutorial.

You should also search for “switchable” or “switchable light”.
Might get some results.


(Pande) #9

The point of the new shaders is that they have surfaceparm nonsolid in them, which means the player will go through them. If both the unlit hallway and the lit hallway have them, and the player is held in by the caulk which aligns perfectly with the hallways, then the hallways can be switched without moving the player and it doesn’t matter where you place the switch. Depending on the amount of textures in the room, this can either be a very easy method or a longer one, but in the long run its just a few entities and a copy and pasted shader, like this:

textures/map/nonsolid_texname
{
qer_editorimage textures/map/nonsolid_texname
surfaceparm nonsolid
{
map $lightmap
rgbGen identityLighting
}
{
map textures/map/nonsolid_texname.tga
blendfunc add
}
}

and voila, you have a shader that the player will fall through. That way the func_door can be used to switch the two hallways, and the caulk will hold you in.

Also I might add… if your hallway takes this shape:
------------------ ___________________
|--------------------------|_
----------------------------_
------------------|__________________|

and that bigger rectangle is the hallway you want to change lighting, you can do something without shaders or scripting at all!

Simply have that section move to the left or right of the image I made (so to the players perspective if he were entering the hallway logically: forward or back)

But I doubt your hallway is that simple. It probably goes between two rooms, right?

Edit: ew… what happened to my lines!

Edit2: I put hyphens in instead of spaces for SD because apparently they are against wasted space, so just ignore the hyphens, focus on the solid lines. :slight_smile:


(Qualmi) #10

oh yes ! thats a nice idea !

btw, i will make this not with a switch, ill trigger it via an game event :wink:

lets see what i can do with that. until now i never got killed or sth when i switched the rooms. only got moved a little bit upside down. the players wont probably realize this while playing if they ever play on of those maps with this effect.

and then i will have to try the remapshaderthing (see post nullskillz). will take some time too.

however. keep an eye on Irmgard_1on1. if i will release this map there will probably one of those lighteffects within. lets see how far ill get. some other cool effects will be there too, but wont say too much of it. here a little screenshot. ill promise to do better :slight_smile:

thx for the replies


(Miki) #11

I know that there is a Trick Jump map, where in the beginning, you walk on a stage, and blue-red-green-yellow lights go on-off-on-off… I think the map name was ‘circlejump’, but not sure, trough :slight_smile: Might want to check that out :slight_smile:


(nUllSkillZ) #12

There’s a keyword “lightstyles” as far as I remember.
You could also try to search for that keyword.


(aaa3) #13

after reading qualmis post with the images (i didnt look too deep in the following ones) yes its baked into ur map, called lightmap, at the compile. there is a way u can completely change even very complex lighting in a room or in a smaller area lets say a wall. build an exaxt replica (space button), alter it to be at least 2-3 unit “smaller” (the room’s walls needs to be smaller, and all “box-like” (from this point of view) stuff inside needs to be bigger, i think u get the logic… to have a surface closer to the viewer inside the room) in their inner surface, make all of them nonsolid and detail, make it a mover also, and put it under or above the room, or whereever u have space for it. light the hidden copy-room and have the normal room half-lit or dark or lit in a different colour, whatever u wanna change. then the swith if somebody touches it triggers the illusion-room very ****ing rapidly move “into” the normal-room in place. pushing switch again sends it back to hide.
in this way u wont need to **** with any shaders at all


(Qualmi) #14

yea, we have already discussed this method. better should have read the “following ones” :slight_smile:

however. the room thing is quiete extreme. i have been through 2 tutorials about remapshading instead, but SOMEHOW IT WONT WORK :mad:

to let you know which tutorials i mean ill give you the links:

http://www.map-craft.com/modules.php?name=DLtoTUT&op=TMCgetit&lid=313
http://www.splashdamage.com/forums/showthread.php?t=7795&highlight=remapshader+tutorial

with the first tutorial AND the second tutorial i did completely fail :(. my map is done atm, im only workin on effects now. the last remaining is this one here. so how do i get them to work :confused:

maybe someone is so good and can put up an example map for me with some standard textures and additional shaders, which will then be remapshadered. i can also post the shaders i tried and what ive done. there are also some steps in tutorial 2 i dont understand.

questions about tutorial 2:

there is said

We’ll compile our map, take the resulting lightmap, rename it and put it into our textures directory for our map

i dont know what is meant by “resulting lightmap” here.

All map compiles we will do afterwards will have to be done with -nocollapse in the light phase and best with pretty big lightmaps, 512x512 or even 1024x1024 if you can.

i dont know what are the 512x512 lightmaps here either. also i dont know the compile option -nocollapse. on which compile option do i have to compile minimum to get it work ?

Now we will compile the map again with white light. The thing we now need is a second shader

second shader ok. but why compiling again. this is too big for me :[

in tut 1 i have made everything like it is said there. i have made a target_relay and put the targetshadername and targetshadernewname here. dunno what im doing wrong. do those commands (argetshadername, targetshadernewname) work for et ? never heard them :confused: did someone ever did it to work this way.

so thats all for the moment :smiley: quiete a lot questions i think, but maybe someone can help me to get this to work. all i wanna do is to delight and enlight a hall once. thats “all” :confused:


(Diego) #15

I know you’ve tried this already, but should be able to get the results you need by using an alertentity call on several dlights that illuminate the room/hallway. For practical light sources, like the wall lights, don’t use shaders that cast lights because that will be baked into the lightmap data. Only shaders that make the lights look illuminated. Your switch then can use statestate commands int the script to show/hide a lit/unlit version of those light fixtures as two func_static entities.

But if your already testing big ideas, like swapping out the entire room between 2 different lighting setups, you could try this one:

Convert your room/hallway into an ASE model, then from that to an MD3 model. (An ASE might work ok, but I’ve never tried it). Save 2 copies of your MD3 model. One with Lit textures, the other one with Unlit textures. Then you set the room up as a script mover with the model2 key/value pointing to your md3 models.

When someone hits the switch, use the changemodel commmand in your script to switch between the two models. This is the same way the tank is switched between a broken on running version. I use it for computer consoles. I don’t know how slow it would be on a large room. On my computer consoles it is instantaneous. But you could break up the room into separate walls so that it uses smaller parts.

And with this method, you are not physically moving anything. The script mover can be made out of caulk or clip brushes that are set up as solid so you don’t walk through the model.


(Pande) #16

Only unfortuante thing about using .ase’s as Diego suggest (nice idea btw) is that not all texutre info is saved properly. I tend to make my large more distant mountain terrain without alpha blend because at height it isn’t necessary. So I increase scale of textures as they go higher and highlight certain areas, so it looks like one gigantic texture. I wanted to see what it would be like in fps if I made my terrain into a model, so I did the usual .ase conversion and all my texture scales were reset but the textures appeared shifted, an aweful effect. So if you have anything like that in your room, such as using a 1024 squared image and scaling it down, it will appear off especially I found if it is not axially aligned at 0 degrees or 90 degrees.


(kamikazee) #17

Pande: I think that may differ from one exporter to another. I believe Detoeni made his Alpine Assault’s terrain model as an ASE file and as far as I recall it looked quite nice.


(Tyrlop) #18

ase dont got clip? is it then possible to make sunrise? uhm fade of somekind.


(IndyJones) #19

as far i know all models are nonsolid.


(Diego) #20

Yeah, I originally tried to convert my train to an ASE file but the texture tiling got all messed up. So I went ahead and used blender to convert that ASE into an .OBJ file. Then I imported the .OBJ file into Maya. After re-texturing the model in Maya, I was able to export it to a .MD3 file.

Pain in the butt.