Jump to content

Dynamic texture for shaders


Recommended Posts

Hi there , how could I load picture to shaders like 


pic1 : www.abc.com/pic1.jpg,

pic2 : www.abc.com/pic2.jpg,

pic3 : www.abc.com/pic3.jpg



so then I can use 


uniform sampler2D pic1;

uniform sampler2D pic2;

uniform sampler2D pic3;


vec3 color1 = texture2D(pic1, vUV).rgb;

vec3 color2 = texture2D(pic3, vUV).rgb;

vec3 color3 = texture2D(pic3, vUV).rgb;




Link to comment
Share on other sites


In this way.

var amigaMaterial = new BABYLON.ShaderMaterial("amiga", scene, {}, {});   amigaMaterial.setTexture("pic1", new BABYLON.Texture(" www.abc.com/pic1.jpg", scene));amigaMaterial.setTexture("pic2", new BABYLON.Texture(" www.abc.com/pic2.jpg", scene));amigaMaterial.setTexture("pic3", new BABYLON.Texture(" www.abc.com/pic3.jpg", scene));
Link to comment
Share on other sites

Hi bulisor,


Would it be possible as was suggested in the title of this post to have a funtional dynamic texture as one of these MultiMaterials - where all 3 textures cover (are mapped to) and are rendered to the entire UV surface of an object?  My specific need at this time is to draw on top of an existing image file using a dynamic texture. I've built an an app which draws directly on objects, however, I'm unable to display an image file (texture) on the object and use this function to draw on the object and on top of the image file.  I've only tried using MultiMaterials thus far, as this is what I'm familiar with, and hoped this would work using MultiMaterials and a dynamic textured pushed as one of the materials.  However, I'm unfamiliar with the setTexture function.


Thanks for any assistance you might provide.


Cheers.  :)



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...