The Leftover

  • Content count

  • Joined

  • Last visited

  • Days Won


The Leftover last won the day on July 1

The Leftover had the most liked content!

About The Leftover

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. The Leftover

    Web Assembly

    The heartbreak of today was that the module I snipped this from runs faster in JavaScript. In other areas, I have reaped a 3x speedup with WebAssembly. I believe that issue is that there is substantial overhead in entering and exiting WebAssembly. You want the work it does while there to be large enough to make up the overhead and still give you a win. Gonna go soak my head . . .
  2. The Leftover

    Web Assembly

    Jerome, thanks. I usually do something like this. I create a module config object, and attach the memory there. This hands in whatever settings are needed and the memory. Now both JavaScript and WebAssembly can access the same typed array using 'hexlatticeMemoryView' and 'i32.load'/''. I treat the WebAssembly module as a persistent "closure". Some of them have four or five function entry points. JAVASCRIPT JAVASCRIPT JAVASCRIPT JAVASCRIPT JAVASCRIPT hexlatticeImportObject = { settings : { weekbreaksLength : weekbreaks.length*4, weekbreaksStart : 16, monthBreaksLength : 0, monthBreaksStart : 16+weekbreaks.length }, imports : { log : console.log } }; hexlatticeMemory = new WebAssembly.Memory({initial:1}); hexlatticeMemoryView = new Uint32Array(hexlatticeMemory.buffer); hexlatticeImportObject.imports.mem = hexlatticeMemory; JAVASCRIPT JAVASCRIPT JAVASCRIPT JAVASCRIPT JAVASCRIPT WEBASSEMBLY WEBASSEMBLY WEBASSEMBLY WEBASSEMBLY WEBASSEMBLY (module (import "imports" "log" (func $log (param i32))) (memory (import "imports" "mem") 1) (global $weekbreaksstart (import "settings" "weekbreaksStart") i32) (global $weekbreakslength (import "settings" "weekbreaksLength") i32) WEBASSEMBLY WEBASSEMBLY WEBASSEMBLY WEBASSEMBLY WEBASSEMBLY
  3. The Leftover

    ArcRotateCamera zoom to mouse position I do this. It looks good. Code is below. At first glance it looks readable. No warranty. function animateCameraToTargetAndPosition(camera,newPosX,newPosY,newPosZ,zoom,newAlpha,newBeta){ var radiusAnimation = new BABYLON.Animation("camRadius", "radius", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT), alphaAnimation = new BABYLON.Animation("camAlpha", "alpha", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT), betaAnimation = new BABYLON.Animation("camBeta", "beta", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT), targetAnimation = new BABYLON.Animation("camTarget", "target", 30, BABYLON.Animation.ANIMATIONTYPE_VECTOR3, BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT), newTarget = new BABYLON.Vector3(newPosX,(Ø.tyN(newPosY)?newPosY:ψ(0)),newPosZ), thenStopCA = ()=>setTimeout(stopCA,150), newRadius = Ø.PN(zoomLevel[zoom])?zoomLevel[zoom]:zoomLevel[0],alpha,beta,radiusKeys,alphaKeys,betaKeys,targetKeys,twoPI=pi+pi; startCA(); newAlpha = Ø.tyN(newAlpha)?newAlpha:standardAlpha; newBeta = Ø.tyN(newBeta)?newBeta:standardBeta; alpha = (camera.alpha+twoPI) % twoPI; beta = (camera.beta+twoPI) % twoPI; targetKeys = [{ frame : 0, value : }, { frame : 100, value : newTarget }]; radiusKeys = [{ frame : 0, value : camera.radius }, { frame : 100, value : newRadius }]; alphaKeys = [{ frame : 0, value : alpha }, { frame : 100, value : newAlpha }]; betaKeys = [{ frame : 0, value : beta }, { frame : 100, value : newBeta }]; targetAnimation.setKeys(targetKeys); radiusAnimation.setKeys(radiusKeys); alphaAnimation.setKeys(alphaKeys); betaAnimation.setKeys(betaKeys); camera.animations.push(targetAnimation); camera.animations.push(radiusAnimation); camera.animations.push(alphaAnimation); camera.animations.push(betaAnimation); scene.beginAnimation(camera,0,100,false,5,thenStopCA); };
  4. The Leftover

    Web Assembly

    Gentlemen, thank you for the links. Let me some opinions base on three days of work. I started writing in straight WAT. Because I have a genetic defect that causes me to do things the hard way. However, it has caused me to learn a lot of things. WebAssembly is at the "MVP" stage as they call it. One can only create a module with functions below that - two levels. One can create a list of which functions may be exported. The MVP status shows: I couldn't figure out how to make a module-global variable that was mutable; so I did a work-around. One can share a typed array between JS and WA. In WA, it is called "memory" but there may only be one of them. I redesigned things a bit so all processing was applied against one array. This could put a crimp in my style. Is it possible the "C" converter bypasses these functionality bottlenecks? It seems a little unlikely; I think wat is the textual representation of wasm and they go hand-in-hand. They do appear to be beavering away at this much as we are here. The integration makes it *NOT* an all or nothing kind of thing. When the module is built, it can receive JS functions, notably console.log. So I can log things to the console. I could make other JS calls if I wanted. Exported functions are just a function. You can call it from JS. (If you print them it says "native code", which gave me a kick.) In light of this, I am pushing forward with creating limited functions for the three or four places where Illuminated City sits for more than a second. It requires some re-organization but I have the substantial advantage of being the only author. I can also write these functions in JS. That part is really neat; the array is one array and looks the same whether the manipulation was done by JS or WA. This will be helpful for testing.
  5. The Leftover

    Web Assembly

    I should not being doing this . . . but I have been experimenting with Web Assembly. With so many hexagons and so many crime incidents, Illuminated City has come computationally intensive tasks. My question is, have y'all tried to use it for some functions (e.g. ComputeNormals)? Did it perform well? Did it seem worthwhile?
  6. The Leftover

    Illuminated City

    A couple interesting things in this video: 1) This is Los Angeles with 250K cells (probably 75K visible hex prisms in this demo). When I optimize for SPS, the performance is really pretty amazing. 2) You see the navigation inspired by Wingnut's suggestion to change focus. I did clip out some waiting periods but the video is all 1X speed.
  7. The Leftover

    Bezier Surface

    Pretty splendid!
  8. The Leftover

    Text as polygon mesh

    When you have a hammer, problems look like nails. I would like users to be able to move the Arc Rotate Camera focal point to different spots around the city. To help communicate that, I needed a "focal point marker" to show the current point on the map. I picked an anchor. (Anyone with a better idea is hereby given the mic.) Constructing a 3D anchor from an SVG rendering of an anchor turned out to be essentially the same exercise as creating a letter. So, in a repetition of history, I created a new font family called "WebGL Dings"
  9. The Leftover

    Real-time 3D flight display

    Last week, I discovered that real-time aircraft flight data is available through an open API. Two, in fact. Already having a city, I decided show overflights. I put in a five-minute delay to permit me to smooth the data but this is almost real-time. Video shows FedeX coming into SFO over San Francisco. This is not very zoomy but it feels signficant. I am not entirely sure what to do with it. Airplane model was built out of cardboard, dowels, plywood and rubber bands.
  10. The Leftover

    Text as polygon mesh

    Updates: More glyphs, including some non-English letters (e.g. ñ). meshwriter.min.js size is below 100K. I will try to keep it there but we will see. In review, fonts are: ~ Helvetica: Default, efficient and most glyphs. Use this one ~ HirukoPro: 'cause I use it ~ Comic: just a couple letters right now ~ Jura: I like it for numbers
  11. The Leftover

    Text as polygon mesh

  12. The Leftover

    Marking questions as solved

    Can we pin that GIF to the top of this board or something? It is sortof a community thing. If most people start using it, others will too.
  13. The Leftover

    Text as polygon mesh

    I think you and I have pegged the needle on opposite sides of the creativity scale. I might steal. Illuminated Cities are a rectangle floating on sky-texture. Everything goes on the rectangle for now . . . except when I did this, ( I rotated the date numbers for y'all to see them. For me, a radical departure. It then occurred the me that the "low wall" around the city rectangle could hold useful information. I don't think I will try a circle but I am keeping it in mind. In other news, Helvetica does not yet support single and double quote but I will add them.
  14. The Leftover

    Illuminated City

    The data is actually official city data -- many cities offer is as part of an open data trend. We work with San Francisco, Chicago, Los Angeles and Boston. This only looks at where and when. There are absolutely other correlations to be made. For example, February is always the lowest crime month in Chicago, by a consistent percentage. I don't look at stadium events, national holidays or anything else. I can see many other trends when I am fiddling around. For example, theft from auto is geographically concentrated but auto theft is not. Violent (assault) has strong place and time patterns. Burglary also has patterns but less pronounced.
  15. The Leftover

    Illuminated City

    After months of painful number-crunching, I have built a demo of something that shows the trend associated with crimes. There is a theory that some crime-types have micro-geographic behavior -- and staying on top of those trends can help target police patrols. This is a rendering of burglaries in part of San Francisco for about a year. Red is rising, green is falling, blue is neither. The elevation indicates the frequency of burglaries with some geographic weighting. The video clip is running at 3X so the visualization is rendering pretty fast. I cannot do a whole city at once.