Jump to content

Procedural refraction texture?


Recommended Posts

I'm using a compressed PNG for refraction postprocess, but it's just black and white noise, so I'd like to generate the texture instead. Is it possible though? I tried procedural textures from the library, but it only resulted in default checkerboard texture appearing. What am I doing wrong? And if procedural textures can't be used this way can I use my texture as a tile, so it wouldn't stretch across the screen changing the scale of the noise?

var roadmaterialpt = new BABYLON.RoadProceduralTexture("customtext", 512, scene);
var postProcess2 = new BABYLON.RefractionPostProcess("Refraction", roadmaterialpt, new BABYLON.Color3(1.0, 1.0, 1.0), 0.3, 2.0, 1.0, camera);


Link to comment
Share on other sites

I partially solved this problem by using base64-encoded fractal noise from the SVG file, it's the same dataURI now, but I don't need it exactly procedural, I just want some moving ripples, so I'll either stick to updating the depth with Math.sin(looks like the character is breathing) or try to somehow shuffle the part of the string that won't cause major glitches.

Here's the new version: https://www.babylonjs-playground.com/#FBW4N#2

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...