NasimiAsl Posted December 11, 2015 Share Posted December 11, 2015 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 Quote Link to comment Share on other sites More sharing options...
Temechon Posted December 11, 2015 Share Posted December 11, 2015 If it's that easy, I'm interested! Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted December 11, 2015 Author Share Posted December 11, 2015 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 Quote Link to comment Share on other sites More sharing options...
Temechon Posted December 11, 2015 Share Posted December 11, 2015 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 ? NasimiAsl 1 Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted December 12, 2015 Author Share Posted December 12, 2015 @Temechon about sh_fresnel 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 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.