Jump to content

Consultation for new shader program language design


NasimiAsl
 Share

Recommended Posts

hi all 

 

i started for make easy shader one years ago i build one design pattern and i work now to refactor this and share it in git hub.

 

i want from any one see my design   and  have any suggest for me ( change and usage pattern say it)share that here .thanks :)

 

1. why  

problem: we know shader source is a hard   to write and debug and not oop and not have template

 

2.what 

solution : a: we know we last output is   2 string (vertex ,  fragment )  we most send parameters too

                b: we need make string builder

 

3. design :

    a: see shader structure  

 

       //   uniforms

       // attributes

       // varyings

       

       // void main(){

             

             // calculate a vec4 and  set   to gl_position | gl_FragColor

        }

 

   b:  make javascript  function for build shader   parts  we need

 

   c:  make babylonjs javascript to build a shader material Instance or postprocess inistance

 

 

// sample of shader usage

 

mesh.material =   eash.shader(  

        sh_range({

                        mat1:sh_solid(0xff0000,1.0)

                       ,mat2:sh_noise({    pos:"pos*.01+vec3( time*0.6,time*0.1,time*0.1)"})
                       ,start:0
                       ,end:700
                       ,dir:'pos.x' })
       +        sh_frensel({color:0x000000,nrm:flat_nrm }) );
 

http://185.88.152.218/eash/pub/preview#10202

Link to comment
Share on other sites

mesh.material =   eash.shader(  


        sh_range({


                        mat1:sh_solid(0xff0000,1.0)


                       ,mat2:sh_noise({    pos:"pos*.01+vec3( time*0.6,time*0.1,time*0.1)"})

                       ,start:0

                       ,end:700

                       ,dir:'pos.x' })

       +        sh_frensel({color:0x000000,nrm:flat_nrm }) );

 

 

this is final code  i think it is easy  ;)   

Link to comment
Share on other sites

Indeed, but I also think you need to have a very good documentation to this. Otherwise, nobody but you will be able to use it. 

Do you have a Github repo or something we can use and test ? What are the function we can use?  With a good doc, it will be very very powerful.

 

By the way, is sh_frensel supposed to be fresnel ? So sh_fresnel ? :)

Link to comment
Share on other sites

@Temechon   

 

about sh_fresnel :D i see that now thanks

 

about Github I work on right now  after holiday( happy new year for u ) you have it

 

about documentation and usage i have tools for that for build a material with preview and make tube for any function :) i share it too in github

Link to comment
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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...