njord Posted October 8, 2011 Share Posted October 8, 2011 Hello guys. We are using the daynight script downloaded from this forum in our scene. However, during day night cycle, a circular shadow pops up. The problem sometimes occurs after a single cycle, sometimes it just pops up after many cycles. The shadow accumulates slowly as a circle. I could not deterministically recreate the problem. but there are some screenshots attached. I have played with shadow settings , thinking if this is related to shadow acne problem. But none helped, maybe they affected the time for the problem to occur , i am not sure. By the way, tell me please, What is / How to use exponentialOffset in the following function : void SetShadowOffset( TEntity light, flt linearOffset, flt exponentialOffset, int stage ) what is the proper parameters for the below functions ? (part of daynight lua i modified) : object.light = CreateDirectionalLight() LightRange(object.light,7500)--HACK SetShadowDistance(object.light, 24, 0)--HACK SetShadowDistance(object.light, 120, 1)--HACK SetShadowDistance(object.light, 240, 2)--HACK SetShadowmapSize(object.light,2048)--HACK SetShadowQuality(1)--HACK SetShadowSoftness(object.light,0)--HACK SetShadowOffset(object.light, 0.31*2, 1.0, 0)--HACK SetShadowOffset(object.light, 0.40*3, 1.0, 1)--HACK SetShadowOffset(object.light, 0.70*4, 1.0, 2)--HACK SetShadowOffset(object.light, 1.50*5, 1.0, 3)--HACK Another screenshot, daynight script - around midday - circular shadow around camera Quote Link to comment Share on other sites More sharing options...
Canardia Posted October 8, 2011 Share Posted October 8, 2011 You can't use LightRange on DirectionalLight, it will only cause bugs. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Josh Posted October 8, 2011 Share Posted October 8, 2011 The light range on directional lights indicates the scale over which the shadow depth is distributed. A larger range will eliminate shadow artifacts that occur when geometry intersects the near camera range when the shadow is rendered. I can't tell from your images if this is the case for sure, but that's the only thing I've ever seen cause a problem. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
njord Posted October 9, 2011 Author Share Posted October 9, 2011 Even if I dont use lightrange on directional light, the bug exists. Josh, are you saying I should use even larger ranges for lighting ? BTW this interesting circular shadow pops up after a while during day cycling (- not immediately). Also, can u explain me the parameters of SetShadowOffset and SetShadowDistance ? Am I using them right in my code ? Thanks. Quote Link to comment Share on other sites More sharing options...
Josh Posted October 9, 2011 Share Posted October 9, 2011 The shadow distance parameter controls the distances at which the directional light stages switch to the next lowest res image. There are three stages in a directional light shadow. You'll need to play around with the values to get the result you want. The shadow offset gives a slight offset to the shadow. Actually, I think this is probably causing your problem...increase it and see what happens. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
njord Posted October 9, 2011 Author Share Posted October 9, 2011 I already tried playing with these parameters : SetShadowOffset(object.light, 0.31*2, 1.0, 0)--HACK SetShadowOffset(object.light, 0.40*3, 1.0, 1)--HACK SetShadowOffset(object.light, 0.70*4, 1.0, 2)--HACK SetShadowOffset(object.light, 1.50*5, 1.0, 3)--HACK Can u give me a specific combination for the 0 1 2 3 rd stages ? What about the second exponential parameter ? Quote Link to comment Share on other sites More sharing options...
Josh Posted October 9, 2011 Share Posted October 9, 2011 The defaults are 0.31, 0.40, 0.70, and 1.50. I can't help you beyond that unless you post an example program I can run or a scene I can load in the editor. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
njord Posted October 10, 2011 Author Share Posted October 10, 2011 Up until now our scenes with these problematic circular shadows consisted of gmfs only. Meaning we dont have a terrain with heightmap, but only gmfs positioned around. So I have performed another test which includes a small 128x128x1m planar terrain and a part of airport (a simple gmf). *Surprisingly, circular shadow does not fall onto the heightmap terrain, but only on airport model. *I used DayNight_1_3.zip downloaded from asset store without any modification. (Older version of Daynight used to produce the same bug though) *I started daynight cycle at 6.30 AM with a 10-15 updaterate, in LE Editor 2.5. (LE 2.4 used to produce the same bug though) *This problem also occurs on different scenes other than the airport scene attached. - We have seen the problem on many different computers. You can check out the attached scene and reproduce the error. Sometimes you have to give it a long wait You can leave your daynight cycle and check back a few hours later maybe. I will also link a video of the bug, as soon as I can shrink it and upload to the web Thanks! The defaults are 0.31, 0.40, 0.70, and 1.50. I can't help you beyond that unless you post an example program I can run or a scene I can load in the editor. Josh, what about the second exponential parameter in this function, how to use it, what are the default values of it ? I am asking this, because I think by playing with exponential values (instead of 1.0 using values like 1.1, 1.2, 1.3, 1.4 ....) I see circular shadow patterns very similar to our problematic shadows. Quote Link to comment Share on other sites More sharing options...
njord Posted October 10, 2011 Author Share Posted October 10, 2011 And here is the video : if cannot open, plz download some common codec pack Quote Link to comment Share on other sites More sharing options...
njord Posted October 10, 2011 Author Share Posted October 10, 2011 Quick tip : In editor, open up the scene I attached. Then open up your daynight lua. After the object.light = CreateDirectionalLight() line, insert the below code chunk. You will have a very similar looking-behaving shadow - Although not sure if they are the same. LightRange(object.light,7500)--HACK SetShadowDistance(object.light,8,0)--HACK SetShadowDistance(object.light,40,1)--HACK SetShadowDistance(object.light,80,2)--HACK SetShadowmapSize(object.light,2048)--HACK SetShadowQuality(1)--HACK SetShadowSoftness(object.light,0)--HACK SetShadowOffset(object.light,0.31*5, 5.0, 0)--HACK SetShadowOffset(object.light,0.40*10, 10.1, 1)--HACK SetShadowOffset(object.light,0.70*15, 15.2, 2)--HACK SetShadowOffset(object.light,1.50*20, 20.3, 3)--HACK Quote Link to comment Share on other sites More sharing options...
Josh Posted October 10, 2011 Share Posted October 10, 2011 I opened your scene in the editor and set the time of day to 12 noon and don't see any problem: Don't set the light range to 7500. By default it is around 300. With directional lights, this is the depth over which the shadow is rendered, from the point of view of the light camera, when rendering the shadow. The second value of SetShadowDistance() should always be 1.0 for directional lights. 1.1 will render a slightly larger range of depth, skewing the results towards the shadow camera the further away a pixel is. 0.9 would tend to stretch the shadow away from the shadow camera. These values can be useful for point lights, because you can't use a linear shift and get the edges of the cubemap to line up, but multiplicative will work. Without a scene that demonstrates the problem I cannot help you any further. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
njord Posted October 11, 2011 Author Share Posted October 11, 2011 Thanks for the information. As I said, the problem does not occur immediately when u open up the scene in the LE Editor. With (non-modified %100 default) daynight script, I left out daynight cycling (started at 6.30 with update rate 10 or 15) and went to lunch. Then I recorded the video you have seen in this post. So problem is there, but unfortunately I still cannot create it deterministically. I have seen this problem in LE 2.4 and 2.5, in daynight 1.0 and 1.3 . This bug existed in our apps for severel months, however lately we've been seeing it far more frequently. It may take seconds, minutes or hours before the bug occurs (random ?). This bug has been observed in multiple computers and LE scenes. The bug has been seen in both LE Editor and in our LE applications. Using daynight script's GUI in the Editor and changing values there -especially day time and update rate may help re-create the problem. Until I find a deterministic way to recreate the problem, just do this : Open up editor and load the scene I attached. Make daynight script time 6.30 AM. Set update rate to 10, daynight must be CYCLING with some rate. Go to a shady part of the airport. Leave it like that and have lunch or dinner. Hopefully you will see the same problem when u return. Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.