Jump to content
The Dark Mod Forums

Overriding noselfshadows


Springheel

Recommended Posts

I've got a situation in a map where there are papers scattered on the floor. These paper models use default paper textures that have "noselfshadow" in the material stage. When an AI that also has "noselfshadow" set walks over the papers, the floor gets a cast shadow from the AI, but the paper doesn't.

 

I realize I could make a custom material that removes the "noselfshadow" for the paper textures, but is there any spawnarg that can force an entity to cast (and more importantly receive) shadows?

post-9-0-92021700-1532199680_thumb.jpg

Link to comment
Share on other sites

From iddevnet:

noShadows         Don't cast shadows

noSelfShadow      This material doesn't cast shadows on the model it's on (but it does on other models)

forceShadows          Allows nodraw surfaces to cast shadows

Could someone explain me why "noselfshadow" objects don't receive shadows from other entities?

It does not follow from the name, and does not follow from description.

Link to comment
Share on other sites

Some of the shadowmesh materials used on ai (for example the forger or the priest) have noselfshadows set in their material defs. Hence, from the description linked by Snehk, they won't cast shadows on surfaces using noselfshadow materials, too. It appears that this effect is not caused via some condition in the code, but is a direct effect of the way how the renderer operates, so it is unlikely that this will be changeable that easely.

 

I agree with stgatilov that the naming isn't very intuitive here, as it implies that an object does not cast shadows on itself, but doesn't imply that it also affects how it will relate to shadows cast on other entities or the shadows it receives from them. :(

  • Like 1

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

In the current implementation noselfshadows is a hack, meaning that bad consequences happen at some moment.

 

In order to implement a 'correct" noselfshadow rendering, it is necessary (while rendering every such object) to have all shadow volumes in stencil buffer except the volumes cast by the object itself.

For an efficient implementation of such feature, it is necessary to not only add shadow volumes into stencil buffer, but also subtract them.

 

On the other hand, isn't it possible?

Render all shadows into stencil buffer first, then render all normal objects, then for each noselfshadows object: render its shadow volume in "subtract" mode, then render the object to frame, then render same shadow volume in "add" mode.

This is not very efficient of course :D

 

Anyway, I guess it is possible to add something like forceSelfShadows, but it will probably make things even more complicated.

Link to comment
Share on other sites

In this case the easiest approach is probably to change the material used on the paper from noselfshadows to noshadows. This way it doesn't cast shadows on its own (and therefore not on itself), but will receive shadows.

 

I would assume that noSelfShadows is mainly intented for models with rather complex shadowmeshes or for those who are moving all the time, like on ai. This isn't really the case for such a small object like a paper.

  • Like 1

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

In this case the easiest approach is probably to change the material used on the paper from noselfshadows to noshadows. This way it doesn't cast shadows on its own (and therefore not on itself), but will receive shadows.

 

I would assume that noSelfShadows is mainly intented for models with rather complex shadowmeshes or for those who are moving all the time, like on ai. This isn't really the case for such a small object like a paper.

 

The only cases noselfshadow is (or at least should be) used is on rounded objects with no shadowmesh, where normalmaps make the appearance of a smooth curve but triangles of shadow can be cast by the corners of polys. Kind of an oversimplified image below, but even though the blue polys that stick up are smoothed to look like a curve (red), the shadows they cast are still sharp triangles, which ruins the illusion especially when they fall on the object itself.

 

In this case, I assume the keyword was originally added for rounded scrolls.

post-9-0-35985200-1532289125.jpg

Link to comment
Share on other sites

That's another possibility I haven't thought of. Good catch.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 6 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
×
×
  • Create New...