NasimiAsl

Members
  • Content count

    822
  • Joined

  • Last visited

  • Days Won

    27

NasimiAsl last won the day on March 24

NasimiAsl had the most liked content!

4 Followers

About NasimiAsl

  • Rank
    Advanced Member
  • Birthday 01/28/1985

Contact Methods

  • Website URL
    http://eash.space
  • Skype
    nasimiasl@live.com

Profile Information

  • Gender
    Male
  • Location
    tehran iran

Recent Profile Visitors

2,082 profile views
  1. you can use collision too scene.collisionsEnabled = true; //Then apply collisions and gravity to the active camera camera.checkCollisions = true; camera.applyGravity = true; //Set the ellipsoid around the camera (e.g. your player's size) camera.ellipsoid = new BABYLON.Vector3(1, 1, 1); //finally, say which mesh will be collisionable mesh.checkCollisions = true; http://www.babylonjs-playground.com/#1QC9DP#148 and look line // camera.position.y = 5.+height_Map(camera.position); after you use collition you dont need this
  2. http://www.babylonjs-playground.com/#1QC9DP#143
  3. what is atlasInfos???
  4. make it with your textures too
  5. i think this part make it to different color you append color in any step that maybe change your base color
  6. i have this tools but for first version of shaderbuilder (eash) and i most collect of all shader builder functions with parameters after that you can be design that like what you do in Texture Generator
  7. you have good hand for make tools if you have time and wanna make something special take look for that i wanna make that for shaderbuilder and see you work nice with SB and we can make it for custom material too (that can be good)
  8. *** notic this part of code vec2 edge = vec2( pow( 2.*abs((newUvAtlas.x-uv_x)/uv_w -0.5), 3.), pow( 2.*abs((newUvAtlas.y-uv_y)/uv_h -0.5), 3.) ) ; you see '3.' if you change that to 1 you most see a little artifacts ( i guess ) this number make the edge bigger if you use the big number like 100 you have a small edge and see more artifacts
  9. @MackeyK24 if i try make that shader with cyos i never can do that . it is different between ShaderBuilder and Shader actually i cant explain this line in my code correctly if( ((result_4.x*1.-0.)>1.0 ? 0. : max(0.,(result_4.x*1.-0.))) > 0.5 + -0.48 && ((result_4.y*1.-0.)>1.0 ? 0. : max(0.,(result_4.y*1.-0.))) < 0.5 - -0.48 && ((result_4.z*1.-0.)>1.0 ? 0. : max(0.,(result_4.z*1.-0.))) > 0.5 + -0.48 ) { vec4 oldrs_6_ = vec4(result);float al_6_ = max(0.0,min(1.0,(((result_4.x*1.-0.)>1.0 ? 0. : max(0.,(result_4.x*1.-0.))) + ((result_4.z*1.-0.)>1.0 ? 0. : max(0.,(result_4.z*1.-0.))))/2.0 - (((result_4.y*1.-0.)>1.0 ? 0. : max(0.,(result_4.y*1.-0.))))/1.0+(0.48))); float l_6_ = 1.0-al_6_; result = result_1 ; result = result*al_6_ + oldrs_6_ * l_6_; } if( ((result_4.x*1.-0.)>1.0 ? 0. : max(0.,(result_4.x*1.-0.))) < 0.5 - -0.48 && ((result_4.y*1.-0.)>1.0 ? 0. : max(0.,(result_4.y*1.-0.))) > 0.5 + -0.48 && ((result_4.z*1.-0.)>1.0 ? 0. : max(0.,(result_4.z*1.-0.))) > 0.5 + -0.48 ) { vec4 oldrs_7_ = vec4(result);float al_7_ = max(0.0,min(1.0,(((result_4.y*1.-0.)>1.0 ? 0. : max(0.,(result_4.y*1.-0.))) + ((result_4.z*1.-0.)>1.0 ? 0. : max(0.,(result_4.z*1.-0.))))/2.0 - (((result_4.x*1.-0.)>1.0 ? 0. : max(0.,(result_4.x*1.-0.))))/1.0+(0.48))); float l_7_ = 1.0-al_7_; result = result_2 ; result = result*al_7_ + oldrs_7_ * l_7_; } if( ((result_4.x*1.-0.)>1.0 ? 0. : max(0.,(result_4.x*1.-0.))) > 0.5 + -0.48 && ((result_4.y*1.-0.)>1.0 ? 0. : max(0.,(result_4.y*1.-0.))) > 0.5 + -0.48 && ((result_4.z*1.-0.)>1.0 ? 0. : max(0.,(result_4.z*1.-0.))) > 0.5 + -0.48 ) { vec4 oldrs_8_ = vec4(result);float al_8_ = max(0.0,min(1.0,(((result_4.x*1.-0.)>1.0 ? 0. : max(0.,(result_4.x*1.-0.))) + ((result_4.y*1.-0.)>1.0 ? 0. : max(0.,(result_4.y*1.-0.))) + ((result_4.z*1.-0.)>1.0 ? 0. : max(0.,(result_4.z*1.-0.))))/3.0+(0.48))); float l_8_ = 1.0-al_8_; result = result_3 ; result = result*al_8_ + oldrs_8_ * l_8_; } but it is so clear in shaderBuilder that replace edge and this result is just for .Reference(4,' result = vec4( edge.x ,edge.y, max(edge.x,edge.y) ,1.);') .Pink(4,' result = result_1 ; ',{ rangeStep:-0.48,rangePower:0.48}) .Cyan(4,' result = result_2 ; ',{ rangeStep:-0.48,rangePower:0.48}) .White(4,' result = result_3 ; ',{ rangeStep:-0.48,rangePower:0.48}) ; but here all people wanna understand the part one it is wired
  10. yes you can but need some special uv i call that SPS in GPU side this is a lot complicated in shader stuff and i am new be in that for now http://www.babylonjs-playground.com/#1QC9DP#80 all under one mesh and managed just by uv (generated by GeometryBuilder ) you can chose any of face you want just by simple condition in shader http://www.babylonjs-playground.com/#1QC9DP#83 http://www.babylonjs-playground.com/#1QC9DP#90
  11. yes and i love that stuff http://www.babylonjs-playground.com/#1V70NA#14 that is just plan
  12. no this is simplex noise and that is not random this depend for vec3 variable so if you change that you have different noise if you fix that you have stable noise
  13. Step 1: Init GeometryBuilder to the PG http://www.babylonjs-playground.com/#1QC9DP#119 ** this step just for playground and no need in your code var url = "http://cdn.rawgit.com/NasimiAsl/Extensions/master/GeometryBuilder/SGB.js"; var s = document.createElement("script"); s.src = url; document.head.appendChild(s); var time = 0; var camera; var createScene = function () { var scene = new BABYLON.Scene(engine); scene.clearColor = new BABYLON.Color4(0.3,0.4,0.6,1.); camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(-4, 70, 5), scene); camera.setTarget(BABYLON.Vector3.Zero()); camera.attachControl(canvas, true); var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0), scene); light.intensity = 0.7; s.onload = function (params) { var GB = BABYLONX.GeometryBuilder; BABYLONX.GeometryBuilder.InitializeEngine(); BABYLONX.ShaderBuilder.InitializeEngine(); // geometry code here scene.registerBeforeRender(function () { new BABYLONX.ShaderMaterialHelper().SetUniforms( scene.meshes, camera.position, camera.target, { x: 0, y: 0 }, { x: 100, y: 100 }, time++); }) } return scene; }; step 2 : define a Geometry Builder ** know more about geometry Builder var geo1 = function (op) { var builder = function (s /*{seg:number}*/, geo) { }; return new BABYLONX.Geometry(GB.GeometryBase(op, builder, op.custom)); } 3: design a algoritm so we need camera position (x, z y : not important yet ) and plan size and plan segments we define a builder for make a plan with this parameters // define new Builder var geo1 = function (op) { var builder = function (s /*{seg:number}*/, geo) { var step = s.size/s.seg; // calculate vertex info for(var i=0;i<s.seg;i++){for(var j=0;j<s.seg;j++){ var p = {x:s.x+j*step , y:0., z:s.y+i*step }; GB.PushVertex(geo,{x:p.x,y:0 ,z:p.z}); geo.uvs.push( p.x/100. , p.z/100. ); } } // make face for(var i=1;i<s.seg-1;i++){for(var j=0;j<s.seg-1;j++){ GB.MakeFace(geo, [(i-1)*s.seg+ j,(i-1)*s.seg+j+1,i*s.seg+j+0 ,i*s.seg+j+1 ] , { flip:!s.flip } );} } }; return new BABYLONX.Geometry(GB.GeometryBase(op, builder, op.custom)); } http://www.babylonjs-playground.com/#1QC9DP#121 4: write algoritm steps http://www.babylonjs-playground.com/#1QC9DP#123 // make first geo var mesh = geo1( {seg:200,size:1000,x:-500,y: -500 }).toMesh(scene); var lastPos = {x:0,z:0}; scene.registerBeforeRender(function () { // calculate distance every frame var dis = Math.sqrt(Math.pow(lastPos.x - camera.position.x, 2.) + Math.pow(lastPos.z - camera.position.z, 2.)); // if dis bigger than 300 (optional item ) if (dis > 300.) { lastPos.x = camera.position.x; lastPos.z = camera.position.z; // try create plan in new poition mesh.dispose(); mesh = geo1({ seg: 200, size: 1000, x: -500+camera.position.x, y: -500+camera.position.z, }).toMesh(scene); } }) 5. Define the height map and use it in Builder http://www.babylonjs-playground.com/#1QC9DP#124 function height_Map(p){ var ns = Math.max(30.,Math.min(80.,Math.abs( Math.sin(p.x*0.01)+Math.cos(p.z*0.01))*100.)); ns = -50.+Math.pow(ns-29.,1.13); return ns; } 6. add your material and you can enable collition of find y position from height map http://www.babylonjs-playground.com/#1QC9DP#126 you can add some simplex func in height map http://www.babylonjs-playground.com/#1QC9DP#127 and can make a shader for set special material http://www.babylonjs-playground.com/#1QC9DP#128 my friend @jerome make the new way to terrain generator in this topic too
  14. hi sorry i see your post now ( ) my bad @CodeIain