Archived

This topic is now archived and is closed to further replies.

HellRaiZer

Lighting without lights!!!!! Dark corners...

Recommended Posts

HellRaiZer    1001
Hey all... First of all let me clear that i haven''t played with shadow algorithms in the past. I know what they do (shadow volumes and shadow maps), i know the basics on how to use them, but i haven''t implemented any of them, so i can''t be sure what exactly they can do!!! All my knowledge on lighting and shadows include static lightmaps and radiosity. Ok, here the question. I was thinking how can i hide a monster (alive-dynamic object) in a dark corner. Imagine a dark room (completely dark), which includes a dynamic-movable object in it. How can i darken the object, so it can be hidden in the shadows. I mean, in a dark room there are no lights from where i can cast shadows, or something. And i think casting dynamic shadows from walls (via stencil shadow volumes, etc.) its not an option, because this will make the system crowl!!!! And lets say that i have a system that can recognise how dark a room is and it can draw model''s polygons applying to them a constant dark color, if the object is in this room. But then what about spots, where light fades to dark (!!!!)? That''s just a thought. Nothing to implement, so any answer acceptable. This is theoritical question!!!! HellRaiZer

Share this post


Link to post
Share on other sites
Basiror    241
by precomputing shadow volume brushes which is very effective but very complex too a simpler method would be checking whether one of the corners of the boundingbox is lightened
otherwise it is hidden

Share this post


Link to post
Share on other sites
JohnBolton    1372
quote:
Original post by HellRaiZer
I was thinking how can i hide a monster (alive-dynamic object) in a dark corner. Imagine a dark room (completely dark), ...


Ummm, if the room is completely dark then you can''t see anything anyway.

You can light the monster with a spot or point light that falls off near the corners of the room.

Share this post


Link to post
Share on other sites
HellRaiZer    1001
This is the question. By default the monster will a colorfull texture, not just black. In a dark room, where darkness has been calculated with, lets say, radiosity, how can i paint my monsters texture (run-time) and make it black. If i don''t paint it, i''ll a floating monster in the middle of nowhere (in case we have a completely dark room)!!!!!! How can i recognise that my monster is in a dark area, so i paint it with some way (which way???) black???

Thanks for the replies. I repeat this is just a theoritical question. No thoughts on implementation yet!!!

HellRaiZer

Share this post


Link to post
Share on other sites
M3d10n    170
You could setup some sorts if "inverse lights". That is, a node that darkens nearby objects. The closer a monster is to that node, the darker it becomes.

Then all you need is to place those by hand around your level, in the shadowed areas.

Not as nice as actual shadow projection, but it can be pretyt fast if done properly.

Share this post


Link to post
Share on other sites
cignox1    735
I think HellRaiZer means something like what we see in Quake. Entities are renedered using flat(gouraud?) shading while static architectures use shadowmaps. Even if they use different ways (one precomputed, the other real-time) if a monster hides in a very dark corner it cannot be seen, since it appears black as the background. The question is, how to draw an entity simulating the amount of light of the enviroment surrounding it?

Share this post


Link to post
Share on other sites
HellRaiZer    1001
cignox1 i think you said it the right way. This is the question actually.

The question is, how to draw an entity simulating the amount of light of the enviroment surrounding it?

And thanks for the gourand shading tip!!!

HellRaiZer

Share this post


Link to post
Share on other sites
OrangyTang    1298
Quake engines use a ''lightgrid'' which is a 3d grid of colour values holding light intensity at every point. They''re spaced at about a foot apart usually, and each model/player is lit by interpolating the vertex colours by the nearest grid values.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
In older Quake engines, each entity is lit based on the light value directly underneath its origin (trace a ray downward until it hits something, use the lightmap from that surface). The models are always shaded as if the light was above and slightly offset to one side, which looks a bit fakey nowadays.

Thief engine uses a raycast from the nearest N light entities to the center of the model. Since you can use the same equations for light attenuation as you use for generating your lightmaps, this can look pretty good. Even better, if you trace to the corners of the bounding box and use a gradient you can have things partially shadowed. You can also use the same light entities for directional lighting (gouraud shading etc).

Quake3 uses a global light grid where light value is calculated and stored at points roughly 64 units (height of a character) apart. It''s faster than the ray trace model but doesn''t account for direction of the light and isn''t very accurate. It also uses a lot of memory.

