About Store Forum Documentation Contact



Post Reply 
Terrain lighting inverse of suns direction
Author Message
jondahl Offline
Member

Post: #1
Terrain lighting inverse of suns direction
The lighting of the terrain (and grass) in the world editor is coming from the opposite direction of where the sun is.

Sun is below ground, terrain is lit (wrong) but trees are dark (right):
[Image: JRn7i6xl.png]

Sun is above ground, terrain is dark (wrong) and trees are lit (right):
[Image: OknmkqJl.png]

I'm running the demo version using assets from the tutorials and the free asset packs from the store.

What am I missing here? Normals? Material parameters? Why is the terrain lit inverted? I believe shadows are sort of disabled in the demo but that doesn't feel like the issue here.

Cheers
Jonatan
12-25-2013 07:58 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Terrain lighting inverse of suns direction
Hi!

Does the issue occur every single time?
For example, do sample worlds from the "Tutorial" projects also have this issue?
I've just tried loading few sample worlds on Mac, and everything looks good.
12-26-2013 12:03 AM
Find all posts by this user Quote this message in a reply
jondahl Offline
Member

Post: #3
RE: Terrain lighting inverse of suns direction
Just made two screenshots from the Tutorial projects and all lighting is inverted

Sun below terrain:
[Image: yzLnZ1pl.png]

Sun straight from above
[Image: o7gNA0Ol.png]

Up to now it happens every time. Allthough in my previous screens the lighting was only inverted on everything except the palm trees.

I haven't touched any settings or anything.

What's going on? smile

Jonatan
12-26-2013 12:25 AM
Find all posts by this user Quote this message in a reply
jondahl Offline
Member

Post: #4
RE: Terrain lighting inverse of suns direction
Same results on snow lion and mavericks

/J
12-26-2013 03:36 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #5
RE: Terrain lighting inverse of suns direction
Hi, sorry but for this one I have no idea what could be wrong.
The same OpenGL engine/shader code works without issues on Mac Android Linux iOS and Windows (when I compile the engine with OpenGL instead of DirectX), for me and for all the users here, except in your case.

It is always possible that it's not an issue in the engine, but in the OpenGL/Graphics driver of your system.
12-27-2013 06:41 AM
Find all posts by this user Quote this message in a reply
jondahl Offline
Member

Post: #6
RE: Terrain lighting inverse of suns direction
Yes I understand, I will give you more details on the issue when I know more. Right know I don't even know where to start looking really. This issue is identical on my system (macbook pro retina 2013 mountain lion, openGL 3.2) and on my friends (macbook pro retina 2013 mavericks, openGL 4.1). Both running the demo-version.

Guess I have to dive into some openGL theory to have a chance on understanding what's going on here.

For now I'm relying on only ambient light in my scenes (which of course is a visual tragedy).

It's strange that this happens on two separate new macbook models. I wish I knew how they differ from the macs in the rest of the community.

Cheers
Jonatan

My specs overview:

Processor 2.6 GHz Intel Core i5
Memory 8 GB 1600 MHz DDR3
Graphics Intel HD Graphics 4000 768 MB
Software OS X 10.8.5 (12F45)
(This post was last modified: 12-27-2013 12:30 PM by jondahl.)
12-27-2013 12:28 PM
Find all posts by this user Quote this message in a reply
jondahl Offline
Member

Post: #7
RE: Terrain lighting inverse of suns direction
Is there anything I can do to troubleshoot this? This is kind of a show-stopper for me atm. The same issue occurs on two different macbooks with similar specs: 13" retina macbooks from this year.

