Page 1 of 2

sun light in DP

Posted: Sat Apr 14, 2012 9:59 pm
by toneddu2000
Hi guys, do you know if there is the possibility to add a dynamic sun light in Darkplaces Engine? I know that is possible to use q3 shader q3map_sun key but I'd like to use a real dynamic sun, like far cry 2 engine. And, tied to the first question, is it possible to move dynamic lights in dp? For example, linked to an object, so when the object moves even the dynamic light moves and casts dynamic lights. Or linked to a swinging model, so when the model swings all the shadows are dynamically spread on the map (like a map in far cry 1 or doom 3)...groovy :)

thanks in advance

Re: sun light in DP

Posted: Sun Apr 15, 2012 1:16 pm
by Seven
Hello toneddu2000,

I have no answer for you, but I want to lead you to 2 very interesting threads with a quite similar topic.

Please look in here:
http://forums.inside3d.com/viewtopic.php?f=6&t=4355

And here (see youtube clip in 1st post and 2nd post):
http://forums.inside3d.com/viewtopic.php?f=2&t=4274

Good luck.

Re: sun light in DP

Posted: Sun Apr 15, 2012 5:05 pm
by toneddu2000
thank you for your input, Seven. I took a look even at Blood Ominicide code but, with no luck. I'm pretty sure DP can handle dynamic sun lights. Infact if you use r_editlights 1 and, pointing to a light, the light settings mask appears showing an "angles" value. I supposed tweaking angles I could transform a "spotlight" into a direct light, like sun, but altering those values it doesn't set any changes.

Re: sun light in DP

Posted: Sun Apr 15, 2012 7:45 pm
by Spike
the problem with dp's lights is that you cannot configure the lights to cast shadows along parallel planes. That is, such a light will not be a near-infinite distance away from the ground. You might be able to have a high enough sky for it in rooms you make, but you'll see the shadows move weirdly on eg: start.

DP doesn't really do spotlights either. They're just cubemaps with all but one side masked out. They won't help you with realistic shadows.

You can use TENEBRAE_GFX_DLIGHTS to create a movable dynamic light.

self.light_lev = 3000; //really big light
self.color = '0.5 0.5 0.5'; //white light that won't wash out everything else
self.style = 0; //lightstyle, so it doesn't flicker
self.pflags = PFLAGS_FULLDYNAMIC; //so its visible even without a model
self.angles = vectoangles(lightdirection); //rotate the cubemap to face some spot
self.skin = 5; //cubemap number, cubemaps/%i%s.tga where %i is the skin and %s is some pos/neg etc thing.

then give it a think function and get it to move to some spot based upon the result of sin/cos.

like I say, I don't think cubemaps will be that useful to you, other than perhaps for simulating a cloud layer? so you probably want to set skin to 0.

Re: sun light in DP

Posted: Mon Apr 16, 2012 10:46 am
by toneddu2000
Thanks a lot Spike for the clarification about lights and cubemaps, infact I always asked myself what "angles" stands for.
So there's no possibility to create a sun in DarkPlaces, well ok.
I wonder how Blood Omnicide team did the dawn/sunset effect in real time, maybe with a very big light as you pointed.
I'll try with movable lights to do some tests. If I should discover something interesting I'll post it here.

I only didn't understand this
self.skin = 5; //cubemap number, cubemaps/%i%s.tga where %i is the skin and %s is some pos/neg etc thing.
can you please make an example, because I never used cubemaps
thanks

Re: sun light in DP

Posted: Mon Apr 16, 2012 12:04 pm
by Spike
cubemaps on lights can be used for projective texturing. its basically to model a filter or some such around the bulb/lightsource.
the most obvious example is when the lightsource is on the other side of a stained-glass window. with a texture on one side with the rest pure black, you can make it look like the light is shining through the window, when in fact its actually on the near side.
Another use is to project light as if it came from a florescent tube, or 4.
They're really just for projective texturing effects.

Re: sun light in DP

Posted: Mon Apr 16, 2012 6:57 pm
by toneddu2000
ok now I understood. thanks Spike

Re: sun light in DP

Posted: Fri Apr 20, 2012 3:06 pm
by goldenboy
If it can use lightmaps at the same time as dynamic light, you can use static sunlight.

Re: sun light in DP

Posted: Fri Apr 20, 2012 10:32 pm
by toneddu2000
sorry but I didn't get your point, Do you mean by using q3map_sun in Radiant? Yes that would be the alternative. The only problem is that it's static light and doesn't dinamically lit monsters or dynamic objetcs

Re: sun light in DP

Posted: Sat Apr 21, 2012 2:16 pm
by goldenboy
Yes, true. It would be mixed lighting, static and dynamic.

TBH I don't think static vs. dynamic sunlight in outdoor areas would make such a huge difference. Static sunlight will still cast shadows on geometry.

Re: sun light in DP

Posted: Sat Apr 21, 2012 2:47 pm
by toneddu2000
Static sunlight will still cast shadows on geometry.
Are you sure? I always tought that static lights lit only mapping elements (brushes and misc_models) but not characters.
If that you said is true I don't need a dynamic sun!
I'll test it immediately!

Re: sun light in DP

Posted: Sat Apr 21, 2012 6:23 pm
by goldenboy
geometry = brushes etc.

Re: sun light in DP

Posted: Sat Apr 21, 2012 10:46 pm
by toneddu2000
tried. With r_shadows 1 sun casts shadows even on characters but honestly are ugly. I think I don't to use open space on dp, at least until LordHavoc won't create dynamic sun lights! :)

Re: sun light in DP

Posted: Tue May 15, 2012 12:22 pm
by toneddu2000
This is Darkplaces Engine. And this seems to be dynamic! How they did this?! :shock:

Re: sun light in DP

Posted: Wed May 16, 2012 2:30 am
by frag.machine
toneddu2000 wrote:This is Darkplaces Engine. And this seems to be dynamic! How they did this?! :shock:
I'd be happy with just the smooth transition between day/night skyboxes. How can I get this in DP ? Shaders ?