NasimiAsl

Make Your Wanted Shader In StandardMaterial [ coming soon ]

Recommended Posts

Actually, I was thinking a lot about changing ShaderBuilder to add functionality for generating in Javascript for the functionality of BuildMaterial(), maybe toScript().  This way you would not need to deploy ShaderBuilder itself.  It would be not only save 78 kb, but be cleaner due to being self contained.  Interested in me updating the repo?

BTW, I published my first scene using it, thanks.

Share this post


Link to post
Share on other sites

join just simple string join i try to do it in customMAterial

but about UV i need enable DeffiuseTexture 

test    // blanck texture
        sMat.diffuseTexture = new BABYLON.Texture("http://i.imgur.com/o5iHzN8.png",scene);

http://www.babylonjs-playground.com/#FC4IX#68 

http://www.babylonjs-playground.com/#FC4IX#69

Share this post


Link to post
Share on other sites

CustomMaterial is not a ShaderMaterial so that have not SetUniform

you can find this function after mat.getEffect() is ready 

you can use AddUniform 

 sMat.AddUniform('dyTexture', 'sampler2D',  new BABYLON.Texture('http://www.babylon.actifgames.com/TerrainEditor/data/Delos.png',scene));
   sMat.AddUniform('scaleTxt1', 'vec2', {x: 2.0, y: 2.0});

 

http://www.babylonjs-playground.com/#FC4IX#78
       

 

 

Share this post


Link to post
Share on other sites

Ok, I understand, do as this:

terrain.material.getEffect().setTexture('texture1', new BABYLON.Texture(data.textures, scene));
terrain.material.getEffect().setVector2('scaleTxt1', {x: 10.0, y: 10.0)});

Share this post


Link to post
Share on other sites

@NasimiAsl, Apparently material.getEffect().setVector2 and  material.getEffect().setTexture longer works. material.getEffect() also. Something has to change or this is a bug Babylon?

http://www.babylonjs-playground.com/#FC4IX#82

I think it's a bug because a standarMarerial also:

http://www.babylonjs-playground.com/#I0NPUS#1

Share this post


Link to post
Share on other sites

Ok, So with setTimeOut the problem is solves. I did not need to do this before. I suppose that there is a problem somewhere.

setTimeout(function() {
    console.log(terrain.material.getEffect());
}, 1000);

Thanks Nasimi

Share this post


Link to post
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.

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

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.