Jump to content


Photo

Overriding noselfshadows


10 replies to this topic

#1 Springheel

Springheel

    Creative Director (retired)

  • Admin
  • 37250 posts

Posted 21 July 2018 - 02:01 PM

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?

Attached Thumbnails

  • 666.jpg

TDM Missions:   A Score to Settle   *   A Reputation to Uphold   *   A New Job   *    A Matter of Hours
 
Video Series:   Springheel's Modules   *   Speedbuild Challenge   *   New Mappers Workshop  *   Building Traps

#2 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 8869 posts

Posted 21 July 2018 - 02:45 PM

I don't think so.

I recall seeing something about forceShadows as a keyword for lights but I don't think
the code was complete.
Please visit TDM's IndieDB site and help promote the mod:

http://www.indiedb.c...ds/the-dark-mod

(Yeah, shameless promotion... but traffic is traffic folks...)

#3 duzenko

duzenko

    Advanced Member

  • Active Developer
  • PipPipPip
  • 1271 posts

Posted 21 July 2018 - 04:22 PM

That would also mean that multiple AI won't get shadows from each other



#4 stgatilov

stgatilov

    Lead Programmer

  • Active Developer
  • PipPipPip
  • 943 posts

Posted 22 July 2018 - 03:08 AM

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.



#5 Snehk

Snehk

    Member

  • Member
  • PipPip
  • 44 posts

Posted 22 July 2018 - 03:38 AM

Check this wiki article, it might explain it.

http://wiki.thedarkm...e=Noselfshadows
  • stgatilov likes this

#6 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5609 posts

Posted 22 July 2018 - 04:06 AM

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. :(


  • stgatilov likes this
FM's: Builder Roads, Old Habits, Old Habits Rebuild
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#7 Springheel

Springheel

    Creative Director (retired)

  • Admin
  • 37250 posts

Posted 22 July 2018 - 08:12 AM

It's a strange way for it to work, agreed.


TDM Missions:   A Score to Settle   *   A Reputation to Uphold   *   A New Job   *    A Matter of Hours
 
Video Series:   Springheel's Modules   *   Speedbuild Challenge   *   New Mappers Workshop  *   Building Traps

#8 stgatilov

stgatilov

    Lead Programmer

  • Active Developer
  • PipPipPip
  • 943 posts

Posted 22 July 2018 - 08:37 AM

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.



#9 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5609 posts

Posted 22 July 2018 - 11:36 AM

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.


  • duzenko likes this
FM's: Builder Roads, Old Habits, Old Habits Rebuild
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#10 Springheel

Springheel

    Creative Director (retired)

  • Admin
  • 37250 posts

Posted 22 July 2018 - 02:51 PM

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.

Attached Thumbnails

  • 111.jpg

TDM Missions:   A Score to Settle   *   A Reputation to Uphold   *   A New Job   *    A Matter of Hours
 
Video Series:   Springheel's Modules   *   Speedbuild Challenge   *   New Mappers Workshop  *   Building Traps

#11 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5609 posts

Posted 22 July 2018 - 04:17 PM

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


FM's: Builder Roads, Old Habits, Old Habits Rebuild
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users