PadWorld-Entertainment / worldofpadman

World of PADMAN game repository
https://worldofpadman.net
Other
37 stars 8 forks source link

WoP's sky lens flare interferes with artifical sun created with opengl2 sunrays function #275

Open kai-li-wop opened 2 weeks ago

kai-li-wop commented 2 weeks ago

WoP's unique sky lens flare does not work well with the artificial sun created with the opengl2 sun rays function (r_drawSunRays). This is due to the following.

  1. the sun rays function creates a kind of artificial sun spot on the sky, from which the sun rays are emitted. This white spot makes it more believable that there is a sun in the sky while the skybox doesn't provide it on the texture. WoP's sky lens flare feature does almost the same thing, it adds a white texture for the sun to create a believable light source and adds the lens flare textures on top of it. With both features enabled, these "suns" are now created on top of each other which makes it extra bright.
  2. WoP's sky lens flare needs two keys in the world spawn of a map (skylensflare and skylensflare_dir) to define the lensflare script and position according to the Cartesian XYZ coordinate system (cg_printDir is helpful) while the sun rays feature takes the position from the skybox shaders q3map_sun, q3map_sunExt or q3gl2_sun which provide polar coordinates. You could convert one to the other with some math, but mappers usually don't, and find the "correct" position for the skybox sun by trial and error. So it's an estimate. This usually leads to a mismatch between the sky lens flare sun and the sun rays sun not being in the exact same place.

Possible solutions:

Note: We cannot totally omit the key skylensflare in the world spawn because all skyboxes with a q3map_sun or such would directly enable the sky lens flare, also for maps who don't want it.