Jump to content
The Dark Mod Forums

Lights Don't Work (#124)


Recommended Posts

I have investigated this issue and it seems that it is a problem with lights that do not specify a lightfalloffimage. Previously in this case the renderer would detect that the bound verticle texture was numbered 0 and would therefore know to use the default, however this no longer seems to be happening -- instead the texture is bound to a new number which presumably corresponds to a black or invalid texture rather than the default point light falloff.

 

I have also confirmed this by copying the biground1 light texture and adding the same lightfalloffimage as with defaultpointlight, whereafter it works.

 

Greebo -- there is a note in the flushRenderables method:

 

// greebo: Note, that the check for empty texture_numbers should not
// necessarily be placed here, that kind of error handling should go into
// the shaders module.

 

How should we check for a light shader which has no falloff now? I am quite happy to move it out of the renderer (and get rid of the horrible g_defaultPointLight global). Perhaps it should go in the shaders plugin, for instance, whereby a light texture with no falloff gets a default instead of a blank name/empty pointer.

Link to comment
Share on other sites

You should be able to specify a default fall off image in the GLTextureManager. When a Shader is requested to deliver its TexturePtr lightFallOffImage() it checks its template for a definition. If that one is not found, it requests the emptyFallOffImage() from the GLTextureManager.

 

Compare CShader::lightFalloffImage():

if (_texLightFalloff == NULL) {
	// TODO: Move this algorithm into a FallOffConstructor object
	// deriving from a TextureConstructor class, if appropriate (check). 

	if (_template._lightFallOff) {
		// There is a lightfalloff defined in the template
		std::string foTexName = _template._lightFallOff->getTextureName();

		// Pass the call to the GLTextureManager to realise this image 
		_texLightFalloff = GetTextureManager().getBinding(
			foTexName,
			_falloffConstructor,
			texLightFalloff
		);
	}
	else {
		// No falloff defined in the template
		_texLightFalloff = GetTextureManager().getEmptyFalloff();
	}
}
return _texLightFalloff;

The emptyLightFallOff() method is probably a misnomer and should be renamed to defaultLightFallOff().

 

There is a constant in the GLTextureManager which specifies the actual bmp image to be used.

Link to comment
Share on other sites

I see, this will be the problem:

 

const std::string SHADER_FALLOFF_EMPTY = "bitmaps/_black.bmp";

 

The last thing we want is to default to a black falloff image, this will turn off the light. I will look into adjusting the shaders plugin so that empty falloff textures are instead retrieved from the defaultPointLight shader, since this is the behaviour that Doom 3 exhibits and we want to match it as closely as possible.

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

      Has anyone had any luck with textures from Polyhaven? Their OpenEXR normal maps seem too washed out and give incorrect shading in the engine.
      · 5 replies
    • datiswous

      I tried to upscale the TDM logo video. First try:

      briefing_video.mp4 You can test it ingame by making a copy of the core tdm_gui.mtr and place it in your-tdm-root/materials/ , then edit line 249 of that file into the location where you placed the new briefing.mp4 file.
      What I did was I extracted all the image files, then used Upscayl to upscale the images using General photo (Real-Esrgan) upscale setting and then turn it back into a video.
      I might have to crop it a bit, the logo looks smaller on screen (or maybe it's actually better this way?). My video editor turned it into a 16:9 video, which I think overal looks better than 1:1 video of original.
      · 1 reply
    • nbohr1more

      Trying to be productive on my down-time before Capcom releases Akuma and my son is constantly on my PC playing Street Fighter...
      · 1 reply
    • OrbWeaver

      Finally got round to publishing a tutorial on baking normal maps in Blender, since most of the ones we have are inaccessible or years out of date.
      · 3 replies
    • nbohr1more

      The FAQ wiki is almost a proper FAQ now. Probably need to spin-off a bunch of the "remedies" for playing older TDM versions into their own article.
      · 1 reply
×
×
  • Create New...