Shadows (ShadowVolume) - Vegetation

ArmA editing, missions, modeling, textures, terrains

Moderators: Lone Wolf, Snake Man

Snake Man
Commander-In-Chief
Posts: 9354
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC

Shadows (ShadowVolume) - Vegetation

Post by Snake Man » 2008-05-30 16:20:35

I'm trying to learn how to do shadows, meaning ShadowVolume LODs.

LODs / Geometry

I took a look at the BIS vegetation models, bushes and trees, there were few kinds of settings they used in Geometry and then the LODs.

For LODs they used these (but not necessarily at the same time):
ShadowVolume 0.000
ShadowVolume 10.000
ShadowVolume 1000.000
ShadowVolume 1500.000

In Geometry they put these settings:
shadow = hybrid
sbSource = explicit
PrefersShadowVolume = 0
and there was also:
abSource = explicit

Its not completely clear to me yet how these different settings work out, I mean I did not find any clear pattern here besides that mostly the settings were SV 0 and 1000 with geometrys shadow = hybrid, sbSource = explicit and PrefersShadowVolume = 0.

I experimented with these and if you use only ShadowVolume 0.000 LOD, then binarize will give you errors, so you need to add the ShadowVolume 1000.000 for example and the errors went away with sbSource = excplicit.


Model

The models I did were of course with any textures removed, the SV 0.000 was the largest one but I still tried to keep it below 100 polys. The model needs to be closed and triangulated. Sometimes this is difficult to do and you go nuts when doing it, most of the times there is very little closing of the model. There was times when I just did convex model thing for it and was done with it. Seemed to work fine. I'm really not satisfied with my modeling skills yet regarding ShadowVolume LODs.

Please post any tips and suggestions regarding shadows :)
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

Linker Split
Recruit
Posts: 14
Joined: 2007-10-18 22:15:44

About shadows

Post by Linker Split » 2008-05-31 07:01:42

A tree model works like this:

It got the 2 first SV LODs, to render the shadow ON the other objects.

So to render the shadow on a house, on a rock and so on.

Then it uses the last 2 SV LODs to render shadow ON the terrain.

But pay attention!
You can even use no SV LODs, the shadow will be still rendered on the ground (thanks to the polycount of the RES LODS), but engine will not use the SV LODs to skip from a detailed shadow, to the distance-used one. Basically it will always render the same shadow at both 1 meter and 40 meters.

Also, the last 2 SV LODs must have the textures applied to the model: that's because engine must render the alpha foliage textures.

I tried to find a way to render the same ground-shadow on both terrain and buildings, but with no luck: seems that we'll still have the weird polygon shadow on objects :(

Linker Split
Recruit
Posts: 14
Joined: 2007-10-18 22:15:44

NOTE!

Post by Linker Split » 2008-06-05 23:11:53

I noticed one more thing:

What really causes lag is the Pixel shader and Vertex Shader of the _ca texture:
they normally have VertexShader: NormalMapSpecularThroughNoFade and PixelShader: NormalMapSpecularThrough.

If instead of that PixelShader, we add the simple PixelShader: NormalMapThrough but with the flag NoAlphaWrite, we will have the SAME effect, but with an increase of FPS and performance :)

Check yourself:

Before:
Image

After:
Image

Synide
2nd Lt
Posts: 76
Joined: 2003-11-18 19:14:51
Location: Wgtn, New Zealand

Post by Synide » 2008-06-06 06:31:45

nice...

it's good to see someone is spending the time to play with various pixel & vertex shader combinations good one... wish I could play a bit more with them myself...

if only some enterprising BIS employee took a day out of there busy schedule to write up a detailed explanation for each shaders intended use, etc. etc I'd be of real benefit to everyone...

Snake Man
Commander-In-Chief
Posts: 9354
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC

Post by Snake Man » 2008-06-06 10:30:50

Excellent find Linker Split, thank you very much for posting. Now we need to make sure we get this information to the wiki too.
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