Share this post


Link to post
Share on other sites
Yann L    1802
quote:
Original post by cignox1
I think HellRaiZer means something like what we see in Quake. Entities are renedered using flat(gouraud?) shading while static architectures use shadowmaps.


Quake uses lightmaps, not shadowmaps. Big difference.

quote:

This is the question. By default the monster will a colorfull texture, not just black. In a dark room, where darkness has been calculated with, lets say, radiosity, how can i paint my monsters texture (run-time) and make it black. If i don''t paint it, i''ll a floating monster in the middle of nowhere (in case we have a completely dark room)!!!!!! How can i recognise that my monster is in a dark area, so i paint it with some way (which way???) black???


Fully dynamic per-pixel shadowing algorithms, such as shadow volumes or shadow maps, will automatically take care of that: you simply draw your scene, monsters, entities, whatever, with the appropriate shadowing model enabled, and everything will end up correctly lit. Even dynamic entities. That''s the cool thing with modern PP lighting and shadowing.

With precomputed methods, such as lightmaps, you need to somehow store the lighting information in a constant grid over the room. You would then render your monsters with that light-grid applied as modulative texture. A very nice approach uses 3D volume lightmaps for that, with the precomputed radiosity of the volume of the room, including static soft shadows. Then you can move your monster through this 3D lightmap, generating the correct texture coordinates at each frame (static 3D lightmap, vertices moving through). The results can be breathtaking, and totally photorealistic, with the inconvenience, that the monster will only receive shadows, not cast them. That''s why this method is best combined with another dynamic per-pixel lighting model (for example with shadowmaps, I did that in my engine, and it works very well together). I don''t know of any commercial game using this technique yet, but the results are really excellent - although the memory consumption can be quite high. It''s more an effect suited for those new 256MB 3D cards.

Share this post


Link to post
Share on other sites
Basiror    241
i hope you don t mind when i add this feature to my engine as well

i think ill do that via a brush based entity
you apply a special texture onto it and the compiler does the rest


thx yann L
hope these cards are released soon :D

Share this post


Link to post
Share on other sites
Andos    124
Why not just make cordinates that represent the lights and make a line of sight algorithm? If there is a path between the monster and the light source, make shadows on the monster more light the closer is is on the point... This would work for multiple light sources as well...

Share this post


Link to post
Share on other sites
Basiror    241
a 3d texture with low resolution would work as good if not even better than your idea

are you really willing to do this line testing ...?

Share this post


Link to post
Share on other sites
HellRaiZer    1001
I must agree that raytracing isn't the best solution. I don't know how Thief handles it, but if it used ray tracing, god, they have fast function for that.
I think the 3d grid is an excellent idea. Where did you get it??? But i have a little question on that. Must i keep an independent 3d grid for all the parts of my level? (part = BSP leaf, Octree leaf etc.) Because, with a global 3d grid, there will be problems with precision (grid pooints lie on an unreachable area...). And with local grids, there will be a problem with memory. At least I think so!!!
And how dense must that grid be? Will it have the same density as the lightmaps??? Or something else. I think smaller density wont affect the visual result, because we have to do with per vertex lighting. It isn't really lightmapping, is it??

Thanks again.

HellRaiZer

[edited by - HellRaiZer on May 29, 2003 2:54:35 AM]

Share this post


Link to post
Share on other sites
Basiror    241
you could create an indexed 3d grid

and define it for indoor rooms via a brush

doing it for the entire map won t work on at all due to memory usage :D a few GBs if my calculations for proper resolutions are correct

Share this post


Link to post
Share on other sites
HellRaiZer    1001
Sorry for my stupid questions.

With indexed grid, what exactly you mean?
And what the hell are those brush i hear everywhere???

Thanks for the attention.

HellRaiZer

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Quake3 engine indeed has a grid across the entire level, even the unreachable areas. This is what makes the level files so ridiculously big sometimes.

Ray casting from point light to a character model is actually pretty cheap in a bsp environment. If you only use the nearest 4 lights or so it''s probably much cheaper than (e.g.) collision detection between the character''s bounding box and the level. AI commonly casts a multitude of rays each frame as well, to determine visibility and sometimes navigation... All instant-hit weapons use rays too. (A shotgun may trace dozens of them every time you fire)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
a brush is another name for entity or object

Share this post


Link to post
Share on other sites