• Content count

  • Joined

  • Last visited

  • Days Won


Pryme8 last won the day on January 7

Pryme8 had the most liked content!

1 Follower

About Pryme8

  • Rank
    Advanced Member
  • Birthday 04/29/1986

Profile Information

  • Gender
  • Location
    Nor. Cal
  • Interests
    Crushing it

Recent Profile Visitors

2,349 profile views
  1. Yeah, I think generating all the meshes for each level of LOD is overkill and is impacting performance. I think reworking it to not do that will speed things up.
  2. Gotta fix cracks (which will be easy) then just do my normal's, and the procedural terrain shader. Then ill refine/extend the way the noise stack is used, right now Im just doing 1 noise but eventually I want to layer them using the Das_Noises mixing methods. After all that add dynamic heightmaps, so the areas can be manipulated by the user! But here is the Infinite Terrain with LOD people have been wanting... there are a few fixes I could make to speed things up but this is a decent prototype.
  3. Got the chunking done. Now I really need to do calculations on the nearest point on the plane, I found this but I am such a lamen I have no clue what it is saying if anyone can translate?
  5. My bad, I miss read your first post! >_< I was rushing out the door to get to lunch, good thing adam knows what hes talking about!
  6. player = { mesh:player_box, speed: { f:0, s:0, u:0, } }; //PHYSICS START player_box.body = player_box.setPhysicsState(BABYLON.PhysicsImpostor.SphereImpostor, { mass: 1.0, friction: 0.0001, restitution: 0.0}); player_box.body.grounded = false; player_box.body.collisionResponse = 0; player_box.body.addEventListener("collide", function(e){ player_box.body.grounded = true; player_box.body.collisionResponse = 1; }); //CONTROLS keys = {}; keys.up = false, keys.down = false, keys.left = false, keys.right = false, = false, keys.w = false, keys.s = false, keys.a = false, keys.d = false, keys.ctrl = false; function onKeyDown(evt) { console.log(evt.keyCode); switch (evt.keyCode){ case 37: // left keys.left = true; break; case 39: //right keys.right = true; break; case 38: //up keys.up = true; break; case 40: //down keys.down = true; break; case 32: //space = true; break; case 87: //w keys.w = true; break; case 83: //s keys.s = true; break; case 65: //a keys.a = true; break; case 68: //d keys.d = true; break; case 17: //ctrl keys.ctrl = true; break; } } function onKeyUp(evt) { switch (evt.keyCode){ case 37: // left keys.left = false; break; case 39: //right keys.right = false; break; case 38: //up keys.up = false; break; case 40: //down keys.down = false; break; case 32: //space = false; break; case 87: //w keys.w = false; break; case 83: //s keys.s = false; break; case 65: //a keys.a = false; break; case 68: //d keys.d = false; break; case 17: //ctrl keys.ctrl = false; break; } } window.addEventListener("keydown", onKeyDown); window.addEventListener("keyup", onKeyUp); //console.log(player_box.body); //console.log(camera); settings = { accel : 1, speeds :{ normal :{ f: 50.0, b: -20.0, s: 30.0, }, run :{ f: 1.0, b: 0.45, s: 0.65, }, walk :{ f: 0.3, b: 0.1, s: 0.2, }, }, }; //CONTROL RESPONSE scene.registerBeforeRender(function(){ //console.log(player_box.position); if(player_box.body.collisionResponse){ player_box.body.grounded = true; player_box.body.velocity.y = 0; }else{ player_box.body.grounded = false; } if(player_box.body.grounded || gravity.y == 0){ if(keys.w){ if(player.speed.f < settings.speeds.normal.f){ player.speed.f += settings.accel; }else{ player.speed.f = settings.speeds.normal.f; } }else if(keys.s){ if(player.speed.f > settings.speeds.normal.b){ player.speed.f -= settings.accel; }else{ player.speed.f = settings.speeds.normal.b; } } if(keys.a){ if(player.speed.s > settings.speeds.normal.s*-1){ player.speed.s -= settings.accel; }else{ player.speed.s = settings.speeds.normal.s*-1; } } if(keys.d ){ if(player.speed.s < settings.speeds.normal.s){ player.speed.s += settings.accel; }else{ player.speed.s = settings.speeds.normal.s; } } if({ if(gravity.y != 0 && player_box.body.grounded){ player_box.body.collisionResponse = 0; var jumpVector = v3(0,6.5,0); player_box.applyImpulse(jumpVector, player_box.position); }else{ if(player.speed.u < -2){ player.speed.u -= settings.accel; }else{ player.speed.u = -2; } } } if(keys.ctrl){ if(gravity.y != 0 && player_box.body.grounded){ player.speed.f*=0.5; player.speed.s*=0.5; }else{ if(player.speed.u > 2){ player.speed.u += settings.accel; }else{ player.speed.u = 2; } } } player.speed.f*=0.82; player.speed.s*=0.82; player.speed.u*=0.82; if(player.speed.f<0.05 && player.speed.f > -0.05){ player.speed.f = 0; } if(player.speed.s<0.05 && player.speed.s > -0.05){ player.speed.s = 0; } var forward = scene.activeCamera.getTarget().subtract(scene.activeCamera.position).normalize(); forward.y = 0; var right = BABYLON.Vector3.Cross(forward, scene.activeCamera.upVector).normalize(); right.y = 0; var f_speed = 0, s_speed = 0, u_speed = 0; if(player.speed.f != 0){ f_speed = player.speed.f; } if(player.speed.s != 0){ s_speed = player.speed.s; } if(player.speed.u != 0){ u_speed = player.speed.u; } move = (forward.scale(f_speed)).subtract((right.scale(s_speed))).subtract(scene.activeCamera.upVector.scale(u_speed)); player_box.body.velocity.x = move.x; player_box.body.velocity.z = move.z; player_box.body.velocity.y = move.y; } if(keys.ctrl){ camera.position = v3(player_box.position.x,player_box.position.y+1,player_box.position.z); }else{ camera.position = v3(player_box.position.x,player_box.position.y+2,player_box.position.z); } This might be over kill... but this is a controller that I have used in the past. You need to get a forward vector and do something with that!
  7. So it "works" but it crashes once it propagates out a little. I need an idea of how to establish which zones to build. Maybe like a max ring size instead of what I am doing now and have it only render out say 4 steps from the current zone the player is on? Just hoping for some alternative ideas. ^^ for a non crashing version without neighborhood checks. #EDIT# Also any math buffs wanna help me with how to do an equation to calculate the distance from the the outer closest edge point or center, which ever is closest. Not just the Center, or at least point me in the right direction?
  8. What do you mean by tile-able noise? Do you want the noise to repeat? var x = (x/unitSize) - Math.Floor(x/unitSize); var z = (z/unitSize) - Math.Floor(z/unitSize); I just woke up so that math might be wrong but off the top of my head that sounds right to make it repeat. <- might have some info for you. If you just want infinite noise then you need to not use a texture map... just use my Das_Noise Lib and keep feeding it what ever coords you want it will go on for ever. var noise = new dN('Simple2' , 'testSeed', { frequency:1, amplitude:1, octave:1, persistence:1, scale:100, }); var vertexData = mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind); for (var i = 0; i < vertexData.length; i += 3) { var x = vertexData[i]+mesh.position.x, y = vertexData[i+1] ,z = vertexData[i+2]+mesh.position.z; var h= noise.getValue({x:x,y:z}); vertexData[i+1] = h*height; } mesh.setVerticesData(BABYLON.VertexBuffer.PositionKind, vertexData, 0, 0);
  9. what are you trying to do exactly?
  10. Dumb dah dumb dumb... sorry it was a long day...
  11. So if I make a canvas, and then convert its content to an Image am I able to assign it as lets say a diffuse texture? The above demo does not work, but that's the idea. Is this what Dynamic textures are for? If so then why does this not work:
  12. This demo is down, anywhere to look at it source code somewhere else? **EDIT** I found the source code on the github, but the demo still seems to be down.
  13. I am so close it hurts.... >_< I guess I need a new projection algorithm. ***Edit*** Gotta make some fixes to the positioning and then this should work. Ok now I am beating my head into a wall... everything works when its a cube, but the second I try to project into a sphere everything goes to shit... Cube: Sphere: If change the displace method to not be wrapped in a timeout, I get even more odd behavior. About to give up on this >_< and go back to texture synthesis scripts... rabble rabble rabble...
  14. Cool, now I have to figure out why the positions of the meshs are coming up as 0,0,0... why would after I position the mesh/zones they have incorrect positions stored, but are appearing in the correct area? Ahh it was line 76... so baking the vertices sets the mesh position to 0,0,0. Is there a way to bake the vertices position, but keep the meshs position intact? <- @Deltakosh (if you have a moment)
  15. Ok now I just need to figure out why all the meshes are returning the same position.