0 registered members (),
1,094
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
sun and dynamic light?
#446728
10/29/14 11:27
10/29/14 11:27
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
I wonder is there any way to get brightness of the surface affected by dynamic light and sun light. F.e. if I trace below player and then check for tex_light (or hit) I can see then, if player is hiding in the shadow or not (lightmap), this could be used to make view entity darker or brighter depending on the surface below player (lets call this fake lightning). I remember one guy from Russian gamestudio community (jd_frost) used view entities for weapons, and via some tricks he was able to get dynamic lights with their colors (sun light as well) affect on view entity, and he didn't use shaders for those, only a trace, some stuff that I do not remember, and he changed view entities colors (I remember this one for sure). The sad thing is, that Russian community webpage is down.. maybe some of you guys have an idea how to return color and brightness of surface affected by dynamic light?
thanks in advance, greets
|
|
|
Re: sun and dynamic light?
[Re: 3run]
#446740
10/29/14 17:04
10/29/14 17:04
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
You could try to iterate over the level enemies (ent_next), find those who have light_range != 0 or whatever it is called, then perform a c_trace every frame or multiple times per second from the camera to those entities (distance checks/ updates every frame, they are relatively cheap) and try to adapt the view entity color that way. You could either use a shader or use a simple and old school MATERIAL where you set material.ambient_red, material.emissive_red and so on manually. I'm not too sure about the correct formula right now but for a start try to set the emissive_blue vector to zero each frame, then add the light (ent.blue ?) of each visible dynamic light source to said material vector but scale it prior to that with some factor like the following:
factor = clamp(1-vec_dist(camera.x,light.x)/light.light_range,0,1);
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
Re: sun and dynamic light?
[Re: MasterQ32]
#446772
10/30/14 13:54
10/30/14 13:54
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
I'm doing this for testing purposes, not because I prefer view entities over world entities for weapons, or so. And I don't really need anyone to tell about what looks better, cause we all do have our own tastes Also you could see your feet This doesn't make your approach better, cause if you won't have good animated models, it will look terrible (I've already told you this before, when you've showed me one of your projects WIP). In my situation, I have no good models, and I'm not the one who can create good ones, so Greets
|
|
|
Re: sun and dynamic light?
[Re: 3run]
#446773
10/30/14 14:09
10/30/14 14:09
|
Joined: Nov 2007
Posts: 2,568 Germany, BW, Stuttgart
MasterQ32
Expert
|
Expert
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
|
This doesn't make your approach better, cause if you won't have good animated models Doesn't this also apply on view models as you can see the models in third person (as the player you see your enemies) So imho it doesn't matter if i see "one more" bad animation if most of the animation is bad.
|
|
|
Re: sun and dynamic light?
[Re: MasterQ32]
#446774
10/30/14 14:11
10/30/14 14:11
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
Doesn't this also apply on view models It doesn't, simply cause I use animated sprites instead of models And there are tons of pretty nice animated (old-school) sprites out there!
|
|
|
|