Fixed FOV side effect on light sprite size.
The light sprite diminished to zero size as the FOV was decreased (in sim zoom), and increased considerably as the FOV was increased. This commit fixed this by taking the FOV into account to keep the light sprite size roughly constant across the valid FOV range.
This commit is contained in:
parent
25068efaee
commit
ae119f29cf
2 changed files with 10 additions and 8 deletions
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
||||
/********
|
||||
|
|
Loading…
Add table
Reference in a new issue