JonathanRev

Members
  • Content count

    11
  • Joined

  • Last visited

About JonathanRev

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. i was testing this way to do a minimap , but i saw that when you intersect another object the minimap looks like this , any ideas how to fix that to avoid that ? or it is better using the viewport way :
  2. wow ! totally right , i guess i fixed it this way , i replaced : // Light vec3 lightVectorW = normalize(vLightPosition - vPositionW); by this : // Light vec3 lightVectorW = normalize(vLightPosition); Not sure if this will have any effect in another part of the game, but now it iluminated perfect in all directions !
  3. you can see what i explained on this two images
  4. Hello guys ! i was working with groundmaterial several weeks already , but i recently noticed that "DirectionalLight" is not a good friend of "WORLDMONGER.GroundMaterial" i hope i am wrong , but i was experimenting with endless landscapes and i noticed that when i go far from the point 0 , 0 , 0 of my scene the diarectionallight doesn't iluminate with the same intensity when i go far away from point 0 , 0, 0 when i use the GroundMaterial i set the directional light this way : var light = new BABYLON.DirectionalLight("dir01", new BABYLON.Vector3(0, -1, 0), scene); light.intensity = 1.0; and i am using the groundmaterial as : var groundMaterial = new WORLDMONGER.GroundMaterial("groundMaterials", scene, scene.getLightByName("dir01"); ----------------------------------------------------------------------------------------------------------------- Now when i use a the StandardMaterial : var groundMaterial = new BABYLON.StandardMaterial("ground0", scene); groundMaterial.diffuseTexture = new BABYLON.Texture("shaders/Ground/grass.png", scene); and i move far from the point 0, 0, 0 it works perfect and iluminates with the same intensity for example if i were some kilometers far away from the point 0,0 as it would be on the point 0,0 is this really something related to groundmaterial? , or i should use some trick to have kilometers of my scene with the same intensity in light using directionallight and groundmaterial? i have already tried using the scene.registerBeforeRender(function() to have the directionallight follow the camera but i don't think it is a good solution , i guess the DirectionalLight should iluminate the same ortogonal way even if i am far away from the initial location point of the directionallight.
  5. Good day / night guys , i think i solved it ! @jerome you were totally right , i noticed some of the meshes were loading before the heighmap load completely , that's why i needed to reload many times so all items appears on the scene : This was the way i was creating the ground : var ground = BABYLON.Mesh.CreateGroundFromHeightMap("groundterrain", "img/heightmap.png", 1024, 1024, 100, 5, 80, scene, true); I solved it this way , correct me if i am wrong please , first of all i used the : onReady method , as i told you before , i am using the "assetsManager" , at the beginning , i was doing this : ground.onReady = function () { var stones = assetsManager.addMeshTask("stones", "", "assets/stones/", "stones.babylon"); stones.onSuccess = function(task) { task.loadedMeshes.forEach(function(mesh) { mesh.isVisible = false; var range = 1024; var count = 40; for (var index = 0; index < count; index++) { var newInstance = mesh.createInstance("j" + index); var x = range / 2 - Math.random() * range; var z = range / 2 - Math.random() * range; var y = ground.getHeightAtCoordinates(x, z) ; // Getting height from ground object newInstance.position = new BABYLON.Vector3(x, y, z); } }); } } But i noticed the meshes were not appearing with that way, any ideas why ? So , ... i solved it this way instead , adding the assetsManager.load() inside onReady method: ground.onReady = function () { assetsManager.load(); } Now everything loads completely without issues or delay. Btw as you can see i am using the assetsManager , but i also tried using the SceneLoader.ImportMesh this way: ground.onReady = function () { BABYLON.SceneLoader.ImportMesh("SmallTree1", "assets/SmallTree1/", "SmallTree1.babylon", scene, function (newMeshes) { }); } This method also load perfect too , as you can see in the code above i can include the BABYLON.SceneLoader.ImportMesh inside the onReady method , and in this case it works perfect not like the assetsManager.addMeshTask that were not loaded. what do you think guys about this methods ? , i don't think it will impact on performance . don't it ? , and sorry if this question is noob but which method on importing objects is the best assetsManager or SceneLoader.ImportMesh ? , in which case do you think is the best on using each? , thanks for your support guys ! i am really grateful to have a great comunity on babylon !
  6. Hello good day team from babylon , i am really glad to have known babylon as well, it is a great tool , i am currently having some issues when using : ground.getHeightAtCoordinates(x, z) , i am currently using the export Toolkit that exports from Unity to Babylon js . i have imported the meshes to my scene using the "assetsManager" this way : var stones = assetsManager.addMeshTask("stones", "", "assets/stones/", "stones.babylon"); stones.onSuccess = function(task) { task.loadedMeshes.forEach(function(mesh) { mesh.isVisible = false; var range = 1024; var count = 40; for (var index = 0; index < count; index++) { var newInstance = mesh.createInstance("j" + index); var x = range / 2 - Math.random() * range; var z = range / 2 - Math.random() * range; var y = ground.getHeightAtCoordinates(x, z) ; // Getting height from ground object newInstance.position = new BABYLON.Vector3(x, y, z); } }); } The idea of using : ground.getHeightAtCoordinates(x, z) was to set each of my meshes in this case "stones" to the ground level on a random location on my scene . The problem starts when i import 1 or more meshes for example a "Palm.babylon or Plant.babylon" that i want to set it in random locations on my scene as well on ground level, then i instanciate and use "var y = ground.getHeightAtCoordinates(x, z) ;" the same way as the stones , but when i load the scene all the meshes doesn't load and i have to reload multiple times so it can appear all the meshes , and sometimes all the meshes never appear . Surprisingly when i replace : ground.getHeightAtCoordinates(x, z) to another high for example : 40 or another number , all the meshes appears correctly , that's why i suspect of getHeightAtCoordinates(x, z) function , Not sure if i am doing the correct importing ? , or it has to be something to Unity exporter? or getHeightAtCoordinates() ? , Anyone have an idea of what could be ocurring ? I wanted to add that if i increment the range of the meshes to be on the scene for example my ground is 1024*1024 and the range of my sheshes is 2048*2048 , all the meshes that are outside the ground appears correctly and the meshes inside the ground doesn't appear , any ideas? maybe it has to be something about memory?
  7. JonathanRev

    Shadow not showing with DirectionalLight

    It would be great to have WORLDMONGER.GroundMaterial accepting the shadows of the meshes , i am also working on it , but shaders is quiet a bit far from my knowledge at this moment , i will try to investigate it
  8. JonathanRev

    WORLDMONGER Material Explination

    Hello guys, i am really happy with babylon and the comunity is very helpfull , i just have a question ,@Deltakosh can i use worldmonger in my project ? , or need any permition or licence to use it? also am i able to modify and customize it? , thanks for your help in advance !
  9. Btw anyone knows how to do the effect of refraction when i am underwater? cause i can not see the mountains from undertwater as you can see on the last image , i've tried to use : water.backFaceCulling = true; but i get this result on the image , the red line is supposed to be the ocean level as well
  10. Wow it was a fast answer, yes i've been trying this now , you were right @Pryme8 about the "scene.activeCamera" , it would be great to use the variable camera name as well , not sure what you think guys ? i've also created the variables of the colors of the fog outside the scene.registerBeforeRender cause until i know if i set it inside it , it will create that colors ilimited times? not sure if i am wrong? scene.fogMode = BABYLON.Scene.FOGMODE_EXP2; var colorfogwater = new BABYLON.Color3(10/255, 80/255, 130/255); // blue underwater var colorfogAmbient= new BABYLON.Color3(0.8, 0.8, 0.9); scene.registerBeforeRender(function() { if(scene.activeCamera.position.y<=0){ scene.fogColor = colorfogwater; scene.fogDensity = 0.008; } if(scene.activeCamera.position.y>0){ scene.fogColor = colorfogAmbient; scene.fogDensity = 0.00001; } }); it is not a profetional looks cause i am new , but i think i will try as @Dad72 says about using postprocess instead
  11. Hello good day / night guys, I am new on the comunity of babylonjs , really happy to have found a great tool to make some games , i have a concern about if there is a way that according to the camera.position.y it can change the scene's properties , for example like the fog if i am underwater and change it back to less fog if i am outside the water ? i've tried this : "scene.getCameraByName("FreeCamera").position.y<=0" and "scene.getCameraByName("FreeCamera").position.y>0" , but not sure if it is okey to set it inside the : scene.registerBeforeRender ? like this : scene.registerBeforeRender(function() { if(scene.getCameraByName("FreeCamera").position.y<=0){ // properties for camera when is inside water } if(scene.getCameraByName("FreeCamera").position.y>0){ // properties for camera when is outside water } }); will this affect performance? , or there is another way to detect camera positions to change properties according to the high level ? , thanks in advance