Jump to content


Photo

Hanging light model question


65 replies to this topic

#1 duzenko

duzenko

    Advanced Member

  • Active Developer
  • PipPipPip
  • 1976 posts

Posted 22 November 2018 - 02:58 PM

@Nbohr1more has pointed out a strange visual glitch with the hanging light model: models/darkmod/lights/extinguishable/cagelamp_hanging.lwo

It's casting unwanted shadows when in the shadow maps mode.

It has two surfaces:

  • main surface with material tdm_streetlamp_metal which is noshadows - this one is OK
  • bottom of the holder with material tdm_coals_hot - this one is supposed to cast shadows but for some reason it's not casting shadows in stencil mode - it looks as if the surface is deemed back-facing by stencil code even though it's clearly front-facing to the light view.

I would appreciate anyone shedding some light on why the bottom surface is getting culled with stencil - is it a renderer bug or am I missing something? Maybe something's special about the model itself?

 

The map in question is NHAT (anoot.map)



#2 Springheel

Springheel

    Creative Director (retired)

  • Admin
  • 37633 posts

Posted 22 November 2018 - 09:18 PM

I don't see anything special about the model.  You're sure it's not the entity that is forcing noshadows on?


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

#3 duzenko

duzenko

    Advanced Member

  • Active Developer
  • PipPipPip
  • 1976 posts

Posted 23 November 2018 - 01:53 AM

The entity seems to not have that spawnarg

#4 duzenko

duzenko

    Advanced Member

  • Active Developer
  • PipPipPip
  • 1976 posts

Posted 23 November 2018 - 02:47 PM

Sorry, I think the model needs a fix

Either the small surface needs a no-shadow material, or the entire entity a no-shadow spawn arg.

It's not casting stencil shadows because apparently stencil shadows are sometimes only based on back faces. And the model kinda exploits that by having front faces in one material and back faces in another.



#5 Bikerdude

Bikerdude

    Member

  • Banned
  • PipPipPipPipPip
  • 20320 posts

Posted 24 November 2018 - 05:49 AM

I was the last person to work on that map, but it sounds like its an issue with the entity. Can you give me the exact entity name and location and I will copy and paste that into a test map..



#6 duzenko

duzenko

    Advanced Member

  • Active Developer
  • PipPipPip
  • 1976 posts

Posted 24 November 2018 - 11:16 AM

I was the last person to work on that map, but it sounds like its an issue with the entity. Can you give me the exact entity name and location and I will copy and paste that into a test map..

anoot.map, models/darkmod/lights/extinguishable/cagelamp_hanging.lwo

 

One of the warehouses

]getviewpos
-3439.24 3447.35 306.67   -17.7 -127.4 0.0


#7 Bikerdude

Bikerdude

    Member

  • Banned
  • PipPipPipPipPip
  • 20320 posts

Posted 24 November 2018 - 01:17 PM

I will try and have a look at that on Sunday.



#8 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 9341 posts

Posted 28 November 2018 - 03:09 PM

OK.

I'm gonna return to this discussion and be a bit of a "pain in the arse".

Regardless of way that surfaces are considered (facing or not) the noshadows_lit arg
should remove all shadowed surfaces in the entity when the light is activated.

One thing we could do to better compare the rendering paths is to create a new
entity arg "noshadows_lit_n" which does not use the script interface to accomplish
the change. Instead it would use some sort of hook that passes the "lit" flag to the render def
when it's changed on the game side.

If the new arg works but we cannot identify why the old one fails we can just rename the

new arg and comment out the script side operations.

I have a rough idea about how to get this done but I'll defer to better coders until I'm
forced to wield my own hacky attempt.


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...)

#9 duzenko

duzenko

    Advanced Member

  • Active Developer
  • PipPipPip
  • 1976 posts

Posted 02 December 2018 - 08:24 AM

OK.

I'm gonna return to this discussion and be a bit of a "pain in the arse".

Regardless of way that surfaces are considered (facing or not) the noshadows_lit arg
should remove all shadowed surfaces in the entity when the light is activated.

One thing we could do to better compare the rendering paths is to create a new
entity arg "noshadows_lit_n" which does not use the script interface to accomplish
the change. Instead it would use some sort of hook that passes the "lit" flag to the render def
when it's changed on the game side.

If the new arg works but we cannot identify why the old one fails we can just rename the

new arg and comment out the script side operations.

I have a rough idea about how to get this done but I'll defer to better coders until I'm
forced to wield my own hacky attempt.

Do you think that script does anything for lights that aren't toggled in game? I.e. the hanging light in NHAT is just on from the very beginning and since no changes happen then probably the script does not get called?



#10 VanishedOne

VanishedOne

    Advanced Member

  • Member
  • PipPipPip
  • 903 posts

Posted 02 December 2018 - 10:18 AM

If it uses the tdm_light_holder scriptobject, presumably its init() method will get called. However, the relevant part of the script seems just to invoke the noShadows() script event:

if (getKey("noshadows_lit") == "1")
	{
		//sys.println(sys.getTime() + ": DEBUG: light holder setting shadows");
		noShadows( !m_bExtinguished );
	}

Some things I'm repeatedly thinking about...

- louder scream when you're dying


#11 Springheel

Springheel

    Creative Director (retired)

  • Admin
  • 37633 posts

Posted 02 December 2018 - 10:27 AM