Jonatan
12-30-2013 02:37 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #8
RE: Terrain lighting inverse of suns direction
Hi,
Yes I understand that it's a show-stopper for you unfortunately.
I have just one MacBook, and on it I don't have the issue. I think that the issue sounds too "complex/unusual" that it could be solved remotely by me (I would need to have a computer like yours to reproduce the steps, do some tests).
To me it does sound like bug in OpenGL graphics driver, since it does work correctly on other systems, and most macs, but only yours/recent have this issue.
If that's the case, you can submit a bug report directly to Apple:
https://bugreport.apple.com/
And provide step by step description of what's wrong, and the expected results, and say that it works on other macs (mine is MacBook Pro, 13" Mid-2010, Core 2 Duo, GeForce 320m, and no issues there, I think other mac users could comment on their system spec and if they're experiencing a similar issue like you)
12-30-2013 07:04 AM
Find all posts by this user Quote this message in a reply
jondahl Offline
Member

Post: #9
RE: Terrain lighting inverse of suns direction
I sent a bug report to Apple a while ago but haven't heard anything from them. Let me know if you can get your hands on a 2013 retina macbook (or newer) and reproduce this bug. Honestly, if I could, I'd send you mine, hah.

Tried it in bootcamp (windows 8.1) and everything worked as it should, correct shading with shadows being cast. So it's not a hardware thing only. It feels like this is kinda zeroing down on something, but I have no idea what exactly.

Summary:

My specs

Macbook Pro 13" retina, model early 2013
Processor 2.6 GHz Intel Core i5
Memory 8 GB 1600 MHz DDR3
Graphics Intel HD Graphics 4000 768 MB
Software OS X 10.8.5 (12F45) (Mavericks)
OpenGL 4.2

Correct lighting under windows 8.1 in Bootcamp
Inverse lighting under OS X (both Mavericks and Snow Leopard on same hardware)
01-14-2014 11:39 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #10
RE: Terrain lighting inverse of suns direction
Thank you for the update and for sending the bug report to Apple.
I'm not sure if I'll be able to get my hands on a MacBook model similar to yours in the nearest future.
It would be best if Apple just could investigate this, because most likely it's a bug in the graphics driver (for which I can't do nothing).
01-14-2014 11:44 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #11
RE: Terrain lighting inverse of suns direction
Hi,

Good news is that I have a new Mac now, and with it I also experience the same issue, I'll try to do some debugging to see if I can find a workaround.
02-19-2014 03:32 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #12
RE: Terrain lighting inverse of suns direction
Great news, I was able to find a workaround for this, and it should work ok in next release!
02-19-2014 05:18 AM
Find all posts by this user Quote this message in a reply
jondahl Offline
Member

Post: #13
RE: Terrain lighting inverse of suns direction
Wow this is amazing news. I put this engine on hold for a while because of this, but now I can get back to it! Awesome job man! So wherein did the issue lie, approximately? MBP hardware? So curious
02-19-2014 09:59 AM
Find all posts by this user Quote this message in a reply
xzessmedia Offline
Member

Post: #14
RE: Terrain lighting inverse of suns direction
thanks this is great update!
finally it looks right on the mac.. this was really annoying.
thanks greg.. what mac did you bought by the way?
02-19-2014 03:45 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #15
RE: Terrain lighting inverse of suns direction
(02-19-2014 09:59 AM)jondahl Wrote:  So wherein did the issue lie, approximately? MBP hardware? So curious
As I suspected it was shader compilation issue:
bool gl_FrontFacing;

Replacing:
if(!gl_FrontFacing)..

to:
if(gl_FrontFacing==false)..

fixed it, even though both codes are exactly the same.

(02-19-2014 03:45 PM)xzessmedia Wrote:  what mac did you bought by the way?
I went with MacBook Air 13", 1.3 Ghz, 1440x900 ( http://www.apple.com/nz/macbook-air/specs.html )
I don't need a powerful machine since I already have a good Windows laptop for development, the only thing that I wanted is nice and fast compilation experience.
With SSD it's now much more convenient to operate a Mac when compared to my previous model. The device is pretty cool, the only thing which I don't like, is that there's a dark shade on the bottom of the screen. I thought it's a graphical effect first, but it's just a defect in LCD. Turns out many MacBook Air's have them. I would expect better from Apple. At least I got it 100$ cheaper, as I picked the ex-demo-display model.
02-19-2014 11:50 PM
Find all posts by this user Quote this message in a reply
Post Reply