NasimiAsl

Make Your Wanted Shader In StandardMaterial [ coming soon ]

34 posts in this topic

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.

NasimiAsl likes this

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

So AddUniform update the old values ?

For example for my editor field, I would like updated value if it changes.

Thanks Nasimi

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)});
NasimiAsl likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.