Snake Man
Commander-In-Chief
Posts: 9354
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC

Post by Snake Man » 2008-06-06 11:19:05

Suma (BIS Dev for those who have just born or crawled under their rock) said this on their forum:
By using NormalMapThrough instead of NormalMapSpecularThrough you remove specular highlights on leaves, which makes the computations easier (shader is shorter). I understand this can bring better performance.

As for NoAlphaWrite, I do not see how could it bring any performance. Did you measure it without this flag? I expect NoAlphaWrite to cause significant artifacts when shadows are casted on the tree using it, therefore I suggest avoiding it.
Source
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

Snake Man
Commander-In-Chief
Posts: 9354
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC

Post by Snake Man » 2008-06-28 10:29:42

Did some statistics on the BIS MLOD vegetation models.

akat02s:
ShadowVolume 0.000
ShadowVolume 10.000
geometry;
shadow = hybrid

banana_2, banana_3, banana_4, hrusen2, jablon, ker buxus, ker deravej, ker pichlavej, ker s bobulema, Krovi_bigest, oliva, Smrk_maly, Smrk_siroky, Smrk_velky, str briza, str habr, str javor, str jerabina, str kastan, str lipa, str osika, str trnka, str vrba, str_Briza_kriva, str_Briza_rovna, str_liskac:
ShadowVolume 0.000
ShadowVolume 1000.000
geometry;
shadow = hybrid
sbSource = explicit
PrefersShadowVolume = 0

bodlak_group, bolsevnik_group, koprivy, lopuch:
ShadowVolume 0.000
ShadowVolume 1500.000
geometry;
placement = slope
shadow = hybrid
sbSource = explicit
PrefersShadowVolume = 0

DD_borovice02, DD_borovice, palm_08small, palm_09, palm_10, str_fikovnik2:
ShadowVolume 0.000
ShadowVolume 1500.000
geometry;
shadow = hybrid
abSource = explicit
PrefersShadowVolume = 0

DD_bush01, les_fikovnik2, str_fikovnik_ker, str_Topol2, str_topol:
ShadowVolume 0.000
ShadowVolume 1500.000
geometry;
shadow = hybrid
sbSource = explicit
PrefersShadowVolume = 0

DD_bush02, les_dub_jiny, les_singlestrom_b, str dub jiny:
ShadowVolume 0.000
ShadowVolume 10.000
ShadowVolume 1500.000
geometry;
shadow = hybrid
sbSource = explicit
PrefersShadowVolume = 0

Krovi2, les_buk, les_dub, str buk, str dub, str krovisko vysoke, str_fikovnik:
ShadowVolume 0.000
ShadowVolume 10.000
ShadowVolume 1000.000
geometry;
shadow = hybrid
sbSource = explicit
PrefersShadowVolume = 0

Krovi4, Krovi, Krovi_long:
ShadowVolume 0.000
ShadowVolume 1000.000
geometry;
placement = slope
shadow = hybrid
sbSource = explicit
PrefersShadowVolume = 0

les_singlestrom, palm_01, palm_02, palm_03, palm_04:
ShadowVolume 0.000
ShadowVolume 10.000
ShadowVolume 1500.000
geometry;
shadow = hybrid
abSource = explicit
PrefersShadowVolume = 0

pinus_mugo_lowpoly:
ShadowVolume 0.000
ShadowVolume 1500.000
geometry;
placement = slope
abSource = explicit
PrefersShadowVolume = 0

str jalovec, str_pinie:
ShadowVolume 0.000
geometry;
shadow = hybrid

Conclusion: for shadows to work on bushes/trees you need to add LODs:
ShadowVolume 0.000
ShadowVolume 1000.000
and in the geometry;
shadow = hybrid
sbSource = explicit
PrefersShadowVolume = 0
the LODs must be closed and triangulated.
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

Who is online

Users browsing this forum: ClaudeBot [Bot] and 0 guests