Turning Shadows Off

From The DarkMod Wiki
Revision as of 18:01, 15 June 2007 by Springheel (talk | contribs)
Jump to navigationJump to search

There are two basic kinds of shadows when dealing with models--"shadows" and "self-shadows".

Self Shadows

Self shadows are shadows that a model casts upon itself. For example, If a light is above a table, the top of the table will cast a shadow down onto the legs.

Normally, self shadows are good. On some models, however, especially rounded ones like vases or AI, the shadows create ugly jagged triangles of black. For a good explanation of why this happens, see here: http://www.geocities.com/vi_pr/self_shadowing_problem/self_shadowing_problem.htm

In these cases, you should add "noselfshadows" to the material entry for the object's texture.

Adding this means that the object will no longer cast shadows on itself. It also won't cast shadows on OTHER objects with "noselfshadow" on, so use it only when necessary. If you make a table "noselfshadow" and put a vase with "noselfshadow" on top, then the vase will not cast a shadow on the table, which would look odd.

Shadows

Shadows are what objects cast onto the world around them. Normally shadows are good, and you wouldn't want them off by default. There are two cases where you might want to add "noshadows" to an object: One is to increase performance (rendering shadows takes processing time, so turning them off can significantly increase the FPS of your map), and the other is if your object has transparent textures.

Increasing Performance

In general, very complex objects create very complex shadows, requiring more rendering power. If objects are going to be placed somewhere that a shadow wouldn't really be seen, it might be worth turning them off. You may also wish to turn off the dynamic shadow and use a pre-rendered decal to fake it, again to save performance. Turning off shadows this way shouldn't be done by altering the material entry, but by adding the spawnarg "noshadows" to the entity in the editor.

Transparent Textures

D3 does not calculate transparencies when rendering shadows. If you have a rectangular model with the image of a feather on a transparent background, the engine will make a rectangular shadow (see the feather's shadow on the wall is actually a rectangle)

quill.jpg

In cases like this, it might look better if there were no shadow at all, rather than an awkward blocky one. Adding "noshadows" to the material entry would be appropriate in these cases.