====== ArmA 1 Shadows ====== [[https://www.pmctactical.org/forum/viewforum.php?f=42|ArmA 1 Forum]], [[:arma|ArmA 1 Home]], [[arma:config|ArmA 1 Config]], [[arma:tools|ArmA 1 Tools]], [[arma:file_formats|ArmA 1 File Formats]], [[arma:missions|ArmA 1 Missions]], [[arma:modeling|ArmA 1 3D Modeling]], [[arma:terrain|ArmA 1 Terrain]], [[arma:texturing|ArmA 1 Texturing]], [[arma:scripting|ArmA 1 Scripting]] **ArmA 1** aka Armed Assault (ArmA) Used for HW shadow casting. The shadows are cast from this LOD on resolution LOD surfaces. The shadow volume area is made by extruding the lit faces of the shadow LOD (faces that have normals oriented towards the light) in the light direction. LOD should be as simple as possible, to represent the 1st LOD shape and all its important parts. The shape should not exceed 1st LOD volume. Maximum poly count for shadowVolume is 1000 triangles. All components must be Closed (each edge must have 2 neighbor polygons) – check with Structure -> Topology -> findNonClosed. Normals can be oriented both ways, depending on desired purpose of the specific shadow LOD surface/component. This lod should not contain any texture or material All faces must be Triangulated (each polygon must have 3 edges) - use menu Structure -> Triangulate All edges must be sharp – menu Surfaces -> SharpEdge (U) LOD must be named ShadowVolume 0.000, ShadowVolume 10.000 or ShadowVolume 1000.000 * Shadow volume 0 is the main stencil shadow. It should have less than 1000 triangles. * Shadow Volume 10 is optimized stencil shadow LOD with as few triangles as possible. * Shadow 1000 is special for trees, it uses alpha transparent textures to be calculated using GPU shadow buffer. (so this lod can have link on texture) All faces must have property "Enable shadow", otherwise they will not cast shadow - menu Face properties (E). If the Volume LOD is missing, HW cannot cast shadows and there is no other alternative, engine will use resolution LODs. OFP cannot cast too complex shadows, so every resolution LOD that contains more than 1000 faces, should have property LODNoShadow = 1 to disable CPU shadows. (bugs reported after binarization). ShadowVolume - View Cargo, ShadowVolume - View Pilot, ShadowVolume - View Gunner - special shadow for static view resolution LODs. You have to enable them also in config: viewDriverShadow = true; viewGunnerShadow = true; viewCargoShadow = true; OFP engine can also cast shadows using SHADOW BUFFER. This is controlled by model property sbsource and prefershadowvolume in geometry LOD. For trees and vegetation there can also be used so called HYBRID SHADOW. This is controlled by model property Shadow=hybrid in Geometry LOD Those shadows are cast on all models except the model itself. Trees can use special shaders for leaves that simulates self shadowing. ====== ShadowVolume on bis MLODs ====== These are statistics on the bis MLOD vegetation objects for ShadowVolume settings. 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. ====== Shadow Tutorial by Skaven ====== **Shadow Volume Tutorial** by Skaven I was asked to write a tutorial about making shadows for ArmA and so I took the opportunity to paste it here, I know this as been explained before, however, this is a dedicated thread and will be easier for future searches. 1 - Open a 10000 distance view LOD (note it's 10000 not 10.000) 2 - Make the model to use as a shadow inside the 10000 LOD (for example a weapon should be like 200/300 polys tops, of course the less the better). PS: Don't forget to delete the textures applied on the Shadows model (if you have any) since it's all black you don't need it mapped. 3 - Open a property inside your 10000 LOD and call it LODNoShadow the value is 0 4 - Open the same property (LODNoShadow) in all the other LODs but this time give it a value of 1. 5 - Inside the Shadow Lod (10000) with the entire model selected go to Structure/Topology/Find non-Closed and check if you have any opened point/faces (they get red if you do and below on your left O2 tells you the amount of them). 6 - If you do have any opened points/faces you must close them, you may try O2 to close them for you, for that go to Structure/Topology/Close, this should close the model for you, however, sometimes you need to do it by hand since this feature inside O2 as some limitations. PS: Be sure that all points/faces are closed, the best way to know this is by doing the step I wrote you before Structure/Topology/Find non-Closed and see if it gives you 0/0 on the left part below, if you miss this than not only the shadows won't work as most of the times the game will crash while loading the model. 7 - Finaly with all points/faces closed, select the entire model and go to Structure/Triangulate \ That's it, now try your shadow in game, good luck Model needs to be closed, triangulated AND sharp edged You can have more than 400 poly's in the shadow LOD. I've experimented with a 1000 poly model up to 4000 poly. It worked but with varying loading results. So it's best to keep it low to keep performance up. i found that shadows on vehicles works no matter if triangulated or not no matter LOD 30 or 10000 but on my weapons i get really stupid results i don't know why, but sometimes my weapons (after close, triangulate, 10000) look like zebra so i decided not to give shadows, now i work on making new low-poly models for shadows, but what if shadow model is different than LOD models ?\\ inner shadow can cause sick effects on weapons ? i get best results when shadow lod was almost copy of pilot view why shadows behave different ?\\ i have my graphic options on LOW, maybe this ?\\ but i really get zebra effects i gave no "LODNoShadow = 1", i gave LOD 10000 (as i was told)\\ i gave model with lower poly count as i it was in OFP maybe there should be more detailed model ?\\ all faces are closed, no "open" or "hole" faces and weapons look really really sick than half of gun is almost black on the soldiers there is "zebra" of shadow ====== Notes ====== **Armored_Sheep (bis dev)**: The LODNoShadow property is not necessary. This property is used in other lods to disable shadow projection on too complex meshes. ArmA engine uses Shadow Volume 0, Shadow Volume 10 and Shadow Volume 1000. Different values than that are not used. Shadow volume 0 is the main stencil shadow. It should have less than 1000 triangles. Shadow Volume 10 is optimized stencil shadow LOD with as few triangles as possible. Shadow 1000 is special for trees, it uses alpha transparent textures to be calculated using GPU shadow buffer. ===== Earl Summary ===== **Earl (bis dev)**: The only named property that should always be used is "LODNoShadow = 1" on all visual LODs which are >400 faces. Default behavior should be: * Use high detail SV LOD to draw stencil shadow * At distance use lower detail SV LOD to draw stencil shadow * At greater distance, use last or lower visual LODs for shadow map source, and start to fade that shadow away. ===== Hand Rails ===== **Armored_Sheep** (bis Dev) about handrail modeling in houses: Stencil buffer shadows (those sharp polygons) are not able to use alpha transparency. They are drawn by extruding triangles from ShadowVolume lod. If you choose shadow buffer casting (used on trees) you can have alpha transparent textures in shadow casting lod (you define this by properties in geometry lod) BUT you will be still limited by texture resolution (ArmA casts this shadow using single 2048x2048 texture for whole scene) At this particular model I suppose to don't put the rail in the shadow at all. (PMC edit: means its either no shadow, or model a real handrail with polygon's not just one face with alpha channel texture). ====== Closing Model ====== modEmMaik about closing shadowvolume lod mesh: I open up another O2, copy and paste the single element, which is not close-able, and try to detect the problem. Sometimes faces are doubled, which you may detect in the solid view and switch the faces (w-button). Sometimes the mesh is not closed because one edge in one face is splitt (one additional point in the same line). It looks closed, but it is not. When it is closed, I copy the mesh back. Best check for shadow LOD is to create a big box in the first visual LOD, invert the faces (w-button) of this box and check the result in the buldozer.