OpenGL 2: How to create half-shadows?

Hello,

Since a quit long time I started to creating a ‘map-pack’ for ioquake3 engine based games, a few maps are already done and now I wanted to light my maps. The maps are specially designed to make use of the new Renderer 2 features (bumpmapping, real-time shadows etc.). So I decided to also use the new sunlight method for my sky shaders.

After endless hours of tweaking the relevant shader I noticed that either something with the current OpenGL Renderer 2 must be wrong or I do something wrong (which is also very likely).

First of all, I do have some maps with a cloudy sky, there is no full bright sunshine so I wanted to have some weaker shadows or ‘half-shadows’.
The current method to achieve this effect is to create a sky shader with a parameter called ‘deviance’.
It is the 7th parameter in your ‘q3map_sunExt’ sky shader.

e.g.: q3map_sunExt 240 238 200 100 195 35 3 16

More info can be found here: http://q3map2.robotrenegade.com/docs/shader_manual/q3map-global-directives.html#q3map_sunExt

When creating baked lightmaps (compiled with q3map2) this works perfect and gives very good results.

In ioquake3’s ‘opengl2-readme.txt’ there are now two methods mentioned to create skylight.
Either by using the ‘old’ method as shown above or with a new method.
See. https://github.com/ioquake/ioq3/blob/master/opengl2-readme.txt
Renderer 2 offers a new sky shader keyword called ‘q3gl2_sun’. It reads as follows:

q3gl2_sun red, green, blue, intensity, degrees, elevation, mapLightScale, ambientLightScale

e.g.: q3gl2_sun 240 238 200 50 195 35 3 1.0 0.2

Furthermore the comment in ‘opengl2-readme.txt’ says:
“Note the first six parameters are the same as in q3map_sun or q3map_sunExt, and the last two indicate scaling factors for the map brightness and an ambient light of the same color as the sun.”

This means: (6+2=8)

If you have a closer look you will notice that the example from above (the example from ‘opengl2-readme.txt’) has nine parameters not eight.

So what does the third-last parameter do?

I was under the assumption this still is the ‘deviance’ parameter. But the desired effect of half-shadow does not work with Renderer 2, assuming I use the new q3gl2_sun keyword.

This leads to two questions:

  1. Is parameter ‘7’ respectively the ‘deviance’ parameter still usable when using q3gl2_sun keyword?
    (If not, then the ‘opengl2-readme.txt’ is wrong)

  2. I had a look on the renderer engine and I think half-shadows aren’t possible anymore :frowning:
    Though I’m no expert and I have no rendering programming skills.
    If Renderer 2 still provides a method of creating half-shadows, how can we produce half-shadows when using Renderer 2 with r_sunlightMode 2 and use ‘q3gl2_sun’ then?

Sorry if my questions are silly, maybe I do something completely wrong.

Is there anyone who create maps for Renderer OpenGL2 and can help me?
Thanks in advance. Any help would be appreciated!

Thank you for reading!

I swear the documentation is filled with quantum bugs, whenever I look at it it doesn’t seem wrong until someone points it out and then it suddenly is. :smile:

Anyway, regarding the first question, parameter ‘7’ shouldn’t be there, I’m correcting the documentation now, the code only parses eight numbers. There is no deviance in q3gl2_sun.

Regarding the second question, I’m not sure what you mean by half-shadows? r_sunlightMode 2 doesn’t actually make shadows so much as adds light, so if I’m understanding you, you should be able to get a similar effect with low (~50) intensity and setting mapLightScale and ambientLightScale to 1.0. Unfortunately this means you won’t get shadows in areas not in direct sunlight.

Thank you very much for your answer SmileTheory!

Okay, I will delete parameter ‘7’ in my sky shader then.

By ‘half-shadows’ I meant the behaviour of shadows to become ‘more blurry’ as farther the source (that will cast a shadow) is from point that will receive the shadow.
Hmm, its really hard to explain in english.
Unfortunately the Xreal forum is down, but I think it was called ‘Soft Penumbra Shadows’ or something.
You can see this shadow effect if something is very far from ground. The shadows will have more spread. The angle of the deviance grows with distance.
Example picture: http://hal.inria.fr/docs/00/28/13/88/IMG/a2-Hugo-1024Sources.jpg

Xreal shadows worked similar this way. Though, you are right, Robert Beckebans did this for entity lights and not for skylight. I’m no expert, but I assume he did achieve this effect by scatter the shadow filters.

Here is a screenshot from Xreal: http://xreal.sourceforge.net/screenshots/softshadows/shot0026.jpg

Your OpenGL Renderer (was?) based on Xreal so I thought this type of shadow is still there. Hence I was looking for the right parameter, the ‘deviance’ parameter.

Anyways, thank you for your help and the corrections to the documentation! This really will help map makers a lot!