zhutq Posted August 7, 2017 Share Posted August 7, 2017 Hi, I find CustomMaterial a very powerful way to write my own materials I have three questions reguarding it: 1. Is there a way to update custom uniform values after AddUniform? 2. I use Fragment_Custom_Alpha, and compute alpha according to some uniform values. Can I tell the material to enable alpha blending? 3. Can I specify "precision highp float;" for it? I notice that Fragment_Begin is defined after #include<__decl__defaultFragment> , so it's late for precision. Thank you very much! Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 7, 2017 Share Posted August 7, 2017 Question for NasimiAsl . Indeed CustomMateriel can do a lot of things. For the question 1, yes it is possible. Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted August 7, 2017 Share Posted August 7, 2017 hi @zhutq sorry i see it now @Day72 thanks too answer 1 : yes you can update any uniform you most check the material.getEffect() after that be ready you can change it like any shader material material.getEffect() https://www.babylonjs-playground.com/#3WN9C6#1 answer 2 : https://www.babylonjs-playground.com/#3WN9C6 you can make any custom alpha from this sphere.material.Fragment_Custom_Alpha('result = sin(vPositionW.x*20.01+vPositionW.z*20.01);'); or sphere.material.Fragment_Custom_Alpha('alpha = sin(vPositionW.x*20.01+vPositionW.z*20.01);'); answer 3 : it is same as standard material but for now custommaterial can't change that if you think that can be useful i can append that documentation under progress ( committed under this week ) Quote Link to comment Share on other sites More sharing options...
zhutq Posted August 8, 2017 Author Share Posted August 8, 2017 Thank you! So I need to set alpha < 1 to enable alpha blending. I compute final alpha according to alpha and another value, so I thought it's better to have an additional value to affect needAlphaBlending. But anyway I can indeed achieve what I want I think setting precision will be useful Quote Link to comment Share on other sites More sharing options...
zhutq Posted August 8, 2017 Author Share Posted August 8, 2017 Sorry to bing this up again.. I've tried with vec3 uniform but failed: Playground: https://www.babylonjs-playground.com/#3WN9C6#3 Thank you! Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted August 8, 2017 Share Posted August 8, 2017 i find it https://www.babylonjs-playground.com/#3WN9C6#4 after add the next standard material all effect is frozen this is big bug for standard material Effect let me check it Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 8, 2017 Share Posted August 8, 2017 It's nice to see other CustomMaterial users. This will help to find a possible bug. And with a bit of luck, this will correct the reflection / refraction problem Have you planned a Nasimi documentation for CustomMaterial? I'm sure there would be more users. Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted August 8, 2017 Share Posted August 8, 2017 docs is started under progress Dad72 1 Quote Link to comment Share on other sites More sharing options...
zhutq Posted October 26, 2017 Author Share Posted October 26, 2017 On 8/8/2017 at 8:34 PM, NasimiAsl said: i find it https://www.babylonjs-playground.com/#3WN9C6#4 after add the next standard material all effect is frozen this is big bug for standard material Effect let me check it Hi, is there any updates on this one? Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted October 26, 2017 Share Posted October 26, 2017 yes as i say this depend to standard material and i have problem with custommaterial for last update so no idea about that problem yet may be some others can help about that Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.