Spring shadows and lighting

Spring shadows and lighting

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Spring shadows and lighting

Post by SpliFF »

I haven't worked with shaders before so I can't quite follow what's happening with the unit shadows.

If I understand it right the attached code works on the vertices written (or about to be written?) to the modelview. Does that mean units can self-shadow or not?

If I change to do a shadow per-piece will this look awful? Are unit models set up to handle this sort of thing? What about per-mesh?

Is it going to be the case that models really need to be designed for self-shadows? What do you think about a per-unit config for shadows (ie, the FBI or model Lua file says whether you want per-unit, per-piece, per-mesh or no shadow for a given unit)?

If this were a good idea, what would the best default be for units that don't specify? Is it different for S3O / 3DO models?

While I'm on the topic, how does sunlight work in Spring? What specifies the global light direction? Does the engine support spotlights at present (i remember a mod demo that gave units headlights, was this an engine feature or very custom)? Come to think of it was it using real lights or just ground decals.

What improvements to lighting/shadows would you like to see? Since I'm planning to rewrite the renderer anyway it seems a good time to sort this out - especially since Assimp allows lighting (even animated lights) to be imported from supported formats.
Last edited by SpliFF on 20 Jan 2010, 05:28, edited 1 time in total.
User avatar
MidKnight
Posts: 2652
Joined: 10 Sep 2008, 03:11

Re: Spring shadows and lighting

Post by MidKnight »

I believe the sun's location is specified in a map's SMD file. I may be wrong, though.
SpliFF wrote:...Assimp allows lighting (even animated lights) to be imported from supported formats.
:|

:oops:
...excuse my drooling.
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: Spring shadows and lighting

Post by SpliFF »

Well...

1.) Don't drool on keyboard, you'll short it out.

2.) I'm not promising anything. I'm only asking so my redesign won't make adding them in the future more difficult than it needs to be, and..

3.) Don't get too excited. Even high-end graphics have limits on the number of dynamic light sources. That kind of thing is better suited to FPS where you can limit the number of light sources through clever map design. However that doesn't really rule out a few super-units with search lights like Terminator's HKs

Image
User avatar
MidKnight
Posts: 2652
Joined: 10 Sep 2008, 03:11

Re: Spring shadows and lighting

Post by MidKnight »

I was thinking of of something more like invisible light sources for more decent unit lighting, but giant floodlights work too. :mrgreen:
SeanHeron
Engines Of War Developer
Posts: 614
Joined: 09 Jun 2005, 23:39

Re: Spring shadows and lighting

Post by SeanHeron »

As MidKnight correctly stated, Sun position is specified by the map (cound't tell you which file though).

And no, the engine does not support dynamic lights - you're probably referring to the "night" wigdet, which does something clever to give the impression of spotlights.

All other questions you'll need someone more into the technicals - I can only say I don't see what would hurt about optional self-shadows (quite the opposite :P).
User avatar
Das Bruce
Posts: 3544
Joined: 23 Nov 2005, 06:16

Re: Spring shadows and lighting

Post by Das Bruce »

SMD has a Sundir variable given as normals, I think.
User avatar
Neddie
Community Lead
Posts: 9406
Joined: 10 Apr 2006, 05:05

Re: Spring shadows and lighting

Post by Neddie »

Das Bruce wrote:SMD has a Sundir variable given as normals, I think.
This is what I remember as well.
User avatar
Das Bruce
Posts: 3544
Joined: 23 Nov 2005, 06:16

Re: Spring shadows and lighting

Post by Das Bruce »

http://springrts.com/wiki/Maps:SMD wrote:

Code: Select all

	[LIGHT]
	{
		SunDir=0 1 2;
		...
	}
Post Reply

Return to “Engine”