Chat log from the meeting on 2018-03-20

tl;dr: - Andrew works on bird module - Kayaker about to submit his first patch to OS regarding precision of trigonometric functions - Status of scripted changes to materials [11:12] Andrew.Hellershanks @hg.osgrid.org: Welcome everyone. I'm not sure if we will have some late arrivals or not today. The clocks may not have changed for some of our regulars yet. [11:12] Kayaker Magic hates Daylight Wastings Time. [11:12] George Equus: !!! [11:12] Sheera Khan: Next week EuroLand will be on DST too ;-) [11:13] George Equus: Sunday [11:13] Andrew.Hellershanks @hg.osgrid.org: I had a feeling they changed their clocks two weeks later. [11:18] Andrew.Hellershanks @hg.osgrid.org: This past week I've been working on the Birds module. I have been making some changes to how it finds its settings and making it disable itself if it can't find the setting that controls whether the module should be enabled or not.. [11:18] Kayaker Magic: I have a report about the round-off errors I was whining about last week: [11:19] Andrew.Hellershanks @hg.osgrid.org: I still have some work to do on it as it doesn't seem to always get its settings properly. [11:19] Andrew.Hellershanks @hg.osgrid.org: Its working in my standalone but not in a grid but I can see the module settings in both places where I'm testing the module. [11:20] Andrew.Hellershanks @hg.osgrid.org: I will be doing some more testing before adding some additional settings to make the module more generally useful. [11:21] George Equus: Still trying to figure out how to use the Bird module lol  Instructions are for programmers I think.. [11:23] Kayaker Magic: Last week Andrew pointed me at the libomv sources which had all the vector classes declared with floats, [11:23] Andrew.Hellershanks @hg.osgrid.org: George, one thing to know about it is the enabled setting controls whether birds are shown. The startup setting controls if the module is enabled. That is something I recently fixed. I renamed those two controls. [11:23] Kayaker Magic: As I looked into it, I found that xengine has it's own math classes and uses LSL_VECTOR instead of the VECTOR3 class in libomv [11:23] Andrew.Hellershanks @hg.osgrid.org: You need to rez the prim that will be used by the module as the bird before you start the birds flying. [11:23] Kayaker Magic: And LSL_VECTOR is already using doubles [11:24] Andrew.Hellershanks @hg.osgrid.org: George, If you catch me on IRC later I can help you more with the module. [11:24] Kayaker Magic: so I'm tracking down the sources of round-off errors and finding that some core code uses LSL_VECTOR and others use VECTOR3.... [11:25] Kayaker Magic: I've written several test scripts to demonstrate "errors" only to discover that they are normal floating point errors and "fail" even with doubles on IW and SL [11:25] Andrew.Hellershanks @hg.osgrid.org: Kayaker, interesting and slightly odd that it isn't using the libomv vector code. [11:26] Andrew.Hellershanks @hg.osgrid.org: I suppose there was a reason for that. [11:26] Kayaker Magic: So I'm looking into a bigger change of switching classes in one of the core source files... [11:27] Kayaker Magic: In the mean time, I did find a simple fix to solve a common error in llAcos, I'll be submitting that as my first patch ever! [11:27] George Equus: OK, thanks Andrew :) [11:28] Kayaker Magic: llAcos returns NAN for numbers out of range, but even doubles can result in values that are 0.0000001 out of range sometimes. [11:28] Kayaker Magic: So I'm putting in a test for that. [11:29] Andrew.Hellershanks @hg.osgrid.org: Kayaker, have you tested the other arc trig functions to see if they have a similar problem? [11:29] Kayaker Magic: It is a nice small change for me to get my feet wet learning to make  a patch. [11:30] Kayaker Magic: Yes, the patch will fix llAcos also. [11:30] Kayaker Magic: Tangent does not have the issue. [11:30] Arielle.Popstar @hg.osgrid.org: its  the  code  :) [11:30] Ubit Umarov: hmm patch? what patch? [11:30] Andrew.Hellershanks @hg.osgrid.org: I was thinking of asin and atan [11:30] Kayaker Magic: I'm getting ready to submit my first patch to OpenSim! [11:30] Arielle.Popstar @hg.osgrid.org: yay Kay [11:30] Ubit Umarov: oh dear.. [11:30] Ubit Umarov: :p [11:30] Kayaker Magic: LOL [11:30] Andrew.Hellershanks @hg.osgrid.org: :) [11:31] Ubit Umarov: ;) [11:31] Andrew.Hellershanks @hg.osgrid.org: Ubit, do you remember if there are regressions tests for the math operations? [11:32] Ubit Umarov: they just follow c# [11:32] Andrew.Hellershanks @hg.osgrid.org: ok. [11:32] Kayaker Magic: I'll run those before I submit.... [11:33] Andrew.Hellershanks @hg.osgrid.org: Kayaker, ok. [11:34] Kayaker Magic: But I have a lunch to get to, so I'll be ducking out of this meeting early... [11:34] Andrew.Hellershanks @hg.osgrid.org: np, Kayaker. If you need help with preparing and submitting a patch you can hit me up on Skype. [11:35] Kayaker Magic: I was counting on your help Andrew! [11:35] Andrew.Hellershanks @hg.osgrid.org: First step will be to get you signed up with an account in mantis. [11:35] Sheera Khan: yayyy for a new contributor;-) [11:35] Ubit Umarov: https://msdn.microsoft.com/en-us/library/system.math.sin(v=vs.110).aspx [11:35] Kayaker Magic: Do I need a new account? Or just th one I have upgraded? [11:35] Andrew.Hellershanks @hg.osgrid.org: Sheera, It all starts with that first contribution then we rope them in to more stuff. ;) [11:36] Kayaker Magic: LOL [11:36] Andrew.Hellershanks @hg.osgrid.org: I didn't know if you already had a mantis account or not. [11:36] Kayaker Magic: I have submitted a lot of bugs over the years [11:36] Andrew.Hellershanks @hg.osgrid.org: When you stated you may need some help I was assuming you didn't have an account. [11:36] Andrew.Hellershanks @hg.osgrid.org: ok. [11:37] Kayaker Magic: help with the construction of a patch, best way to write it up... [11:37] Ubit Umarov: btw whats the issue with math ? [11:37] Andrew.Hellershanks @hg.osgrid.org: The only extra bit you will need to know is how to generate the patch file from git. [11:37] Andrew.Hellershanks @hg.osgrid.org: am formatted patches are best. [11:38] Ubit Umarov: no they are not the best... they are the only ones :p [11:38] Kayaker Magic: While looking for that llGetCameraRot issue, I found llAcos returns NAN for inputs that are just 0.0000001 out of bounds, a common event even in doubles. [11:38] Kayaker Magic: So I'm putting in a test for that. [11:38] Andrew.Hellershanks @hg.osgrid.org: Ubit, well, I meant best vs. just submitting a simple diff. [11:38] Ubit Umarov: http://opensimulator.org/wiki/Submitting_code_to_OpenSim [11:39] Andrew.Hellershanks @hg.osgrid.org: Kayaker, there you go. That link is for a page that tells you what you need to know. [11:39] Ubit Umarov: public LSL_Float llAcos(double val) {           m_host.AddScriptLPS(1); return (double)Math.Acos(val); } [11:40] Ubit Umarov: hmm why a cast there? hmm whatever [11:40] Andrew.Hellershanks @hg.osgrid.org: yea, I was wondering the same thing. [11:40] Ubit Umarov: https://msdn.microsoft.com/en-us/library/system.math.acos(v=vs.110).aspx [11:41] Kayaker Magic: public LSL_Float llAcos(double val) {           m_host.AddScriptLPS(1); const double TRIG_THRESHOLD = 0.0000001f;  //Kayaker: roundoff errors can result in values slightly above 1.0 if (Math.Abs(val) > 1f && (Math.Abs(val)-1f)<TRIG_THRESHOLD)       //llAcos should forgive this and return (double)0.0;                                            //return 0 degrees as if this was +/-1.0 return (double)Math.Acos(val);                             //else return the normal value } [11:42] Ubit Umarov: well out of bouds is out of bounds... [11:42] Kayaker Magic: I have a test script that generates random unit vectors and about 3% of them have a length that is slightly above 1.0 and causes NaN. [11:42] Ubit Umarov: if fixing 0.0000001f will not fix 0.0000002f; [11:43] Kayaker Magic: Well, you do want NaN for "way out of bounds" [11:43] Ubit Umarov: unit vectors with len > 1.0 ? [11:43] Kayaker Magic: And round off error on double calculations never gets bigger than 1e-6 [11:45] Kayaker Magic: all floating point calculations have finite resolution, there are many vector angles that cannot be constructed with exactly length 1.0 [11:45] Ubit Umarov: yeah i know [11:46] Kayaker Magic: This isn't an important fix, it is just a little one that will get my feet wet doing a patch! [11:46] Ubit Umarov: well and that should b public LSL_Float llAcos(LSL_Float val) [11:46] Ubit Umarov: grrrrr [11:46] Kayaker Magic: No, libomv uses float, LSL_Types uses all doubles. [11:47] Ubit Umarov: LSL_Float IS a double [11:47] Ubit Umarov: the API should be coherent [11:48] Kayaker Magic: Some of the code uses libomv VECTOR3 which is 3 floats, some of the code (especially xengine) uses LSL_VECTOR which is three doubles. There are even constructors for converting. [11:48] Ubit Umarov: ( well and one day we may decide to make it a float [11:48] Kayaker Magic: or a double. [11:48] Kayaker Magic: hehe [11:48] Kayaker Magic: (them's fighting words) [11:49] Ubit Umarov: don't understand what ppl had i mind with that... [11:50] Ubit Umarov: SL float is a float not a double [11:50] Ubit Umarov: some over cleveness does have costs.. bahh [11:50] Andrew.Hellershanks @hg.osgrid.org: The in and out can be a float but the internal calculations can be done using doubles [11:51] Ubit Umarov: trig and other are doubles yes.. but thats internal... [11:52] Ubit Umarov: just bc happens c# math prefers doubles [11:52] Andrew.Hellershanks @hg.osgrid.org: Right. libomv does the calculations internally using floats. [11:52] Ubit Umarov: as i said last week we are in low precision gaming code [11:54] Bill.Blight @grid.opensim.life:8002: while I agree there needs to be consistency where it might be missing, what need to we have for that type of resolution? Our viewer engine does not make use of things that precise. [11:54] Ubit Umarov: doubles are rare in "gaming" [11:55] Bill.Blight @grid.opensim.life:8002: Isn't it just wasting calc time, how ever small? [11:55] Ubit Umarov: well not on tradicional intel fpu.. it did all math in double [11:55] Ubit Umarov: but its a waste of memory [11:55] Andrew Hellershanks: We can wait for the bug report that will explain the problem in details and how to reproduce it before deciding the need to fix it. [11:56] Bill.Blight @grid.opensim.life:8002: I mean why calculate to a billionth of a meter if the viewer resolution is only to one hundred thousandth ? [11:56] Ubit Umarov: and new SIMD has floats, more recently doubles, and on that doubles do have performance hit [11:56] Andrew Hellershanks: Right. There are tradeoffs. [11:56] Ubit Umarov: well i don't understand why ppl in past decided to go for doubles [11:57] Ubit Umarov: it is not LSL spec [11:57] Bill.Blight @grid.opensim.life:8002: maybe they were hoping we'd get a higher resolution viewer [11:57] Ubit Umarov: no we will not for yrs to come [11:57] Bill.Blight @grid.opensim.life:8002: Oh I agree [11:57] Bill.Blight @grid.opensim.life:8002: wishful thinking? [11:58] Ubit Umarov: on faster hardware doubles do cost more [11:58] Andrew Hellershanks: Perhaps some people doing simulations felt they needed the increased precision. [11:58] Ubit Umarov: just did not on old 8087 days ... [11:58] Bill.Blight @grid.opensim.life:8002: And again regardless of the cost, if they can't be used as an effective source for resolution, then it is not really a good use of the code anyway [11:58] Ubit Umarov: well it is not LSL spec [11:59] Ubit Umarov: so i don't understand.. [12:00] Ubit Umarov: the LSL "float" type is a floating point data type that uses 32 bit in IEEE-754 form. If a number is written with a decimal point in LSL, then it is taken to be a float. The valid range is 1.401298464E-45 to 3.402823466E+38 [12:00] Ubit Umarov: quote from sl wiki [12:01] Ubit Umarov: but well im not going to change that now [12:01] Andrew Hellershanks: That being the case the cast shown earlier should be to float and not double. [12:01] Andrew Hellershanks: No, that could lead to opening a can of worms [12:02] Andrew Hellershanks: Any other pressing issues for today? [12:02] Ubit Umarov: return (double)Math.Asin(val); is just waste typing. Math.Asin does return a double [12:03] Ubit Umarov: and for coerence should also be (LSL_Float) [12:03] Andrew Hellershanks: Right. If that return is an LSL value it should cast to float. [12:03] Andrew Hellershanks: git blame will say how long that issue has existed. [12:03] Bill.Blight @grid.opensim.life:8002: well he did state earlier that it also failed in IW and SL [12:04] Ubit Umarov: well that mess of casts is possible a reason why Yengine is a bit faster than X [12:04] Bill.Blight @grid.opensim.life:8002: [11:25] Kayaker Magic: I've written several test scripts to demonstrate "errors" only to discover that they are normal floating point errors and "fail" even with doubles on IW and SL [12:04] Ubit Umarov: guess since early days.. ppl wanted to be better than sl [12:04] Andrew Hellershanks: Could be. [12:05] Bill.Blight @grid.opensim.life:8002: If they fail there then this is not a bug fix this is a new feature [12:05] Andrew Hellershanks: I'd run git blame to check the age of that code but I don't feel like tracking down the file. [12:05] Ubit Umarov: error control in math is very tricky [12:05] Ubit Umarov: in numerical math [12:05] Ubit Umarov: i had 2 semesters in univ about that if i remember :p [12:06] Ubit Umarov: well did forgot all LOL [12:06] Andrew Hellershanks: There was something about an epsilon value, IIRC. [12:06] Andrew Hellershanks: Referring to the amount of error. [12:07] Ubit Umarov: ODE does have same care on that [12:07] Ubit Umarov: order of operations do matter [12:07] Ubit Umarov: etc [12:08] Ubit Umarov: a*(b+c) is not a*b + a*c for example [12:08] Ubit Umarov: not with finite precision math [12:09] Andrew Hellershanks: Well, depends on how you look at it. In theory it is the same but in practice it may not be. [12:09] Ubit Umarov: i said, it is not the same with finite precision math [12:10] Arielle Popstar: so what about  this  materials  thing [12:10] Arielle Popstar: not  being  able  to script  changes  to it? [12:10] Ubit Umarov: what materials? [12:10] Ubit Umarov: ahh those [12:10] Arielle Popstar: something  about  flooding  server  with  assets [12:10] Ubit Umarov: uff thats a huge pain [12:10] Arielle Popstar: or potential  to [12:10] Ubit Umarov: SL materials should had not been made as assets [12:10] Bill.Blight @grid.opensim.life:8002: So in reality what is being talked about is a change in basic function, so a particular script function can be used how it was never intended? [12:11] Bill.Blight @grid.opensim.life:8002: (not talking about the materials thing still on the math) [12:11] Arielle Popstar: Hy mentioned  that  in opensim.ini  there  is   a  default  100 asset  upload  per  script [12:11] Ubit Umarov: guess who made them was thinking about other game engines materials.. [12:11] Arielle Popstar: how can  the  server  be  flooded   with that in place? [12:11] Ubit Umarov: but those are totally dif beasts ( that include the diffusion texture etc ) [12:12] Ubit Umarov: and SHADERS off [12:12] Arielle Popstar: what about the   asset  limit? [12:12] Bill.Blight @grid.opensim.life:8002: Materials are not like normal textures, they get copied everytime they are applied if I am not mistaken [12:12] Ubit Umarov: as SL made them, they are just a normal texture [12:13] Ubit Umarov: thing is that dahlia made them as just extensions to parts.. [12:13] Arielle Popstar: the fear  for  opensim  is that  it  could  be  used  to mess  the  database  and  server [12:13] Ubit Umarov: but then they where converted into full assets [12:13] Andrew Hellershanks: That reminds me that I was having aproblem uploading a mesh in 0.9 that loaded easily in 0.8 but that's a problem for another time. [12:13] Arielle Popstar: by Kitely [12:13] Arielle Popstar: \ [12:13] Ubit Umarov: and now that makes script changes a pain [12:13] Arielle Popstar: cant be  reverted [12:14] Ubit Umarov: bc yes.. DBs can be flooded [12:14] Arielle Popstar: i did hear though  from  another  dev  that assets  are  better [12:14] Ubit Umarov: guess the one on made them assets :p [12:14] Arielle Popstar: not if  there  is an asset  limit  in place [12:14] Arielle Popstar: kitely is  on  .8.2 [12:14] Ubit Umarov: there is no assets limite [12:14] Arielle Popstar: this is  .9 [12:14] Arielle Popstar: lots of  differences [12:15] Ubit Umarov: at most throotle [12:15] Arielle Popstar: i heard it  was  100 [12:15] Arielle Popstar: in opensim.ini [12:15] Bill.Blight @grid.opensim.life:8002: If it is true that unlike textures which uses existing assets, and materials get copied when applied, then rapidly changing materials via a script over a long time could give the asset server a stroke [12:16] Ubit Umarov: so well that lsl suport of materials is a open issue [12:16] Ubit Umarov: this sl materials are just 2 textures IDs and a few numbers [12:16] Ubit Umarov: non sense being proper assets [12:17] Ubit Umarov: but guess it was original SL mess since they do get a ID also [12:18] Arielle Popstar: so why  cant  it  be  reverted  then if  there  is  no  solution  to  the  asset  issue? [12:20] Ubit Umarov: but to be proper materials bc it can't.. its on dbs now [12:20] Ubit Umarov: and as i said the way viewers give them a id is also a pain [12:20] Ubit Umarov: bc see.. all texture related parameters are LOCAL to the region only [12:21] Ubit Umarov: are properties of that object on the region... [12:21] Arielle Popstar: nod [12:21] Ubit Umarov: materials just add more properties that are just the same type [12:21] Ubit Umarov: and those on textures, are only stored on the object, and on region objects dbs [12:22] Ubit Umarov: not on grid [12:22] Ubit Umarov: only when we do copy to inventory, the object gets into grid [12:22] Ubit Umarov: well if i remember :) [12:22] Ubit Umarov: so we can edit the objects with no worries [12:23] Ubit Umarov: change the texture rotation etc etc etc [12:23] Arielle Popstar: so but  then anyone  visiting  the  region  will see  the material  from  the  regions db [12:23] Ubit Umarov: but when made as assets, they are grid assets.. [12:23] Arielle Popstar: and  assume  when  taken  to  inventory and  transferred  to another, that  one  will see  the  materials wherever  they are [12:24] Ubit Umarov: as it was, using the mouse whell to change some materials numbers did created tons of assetsd [12:24] Ubit Umarov: i did reduce that a lot now.. but still nasty [12:25] Arielle Popstar: i see [12:25] Arielle Popstar: so  no  resolution [12:25] Ubit Umarov: there will be some.. oneday [12:26] Arielle Popstar: cant  the  extras  go to a  temporary cache? [12:26] Arielle Popstar: and  only save  the  one? [12:26] Ubit Umarov: i added timed throttles [12:27] Ubit Umarov: but i'll need first to try to understand what the ll guy who made that was thinking [12:27] Sheera.Khan @hypergrid.org:8002: wasn't there a setting in OpenSim.ini to the effect that only those changes are submitted to the grid db which last for at least x minutes? [12:27] Arielle Popstar: the sweep thing Sheera? [12:28] Sheera.Khan @hypergrid.org:8002: I'm not sure at all there just rang a bell in the back of my skull ^^ [12:29] Ubit Umarov: thats about objects persistance [12:29] Ubit Umarov: i think [12:29] Arielle Popstar: yes [12:29] Sheera.Khan @hypergrid.org:8002: but something like that could be a cure for the overload [12:29] Ubit Umarov: ie same issue but storing on region DB [12:29] Ubit Umarov: well i just said i did made the same on materials [12:30] Ubit Umarov: private void EventManager_OnBackup(ISimulationDataService datastore, bool forcedBackup) {           List toStore; List hashlist; lock (m_Materials) {               if(m_changes.Count == 0) return; if(forcedBackup) {                   toStore = new List(m_changes.Values); [12:30] Ubit Umarov: blablabla [12:30] Sheera.Khan @hypergrid.org:8002: Oops sorry, I was busy pruning the log and just got the idea [12:31] Ubit Umarov: features["MaxMaterialsPerTransaction"] = m_maxMaterialsPerTransaction; ? [12:31] Ubit Umarov: you where asking about this? [12:32] Arielle Popstar: not sure  Ubit. To a  point  i am  parroting  what  i  heard  and  read [12:32] Ubit Umarov: this is just telling viewers to not abuse :) [12:33] Arielle Popstar: ok well  thought  i would  ask [12:34] Arielle Popstar: maybe  if  someone  reads  the  log  there  might  be  a  solution  put  forth