ShaderBuilder Starter

make easy and fast ShaderMaterial or PostProcess

documents : ShaderBuilder Docs

code : Extensions/ShaderBuilder at master · BabylonJS/Extensions · GitHub

cdn reference :

PG : Babylon.js Playground


How do you add a texture2D using your shader builder?

g1.material = new BABYLONX.ShaderBuilder()




        float uvx = mod(vuv.x*(float(`+grass_set.seg*grass_set.seg+`)),1.); 

        float ind = floor(vuv.x*(float(`+grass_set.seg*grass_set.seg+`)) );  

        float gs = 1.-pow(uvx+(1.-uvx) *abs(sin(vuv.y*float(`+grass_set.width+`)*float(`+grass_set.countPerFace+`) ) ),2.15);


        result  = texture2d??




        float uvx = mod(vuv.x*(1.0*1.0),1.); 

        float ind = floor(vuv.x*(1.0*1.0) );  

        pos = pos  ;

    result = vec4(pos,1.);




        return g1;

i am so glad you use shaderBuilder let me know how i can help you
but about textures
way 1 : use shader Builder Functions

.Map({ path:’/textures/ground.jpg’, uv:‘vec2(vuv)’ })

way 2 : use new uniform


** after First load you can use the shader base code too

Thanks for the examples. Im just looking for some help to draw some grass on terrain. Your examples i thought were quite good.

ive got a mesh, and i want to draw grass all over it.

Following along with this one but not able to see how i can put each grass exactly on the terrain height

how you wanna make height map?
are you have any height map texture


Yes so I was going to generate the ground using a custom mesh with a heightmap and then get the normal positions and draw the grass on top.

so far i had just used a custom mesh with no heightmap but was having trouble drawing the actual grass meshes on the correct positions


you need define you height_map function in this example i have h_map


That is brilliant! Thanks v much.

1 Like

I am a beginner.

But reading this, I understand it.

Thanks your very much.

1 Like

@Sam01 thanks for reading this

ping me in any think depend on shader i try my best for make that possible :slight_smile: