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

    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
    • nbohr1more

      Please vote in the 15th Anniversary Contest Theme Poll
       
      · 0 replies
×
×
  • Create New...