The relevant detail is whether it is an entity or just a model.  Some mappers just place a model and then add a flame entity manually to it, so the script would not come into play.


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

#12 duzenko

duzenko

    Advanced Member

  • Active Developer
  • PipPipPip
  • 1976 posts

Posted 02 December 2018 - 11:22 AM

The relevant detail is whether it is an entity or just a model.  Some mappers just place a model and then add a flame entity manually to it, so the script would not come into play.

What is "it" and where is it defined (as model or entity)?



#13 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 9341 posts

Posted 02 December 2018 - 11:57 AM

I'll get the entity def tonight.

 

It must be an entity or else the noshadows_lit arg wouldn't work in Stencil Shadows mode.

 

It's almost certainly:

 

atdm:torch_cagelamp_hanging


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...)

#14 duzenko

duzenko

    Advanced Member

  • Active Developer
  • PipPipPip
  • 1976 posts

Posted 02 December 2018 - 12:02 PM

Is this it?

// entity 894
{
"classname" "func_static"
"name" "func_static_2452"
"bind" "func_pendulum_13"
"model" "models/darkmod/lights/extinguishable/cagelamp_hanging.lwo"
"origin" "-3479 3418 373"
}

If so, am I right that it's instantiated as an idStaticEntity in the C++ code and is not bound to any script?



#15 Bikerdude

Bikerdude

    Member

  • Banned
  • PipPipPipPipPip
  • 20320 posts

Posted 02 December 2018 - 01:04 PM

I will try and have a look at that on Sunday.

I haven't gotten around to do this, do I still need too..?



#16 duzenko

duzenko

    Advanced Member

  • Active Developer
  • PipPipPip
  • 1976 posts

Posted 02 December 2018 - 01:07 PM

I haven't gotten around to do this, do I still need too..?


Can you replace the funcstatic above with atdm:torch_cagelamp_hanging?

#17 Springheel

Springheel

    Creative Director (retired)

  • Admin
  • 37633 posts

Posted 02 December 2018 - 01:52 PM

Is this it?

// entity 894
{
"classname" "func_static"
"name" "func_static_2452"
"bind" "func_pendulum_13"
"model" "models/darkmod/lights/extinguishable/cagelamp_hanging.lwo"
"origin" "-3479 3418 373"
}
If so, am I right that it's instantiated as an idStaticEntity in the C++ code and is not bound to any script?


Right. The mapper has just placed it as a model, not an entity. This will be the case in numerous maps, I imagine, especially older ones.
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

#18 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 9341 posts

Posted 02 December 2018 - 02:02 PM

Pretty strange.

 

If it's not the noshadows_lit arg doing this then I can't really understand why no shadows are rendered

in Stencil Shadow mode.

 

I'll recheck the tonight.

 

Does the coal DDS texture have an alpha channel?

 

If it's alpha tested then stencil mode will treat it like noshadows I believe.


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...)

#19 duzenko

duzenko

    Advanced Member

  • Active Developer
  • PipPipPip
  • 1976 posts

Posted 02 December 2018 - 02:12 PM

No, AFAIU the coal surface is considered "back-facing" and culled because of that. The stencil code seems to only process triangles facing away from the light.

 

You can test that by switching materials on the two surfaces that make up the model. Currently one of them is noshadows.



#20 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 9341 posts

Posted 18 December 2018 - 07:37 AM

@Springheel:

 

May I request that you update the tdm_coals_hot material in the hanging cagelamp lwo models with the new tdm_coals_hot_ns material?

 

Thanks.


  • duzenko likes this
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...)

#21 Springheel

Springheel

    Creative Director (retired)

  • Admin
  • 37633 posts

Posted 18 December 2018 - 11:41 AM

There are several light models that use that texture...is the cagelamp the only model that shows a problem?  Also, do we know that this won't break custom skins mappers may have used?


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

#22 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 9341 posts

Posted 18 December 2018 - 11:55 AM

There are several light models that use that texture...is the cagelamp the only model that shows a problem? 
Also, do we know that this won't break custom skins mappers may have used?


I would say that any light entity where this texture might cast shadows is a candidate for this workaround.

Custom skins will only be an issue if they

1) use the original hot coal texture
2) are part of a light emitting entity
3) the texture is not supposed to produce a shadow

Thus far, I have not seen widespread problems as described above.
NHAT 1 and 2, and a (i think) a different cagelamp in The Rat's Triumphant that was not gameplay impacting for that mission.
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...)

#23 Springheel

Springheel

    Creative Director (retired)

  • Admin
  • 37633 posts

Posted 18 December 2018 - 12:07 PM

3) the texture is not supposed to produce a shadow

 

 

The issue with skins isn't whether it is supposed to cast a shadow...if a mapper made a custom skin, it would turn black if the model's original textures are changed.

 

I've gone back and reread the thread, but I need a clear description of what the problem is, or a description of how to reproduce it.  The model is casting shadows when it shouldn't, or it isn't casting shadows when it should?


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

#24 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 9341 posts

Posted 18 December 2018 - 12:11 PM

It's casting a shadow when it shouldn't.

Shadow Map mode.

r_shadows 2
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...)

#25 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 9341 posts

Posted 18 December 2018 - 12:32 PM

.if a mapper made a custom skin, it would turn black


It would only make the "changed texture" black right? Other textures would still render?
If so, a barely visible hot coal texture inside the cage lamp goes black on custom skinned models?

Collateral damage seems to be minimized there.
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...)



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users