SkyDome day/night problem

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
LunaRebirth
Posts: 385
Joined: Sun May 11, 2014 12:13 am

SkyDome day/night problem

Post by LunaRebirth »

Hello!
I've done a TON of research on this, but could never get it working properly!

I decided to use fog to my advantage on my dome.

Here's my code:

Code: Select all

driver->setFog(video::SColor(0,0,0,0), video::EFT_FOG_LINEAR, 500, 600+(server.lightR*1000), 3.f, true, false);
server.lightR is determined by the server time. It increases by 0.001 during the night time, and decreased 0.001 during the day time.

This code works!
However, shading the skydome with the darkness leaves a line on the skydome by vertex, and then lightens outward. This is a weird graphical problem, because moving your screen looks like there is a dark line wherever your camera is looking and it diminishes light.
Let me show you what I mean:
Image

Thanks in advanced!!!!
_Luna
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: SkyDome day/night problem

Post by hendu »

Fixed function fog is per-vertex. Write a shader if you need per-pixel.
LunaRebirth
Posts: 385
Joined: Sun May 11, 2014 12:13 am

Re: SkyDome day/night problem

Post by LunaRebirth »

How do you suggest I do this?
I looked at the per-pixel lighting tutorial, but found nothing useful for this situation.
But they're also using fog. Am I missing something? :o
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: SkyDome day/night problem

Post by hendu »

There are many GLSL fog tutorials online. The irr example 11 is not useful in this, as it uses a built-in shader with limitations.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: SkyDome day/night problem

Post by Nadro »

You can check fixed function emulation shaders (media/Shaders) in ogl-es branch, where fog calculation is included.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
LunaRebirth
Posts: 385
Joined: Sun May 11, 2014 12:13 am

Re: SkyDome day/night problem

Post by LunaRebirth »

Thank you, I'll check it out!
Post Reply