Dynamic lighting

Everything about development and the OpenMW source code.
Locked
User avatar
lgromanowski
Site Admin
Posts: 1193
Joined: 05 Aug 2011, 22:21
Location: Wroclaw, Poland
Contact:

Dynamic lighting

Post by lgromanowski »

Zini wrote: Does the dynamic lighting entry in the roadmap mean adding Ogre light sources for all light references and adjusting the ambient lighting according to the cell settings? We don't do anything more complex right now, correct?
nicolay wrote: Correct. It basically means translating ogre_toggleLight() from the old codebase (ogre/cpp_interface.cpp), along with setting the ambient color like you said.
Zini wrote: Okay, I take it.
Zini wrote: Oops! Can't specialise template on class member function level. That means dropping the templates entirely or taking them out of the function, both not nice. I think I will do a bit more refactoring on cell.hpp/cell.cpp.
Zini wrote: Any hint what I am supposed to do with these:

Code: Select all

extern "C"
{
  int lightConst;
  float lightConstValue;

  int lightLinear;
  int lightLinearMethod;
  float lightLinearValue;
  float lightLinearRadiusMult;

  int lightQuadratic;
  int lightQuadraticMethod;
  float lightQuadraticValue;
  float lightQuadraticRadiusMult;

  int lightOutQuadInLin;
}
?

Looks like global configuration, so static class members might be appropriate. But where do these variables get configured and what are the default values?
Zini wrote: And another question regarding the fog:

In the old code there is a min and a max range given (flow, fhigh). But I can't see how to derive it from the cell data in loadcell.hpp.

Anyway, I am done here. Once the questions regarding light configuration and fog are sorted out, the initial lighting implementation will be complete.
Zini wrote: Okay, I worked out the light configuration stuff, by looking at the D code. For now the code will use fixed values (no reading from openmw.cfg yet).

I still have no clue what to do about the fog configuration.
Zini wrote: Changed the default fog configuration to something more sensible. Render looks about right, though it is difficult to test without basic mouse navigation to move around and look at things (*nudge* *nudge*).
Anyway, that's it for now.
nicolay wrote: Thanks for this, the new refactored code looks great! I did a few minor adjustments, but they were minor. (The formula for guessing fog distances based on fogDensity is still just guesswork, but fwiw it's the one I used in the D version.)

The global lighting variables (lightLinear et al.) were really just used for experimentation - and iirc they were an attempt to translate the values found in Morrowind.ini. But I think the best long term solution is to just find something that looks good and stick with that.

So what do you say, shall we mark this one as 'done'?
Zini wrote: Actually, I have marked it as done already. Obviously it isn't really finished yet. We need the work out exterior lighting, various special effects on light sources and negative light sources. But I guess these can wait a while.
Zini wrote: Regarding the lighting settings: With the values in the Morrowind.ini you mean the weather dependent entries? In this case they are not constants. They change with the weather, which means we have to run through all lights and adjust them. The simple light configuration system, that we are currently using won't do us much (with the ambient part we will get into trouble too, if we use more than one scene manager, but that is a different topic).
I guess this can wait until we actually have a weather system.
Locked