Jump to content

Search the Community

Showing results for tags 'applydisplacementmapfrombuffer'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. Hi, I've been messing with mesh.applyDisplacementMapFromBuffer() using a separate canvas to create a dynamic image (just messing with gradients at the moment). I'm hoping to animate the result but currently when you apply applyDisplacementMapFromBuffer() repeatedly it adds the new displacement map to the existing displaced map so things get a bit crazy looking. So basically I need something to call to before applyDisplacementMapFromBuffer() that restores the mesh to it's original state. I've looked at setVerticesData, updateVerticesData, setVertexBuffer and not got anywhere, once they're called the applyDisplacementMapFromBuffer has no effect. Here's some vague example code: var plane = BABYLON.Mesh.CreateGround("plane", 192, 108, 100, scene, true); var originalVertices = plane.getVerticesData(BABYLON.VertexBuffer.PositionKind); mergeCanvas = document.getElementById("mergemap") var mergeCTX = mergeCanvas.getContext('2d'); var mw = mergeCanvas.width; var mh = mergeCanvas.height; engine.runRenderLoop(function() { // imagine some stuff happens here to draw into the mergeCTX var buffer = mergeCTX.getImageData(0, 0, mw, mh).data; // reset needs to happen here plane.updateVerticesData(BABYLON.VertexBuffer.PositionKind,originalVertices) plane.applyDisplacementMapFromBuffer(buffer, mw, mh, 0, 1); }); Sorry for the fairly vague info but any pointers will be much appreciated. Cheers, Rob
×
×
  • Create New...