sun light in DP

Discuss the construction of maps and the tools to create maps for 3D games.
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

sun light in DP

Post 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
Meadow Fun!! - my first commercial game, made with FTEQW game engine
Seven
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Re: sun light in DP

Post 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.
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: sun light in DP

Post 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.
Meadow Fun!! - my first commercial game, made with FTEQW game engine
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: sun light in DP

Post 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.
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: sun light in DP

Post 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
Meadow Fun!! - my first commercial game, made with FTEQW game engine
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: sun light in DP

Post 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.
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: sun light in DP

Post by toneddu2000 »

ok now I understood. thanks Spike
Meadow Fun!! - my first commercial game, made with FTEQW game engine
goldenboy
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel
Contact:

Re: sun light in DP

Post by goldenboy »

If it can use lightmaps at the same time as dynamic light, you can use static sunlight.
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: sun light in DP

Post 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
Meadow Fun!! - my first commercial game, made with FTEQW game engine
goldenboy
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel
Contact:

Re: sun light in DP

Post 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.
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: sun light in DP

Post 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!
Meadow Fun!! - my first commercial game, made with FTEQW game engine
goldenboy
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel
Contact:

Re: sun light in DP

Post by goldenboy »

geometry = brushes etc.
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: sun light in DP

Post 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! :)
Meadow Fun!! - my first commercial game, made with FTEQW game engine
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: sun light in DP

Post by toneddu2000 »

This is Darkplaces Engine. And this seems to be dynamic! How they did this?! :shock:
Meadow Fun!! - my first commercial game, made with FTEQW game engine
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Re: sun light in DP

Post 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 ?
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
Post Reply