Converge Posted March 15, 2018 Share Posted March 15, 2018 Hello everyone, I've encountered a situation where I need to mix two normal maps for my PBR material. One map is the main texture while the second one is tiled detail texture. Much like Unity does with its standard material. What would be the best way to extend the functionality of the current PBR material (https://doc.babylonjs.com/classes/3.0/pbrmetallicroughnessmaterial or at least its PBRBaseSimpleMaterial parent). Amending shader itself and passing a second texture sampler is not a problem for me. I understand I should utilize material library and compile a new material. But should I use existing custom standard material as a basis or there are better ways of doing it? I would love to keep entire PBR shader code in local .fx files instead of replacing custom parts though. I bet many artists working with BJS have encountered similar issue where they'd need to tweak existing material and meddle with the shader code but the process of creating anything custom isn't that clear or intuitive. Any tips would be very helpful! Many thanks in advance. PS readme file for custom standard mat states that it would only work with BJS 3.0.0 and I'm using the latest stable one. babbleon 1 Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted March 15, 2018 Share Posted March 15, 2018 https://www.babylonjs-playground.com/#7AIII8#20 https://www.babylonjs-playground.com/#7AIII8#25 that is Simple PBR From CustomShader u can make any channel for you pbr ** reflectPart = function( sampler Ref, nrm , scale , RefractiveParameter , direction x , direction y , direction z , bias) part1 : https://www.babylonjs-playground.com/#7AIII8#22 new SB() .Map({path:'https://i.imgur.com/5b9To6N.jpg'}) .InLine( reflectPart( 'txtRef_0','nrm' ,0.005 ,-1,-1.,-1.,-1.,0.)) .BuildMaterial(scene); you can use shader string for manage any parameter reflective mix https://www.babylonjs-playground.com/#7AIII8#23 normal mix https://www.babylonjs-playground.com/#7AIII8#24 play anything you want and ask me if you have any question about this http://www.babylonjs-playground.com/#7AIII8#11 babbleon 1 Quote Link to comment Share on other sites More sharing options...
Guest Posted March 15, 2018 Share Posted March 15, 2018 The long term version is either to use the custom material as shown by Nasimi or do as you mentioned: inherit from PBRBaseMaterial and create an entry in the material library (this way it will be maintained in the core repo) 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.