diff --git a/Effects/scenery-lights.eff b/Effects/scenery-lights.eff index b805837d6..86d6debf0 100644 --- a/Effects/scenery-lights.eff +++ b/Effects/scenery-lights.eff @@ -15,6 +15,7 @@ <use_night_vision><use>/sim/rendering/als-filters/use-night-vision</use></use_night_vision> <use_IR_vision><use>/sim/rendering/als-filters/use-IR-vision</use></use_IR_vision> <sun_angle><use>/sim/time/sun-angle-rad</use></sun_angle> + <fov><use>/sim/current-view/field-of-view</use></fov> </parameters> <technique n="10"> @@ -123,6 +124,11 @@ <type>float</type> <value><use>sun_angle</use></value> </uniform> + <uniform> + <name>fov</name> + <type>float</type> + <value><use>fov</use></value> + </uniform> <uniform> <name>texture</name> <type>sampler-2d</type> diff --git a/Shaders/scenery-lights.vert b/Shaders/scenery-lights.vert index b31add3f0..aa6be6c08 100644 --- a/Shaders/scenery-lights.vert +++ b/Shaders/scenery-lights.vert @@ -24,6 +24,7 @@ uniform float osg_SimulationTime; uniform float avisibility; uniform float sun_angle; +uniform float fov; varying vec3 relativePosition; varying vec2 rawPosition; @@ -184,19 +185,14 @@ void main() lightSize = lightParams.x; lightIntensity = lightParams.y; - /******* - * TODOs: - * Might need to take into account FOV - */ - /******** * Each light is made up of a base circle, a circular-ish halo around the base and a bunch of * star-like rays * baseLightSize is tuned using reference objects of sizes 10cm, 50cm, 100cm, 500cm and 1000cm - * under the assumption that the "bright center" part of the light will be the same size as - * the light itself + * under the assumption that the "bright center" part of the light will be the approximately the + * same size as the light itself */ - float baseLightSize = lightSize / (dist/80); + float baseLightSize = lightSize / (dist/80) * 60/fov; /********