Make Your Wanted Shader In StandardMaterial [ coming soon ]

Recommended Posts

I'm scared, and I think ya'll have been power-drinking or something.  I haven't understood anything said in this thread, and my dog is whimpering (like he has to go out and pee, and then run away to a new caretaker).  :)

You know we have no docs for GeometryBuilder, yet, right Naz?  I looked at it once, and said "Oh, I see. This requires a doctoral degree in quantum physics... to understand.  You bet, I can write docs for this."  :)  Now you are inventing yet another GPU-beating contraption (machine)? 

And you think a kiddy-level dude like me... can explain to youngsters... sigh... oh goody.  :D

Hey, I might speak English, but not advanced calculus.  heh.

customMaterial, eh?  hmm.  Interesting.  defaultShader is an inbound arg!  Not compiled yet?  Good ol' ascii text shader code? 

So, the "custom" function in [line60] can do text replacements to defaultShader code, and append more shader code text onto the bottom of defaultShader... etc.  Yes?  (the dog just started shivering and whining again)

It is a "down-stream hack-festival"... for material shaders.  The defaultShader is already in the box, with packing material, almost ready for shipment, and then suddenly... a customMaterial robot enters the box... and changes-around everything, if it wishes.  COOL!  Of all the unmitigated audacity!  SO outlaw, eh?

Naz:  Hey Deltakosh, can we please make ShaderBuilder part of core?

DK:  No, it is too weird.  Stay out in BABYLONX domain... don't stink-up my core with weirdness.

(3 months pass)

Naz:  Hey Deltakosh... if I use this latex rubber protective lambskin sheath called customMaterial, can I get closer to core?

DK:  No!  Maybe.  You're a madman.  Fine... but you better have a decent docs writer... or... hmm.  Man, this just feels wrong.


Share this post

Link to post
Share on other sites

:D i like your looking way 

but it is not illegal  ( outlaw )  

so let i start explain more

i simply start answer   why,what ,who , when  about custommaterial

1. why  we need this ?

      we have standardmaterial with a lot tools depended for scene parameters but have limitation in customized 

      we have shadermaterial with no limitation but dont have any depended parameter with scene

     ** depended parameters like lights, colors, shadow ...

     so this is why we need mix and have some thing like standardmaterial with no limitations in some part 

2. what is it exactly what do it ?

     i call it CustomMaterial extended from StandardMaterial but customizable in diffuse color ( for version 1 )

     i replace diffuse color in default shader and make new shader

3. who most use it ? ( when we need that ? )

     (all people  or when we ) wanna make shader material but wanna use all option of standard material


ps : dis is not depend for babylonx or shader builder ( but that can help )

i know shaderbuilder is very complicated stuff for core i understand that and respect for DK  and think BX is best place for  shaderbuilder  and geometry builder or others tools 



Share this post

Link to post
Share on other sites

@NasimiAsl I cant wait to experiment with CustomMaterial! Though I have some knowledge in writing shaders, I cannot understand all the obviously benefits I've seen so far in the source and playground in detail. So please, if you could provide some docs with the very basic concepts or steps even if the docs are not fine-tuned, this would help me and others a lot. 

But, I will not stress you, furthermore I'd like to thank you for your effort,



Share this post

Link to post
Share on other sites

i designed something like this for make that

 ground.material = new BABYLON.CustomMaterial("s12",function(b){
                 var name = "newname"; 
    		     b.varyings = ['varying vec2 vuv;'];
                 b.fragmentUniforms = ['uniform sampler2D tx_01;','uniform sampler2D tx_02;'];
                 b.vertexUniforms = [];
                 b.body = 'result = texture2D(tx_01, vuv ,0.) ;\
        =*0.5 +texture2D(tx_02, vuv ,0.).xyz*0.5  ;\
                 b.vertexBody = ' vuv = uv; ';


               return name ; 


@Dad72  i know still without shaderBuilder but wait a few hours more i am so close

Share this post

Link to post
Share on other sites test fog for custom material

  ground.material = new BABYLON.CustomMaterial("s12",function(b){
                 var name = "def3";  
    		    b.initShader(name,scene,new BABYLONX.ShaderBuilder() 
                  .InLine('result = vec4( vec3(max(sin(vPositionW.x),sin(vPositionW.z)) ),1.);')

               return name ; 


first shaderBuilder mix with custom material :)

still not complete yet :D ( need define set Texture  and some defines )

Share this post

Link to post
Share on other sites

@NasimiAsl Sorry but links throw all an error "Uncaught TypeError: Cannot read property 'reset' of undefined" (test_011.js:1385)


PS: Can't wait, it looks so promising :)


Share this post

Link to post
Share on other sites

Cool. So it works like that or you plan to streamline your PR awaiting validation?

what are the files that we need to update ? CustomMaterial and ShaderBuilder?

Is the "fog" also be supported? I suppose yes, everything is merging with StandardMateriel and CustomMaterial.

Edite: I try with a more practical demo. But it does not yet work with ShaderBuilder.

Nasimi thank you

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.

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.


  • Recently Browsing   0 members

    No registered users viewing this page.