Sky

Everything about development and the OpenMW source code.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Sky

Post by Zini »

Thanks! That looks good.
1. a backend that calculates color modulation for atmosphere and clouds, as well as the fog colour
2. a backend that calculates the position (and visibility) of the sun and the moons
3. a backend that calculates a weather setting, depending on region and time
4. calculate the moon phases (based on date)
#1: I am pretty sure that there is nothing in the world model that can be used to determine these. I guess these depend on the weather and as such I am not sure if we should call it a backend task.

#2: That is one of the more interesting parts. Do we have any idea about the celestial mechanics of Mundus? I would expect that these can be calculated by an algorithm that only uses time and date as input.

#3 Not much to calculate here. There are region-specific weather tables. And weather can also be adjusted by script instructions. If you need the current weather for rendering, I suggest for now just set it world-wide with the script instructions. We can handle these tables and weather limited to one region later.

#4: same as #2.

I suggest to create a new class for the sky/weather state and give MWWorld::World a member of this class. This way we can avoid bloating the World interface further (almost no additional public functions needed; except for the weather part). The new class can communicate directly with the RenderingManager, which in turn passes on the requests to the SkyManager.

btw. I am not 100% sure about this, but I think there is a bug in the cell-specific ambient lighting (which is only available for interiors in MW), which also sets it in exterior cells. This bug might interfere with your attempts.
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Sky

Post by jhooks1 »

Looks good, keep up the good work.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Sky

Post by scrawl »

Zini wrote: btw. I am not 100% sure about this, but I think there is a bug in the cell-specific ambient lighting (which is only available for interiors in MW), which also sets it in exterior cells. This bug might interfere with your attempts.
I already noticed this bug.
mAmbientMode (in RenderingManager) is uninitalized, and defaults to 1,1,1 ambient light.
Even after I changed this (change mAmbientMode to 0 [=normal]) I still can't see the sun for some reason.

the reason we don't see this bug in the normal branch is because Caelum manages its own lights as well (which is really bad)

Anyways, I've decided to do the lighting later, I'll create a weather management class like you suggested and borrow some code for atmosphere/clouds color calculation from Project Aedra.
User avatar
pvdk
Posts: 528
Joined: 12 Aug 2011, 16:34

Re: Sky

Post by pvdk »

A lot of weather and sky related variables are specified in the Morrowind.ini file, for example the speed with which the moons and clouds move. I think we need to take these into account for the Morrowind.ini importer task.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Sky

Post by Zini »

Haven't heard anything new about it. There was a PM a few weeks ago, but I haven't seen a single piece of code yet. I guess we can use hardcoded values for now. Without having the importer, getting the Morrowind.ini values into OpenMW would be awkward.

btw. I think one sky effect is still missing. The moon (or moons?) can change script-controlled its colour (this is a Bloodmoon feature).
User avatar
pvdk
Posts: 528
Joined: 12 Aug 2011, 16:34

Re: Sky

Post by pvdk »

Yes, TurnMoonRed and TurnMoonWhite to be precise. I think it's just an overlay or something as there is no texture for the red moon.
User avatar
werdanith
Posts: 295
Joined: 26 Aug 2011, 16:18

Re: Sky

Post by werdanith »

If you were wondering how Morrowind would look if the buildings floated in mid air and they reflected no sunlight here's the answer.
screenshot001.png
What's important to note though, is that this requires the CgProgramManager plugin for Ogre that is not supplied in the Ubuntu repositories, so this adds the extra dependency for at least Ubuntu users to either add this ppa, or build Ogre from source with nvidia-cg-toolkit installed.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Sky

Post by scrawl »

I'm not happy about adding the CG dependency, but writing the shaders in both languages (GLSL + HLSL) is even worse, IMO.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Sky

Post by Zini »

We need cg for the terrain anyway. Go ahead.
User avatar
raevol
Posts: 3093
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: Sky

Post by raevol »

werdanith wrote:If you were wondering how Morrowind would look if the buildings floated in mid air and they reflected no sunlight here's the answer.
:D So awesome.

Regarding the dependency, is it small enough that we can build it into our project? Or am I completely misunderstanding?
Post Reply