ReMix Posted September 5, 2015 Share Posted September 5, 2015 Hi everybody ! I'm trying to do a ShaderMaterial that renders fur.Here is how it looks right now. It's starting to look good, but I still have some issues with it :Each layer of fur is rendered using an instance of the object. I have some background of making shaders in Unity3D and I like the way we can do multi-pass shaders, is there a way to do the same with babylon or my instance system the only one ?To render smoothly the material needs to be alpha blended, but then it doesn't write the depth. But in this case, I have issue when multiples "fur faces" overlay (try rotating the view in the link to overlap the fur at different distances on the object). I think the solution would be to have alpha blending and alpha cutout enabled at the same time (cutout to write in depth buffer and blending for nice effect) but it seems that if I enable both the alpha cutout is ignored (no "define ALPHATEST" in generated shader) I still have some work to do on supporting dynamic lights and stuff, but the two issues here are really blocking me. Also, I've had to add some exceptions in the ShaderMaterial attributes I pass to render the instances like listed here. Let me explain : The effect needs to work on smartphones, and I've discoverd that on my smartphone (Galaxy Note 2, Android 5.1.1, Firefox) doesn't support GPU instancing. I had to check this using engine.getCaps().instancedArrays != null, and if false pass the uniform "world" instead of the 4 "world[n]" attributes. It was quite a funny thing to find why the shader wasn't working ... That's the reason why a multi-pass shader would be useful. If somebody has some answers to my issues, any help would be greatly appreciated! Thanks! iiceman 1 Quote Link to comment Share on other sites More sharing options...
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.