reddozen

Members
  • Content Count

    401
  • Joined

  • Last visited

  • Days Won

    1

reddozen last won the day on June 10 2014

reddozen had the most liked content!

About reddozen

  • Rank
    Advanced Member

Recent Profile Visitors

1487 profile views
  1. reddozen

    VR gear?

    I have the Gear VR and Samsung controller. Only problem I have is that you're stuck with just one with limited buttons etc. So it can be limited for game user.
  2. I've been wondering since I bought it if you could do 2 controllers since the device supports 2 Bluetooth devices... I just haven't bought a second controller to find out yet. EDIT: Confirmed that 2 gearVR controller support does not currently exist. Hopefully this is something that they will fix in the future.
  3. I'll have to look at that... may be able to simplify mine some. ua4192, I forgot to mention that mine uses the "tags" feature to group objects in their regions. But you can see that from looking at it. That simplified my organized lists by letting Babylon keep up with it instead of me. Not sure if that's more or less process heavy, but it works well.
  4. I couldn't find a good occlusion method either @jerome I ended up subdividing my scene into dynamic regions and calculating 'neighbor' cubes and dropping the visibility of those meshes not in my local regions. Every so many frames I recalc what region the camera is in and reevaluate what regions are loaded and what regions need to be hidden or loaded. When you call this evaluation can probably still be greatly optimized. This is just something I'm playing with as I have time.... I'm loading lists of models dynamically from a database too. You can see the region functions I wrote here and the fully built scene load call: http://www.red12.studio/Demos/Web/Include/Loaders/map_loader.php?region=1&zone=1 This is the PHP for the actual load builder (creates a javascript function to call "load map" from the main scene) <?php echo " // build all the map objects var load_map = function(scene, offset, DBObj, REGIONS) {"; $last_obj=""; list($res) = get_query("SELECT MIN( px ) AS min_px, MAX( px ) AS max_px, MIN( pz ) AS min_pz, MAX( pz ) AS max_pz, MIN( py ) AS min_py, MAX( py ) AS max_py FROM `map_info` WHERE `region`=". $region ." && `zone`=". $zone .";"); $SR = mysql_fetch_array($res); $min_x = $SR['min_px']; $max_x = $SR['max_px']; $min_z = $SR['min_pz']; $max_z = $SR['max_pz']; $min_y = $SR['min_py']; $max_y = $SR['max_py']; if ($min_x < 0) { $min_x = floor($min_x); } else { $min_x = ceil($min_x); } if ($max_x < 0) { $max_x = floor($max_x); } else { $max_x = ceil($max_x); } if ($min_y < 0) { $min_y = floor($min_y); } else { $min_y = ceil($min_y); } if ($max_y < 0) { $max_y = floor($max_y); } else { $max_y = ceil($max_y); } if ($min_z < 0) { $min_z = floor($min_z); } else { $min_z = ceil($min_z); } if ($max_z < 0) { $max_z = floor($max_z); } else { $max_z = ceil($max_z); } $x_levels = ceil((abs($max_x) + abs($min_x)) / $sub_region_size); $y_levels = ceil((abs($max_y) + abs($min_y)) / $sub_region_size); $z_levels = ceil((abs($max_z) + abs($min_z)) / $sub_region_size); $region_id = 1; for ($ix=1; $ix<=$x_levels; $ix++) { $min_x_t = $min_x + ($sub_region_size * ($ix-1)); $max_x_t = $min_x_t + $sub_region_size; $min_y_t = $min_y; $max_y_t = $min_y_t + $sub_region_size; $min_z_t = $min_z; $max_z_t = $min_z_t + $sub_region_size; for ($iz=1; $iz<=$z_levels; $iz++) { $min_z_t = $min_z + ($sub_region_size * ($iz-1)); $max_z_t = $min_z_t + $sub_region_size; for ($iy=1; $iy<=$y_levels; $iy++) { $min_y_t = $min_y + ($sub_region_size * ($iy-1)); $max_y_t = $min_y_t + $sub_region_size; $region_info[$region_id]['min_x'] = $min_x_t; $region_info[$region_id]['max_x'] = $max_x_t; $region_info[$region_id]['min_y'] = $min_y_t; $region_info[$region_id]['max_y'] = $max_y_t; $region_info[$region_id]['min_z'] = $min_z_t; $region_info[$region_id]['max_z'] = $max_z_t; echo " REGIONS[". $region_id ."] = { min_x: ". $min_x_t .", max_x: ". $max_x_t .", min_y: ". $min_y_t .", max_y: ". $max_y_t .", min_z: ". $min_z_t .", max_z: ". $max_z_t .", region_x: ". $ix .", region_y: ". $iy .", region_z: ". $iz .", neighbors: [], inside: [] };"; $region_id++; } } } echo " calculate_neighbors(REGIONS); // lights var sun = new BABYLON.HemisphericLight(\"Hemi0\", new BABYLON.Vector3(0, 1, 0), scene);"; if (!$inside) { echo " // skybox var skybox = BABYLON.Mesh.CreateBox(\"skyBox\", 170.0, scene); var skyboxMaterial = new BABYLON.StandardMaterial(\"skyBox\", scene); skyboxMaterial.backFaceCulling = false; skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture(\"Include/Skybox/skybox\", scene); skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE; skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0); skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0); skybox.material = skyboxMaterial; skybox.infiniteDistance = true; skybox.isPickable = true; skybox.name= \"skybox\"; DBObj[skybox.name] = { ID: \"999999999\", Name: \"Skybox\", px: \"0\", py: \"0\", pz: \"0\", rx: \"0\", ry: \"0\", rz: \"0\", sx: \"0\", sy: \"0\", sz: \"0\", wx: \"0\", wy: \"0\", wz: \"0\", visible: \"1\", inside: \"0\", allvisible: \"1\", maxview: \"0\", collision: \"0\" };"; } // build all the water textures and babylon meshes... $water_count=0; $water_id=999991000; unset($water_name); list($res) = get_query("SELECT * FROM `water` WHERE `region`=". $region ." && `zone`=". $zone .";"); while ($water = mysql_fetch_array($res)) { $water_name[$water['water_id']] = $water['name']; $water_count += 1; $water_id += 1; echo " var ". $water['name'] ."_tex = new BABYLON.WaterMaterial(\"water_material". $water_count ."\", scene); ". $water['name'] ."_tex.bumpTexture = new BABYLON.Texture(\"Include/Textures/Bawssump/". $water['bump'] ."\", scene); ". $water['name'] ."_tex.bumpHeight = 0.1; ". $water['name'] ."_tex.windForce = ". $water['wind_force'] ."; ". $water['name'] ."_tex.windDirection = new BABYLON.Vector2(". $water['wind_dir1'] .", ". $water['wind_dir2'] ."); ". $water['name'] ."_tex.waveHeight = ". $water['wave_height'] ."; ". $water['name'] ."_tex.waveLength = ". $water['wave_length'] ."; ". $water['name'] ."_tex.waterColor = new BABYLON.Color3(". $water['red'] .", ". $water['green'] .", ". $water['blue'] ."); ". $water['name'] ."_tex.colorBlendFactor = ". $water['color_blend'] .";"; if (!$inside) { echo " ". $water['name'] ."_tex.addToRenderList(skybox);"; } if (!$water['texture_only']) { echo " var ". $water['name'] ."_mesh = BABYLON.Mesh.CreateGround(\"ground\", ". $water['length'] .", ". $water['width'] .", ". $water['depth'] .", scene); ". $water['name'] ."_mesh.name = \"". $water['name'] ."\"; ". $water['name'] ."_mesh.position.y += ". $water['x'] ."; ". $water['name'] ."_mesh.position.y += ". $water['y'] ."; ". $water['name'] ."_mesh.position.y += ". $water['z'] ."; // need to add in rotation for the water later... //". $water['name'] ."_mesh.rotation.y = ". $water['r'] ."; ". $water['name'] ."_mesh.backFaceCulling = true; ". $water['name'] ."_mesh.material = ". $water['name'] ."_tex; DBObj[". $water['name'] ."_mesh.name] = { ID: \"". $water_id ."\", Name: \"". $water['name'] ."\", px: \"0\", py: \"0\", pz: \"0\", rx: \"0\", ry: \"0\", rz: \"0\", sx: \"0\", sy: \"0\", sz: \"0\", wx: \"0\", wy: \"0\", wz: \"0\", visible: \"1\", inside: \"0\", allvisible: \"1\", maxview: \"0\", collision: \"0\" };"; } } if ($water_count) { echo " "; } //$sub $count=0; list($res) = get_query("SELECT * FROM `objects` LEFT JOIN `map_info` ON `objects`.`name`=`map_info`.`name` WHERE `region`=". $region ." && `zone`=". $zone ." && `disabled`=0 ORDER BY `package`, `objects`.`name`;"); while ($objects = mysql_fetch_array($res)) { if ($last_package!=$objects['package']) { if ($last_package!="") { echo "];"; $count=0; } echo " // package meshes var package_". $objects['package'] ." = ["; } if ($last_obj!=$objects['name']) { if ($count>0) { echo ", "; } echo "\"". $objects['name'] ."\""; $count++; } $last_package = $objects['package']; $last_obj = $objects['name']; } echo "];"; $last_package=""; $last_obj=""; mysql_data_seek($res, 0); while ($objects = mysql_fetch_array($res)) { if ($last_package!=$objects['package']) { if ($last_package!="") { echo " } } } ); "; } echo " BABYLON.SceneLoader.ImportMesh(package_". $objects['package'] .", \"". $home_path . $objects['dir'] . $file_type ."/". $objects['package'] ."/\", \"". $objects['package'] .".babylon\", scene, function(mapZone, particleSystems, skeletons) { for (var i=0; i<mapZone.length; i++) { "; } if ($last_obj!=$objects['name']) { if ($last_obj!="" && $last_package==$objects['package']) { echo " }"; } echo " if (mapZone[i].name == \"". $objects['name'] ."\") { //////////////////////////////////////////////////////// // Parent Mesh // Due to issues when hiding the parent mesh, making the // parent it's own thing and dropped below where it // would ever be viewed. //////////////////////////////////////////////////////// mapZone[i].visiblity=true; mapZone[i].isVisible=true; mapZone[i].name = \"". $objects['name'] ."\"; mapZone[i].position = new BABYLON.Vector3(0, -100000, 0); mapZone[i].scaling = new BABYLON.Vector3(". $objects['sx'] .", ". $objects['sy'] .", ". $objects['sz'] ."); mapZone[i].rotationQuaternion = null; mapZone[i].rotation = new BABYLON.Vector3(". $objects['rx'] .", ". $objects['ry'] .", ". $objects['rz'] ."); mapZone[i].backFaceCulling = false; mapZone[i].isPickable = true; //////////////////////////////////////////////////////// // Instance Copies // Making every model an instance. Increases the verts, // but there are issue with hiding the parent models. //////////////////////////////////////////////////////// item_used=1; var ". $objects['name'] ."_inst = 0;"; } echo " ". $objects['name'] ."_inst++; objInstance = mapZone[i].createInstance(\"". $objects['name'] ."_inst_\"+ ". $objects['name'] ."_inst +\"\"); objInstance.visiblity = true;"; if ($objects['always_visible']) { echo " objInstance.isVisible=true;"; } else { echo " objInstance.isVisible=false;"; } echo " objInstance.position = new BABYLON.Vector3(". $objects['px'] .", ". $objects['py'] .", ". $objects['pz'] ."); objInstance.scaling = new BABYLON.Vector3(". $objects['sx'] .", ". $objects['sy'] .", ". $objects['sz'] ."); objInstance.rotationQuaternion = null; objInstance.rotation = new BABYLON.Vector3(". $objects['rx'] .", ". $objects['ry'] .", ". $objects['rz'] ."); objInstance.backFaceCulling = false; objInstance.isPickable = true; objInstance.freezeMatrix(); objInstance.freezeMaterials(); DBObj[objInstance.name] = { ID: ". $objects['object_id'] .", Name: \"". $objects['name'] ."\", px: \"". $objects['px'] ."\", py: \"". $objects['py'] ."\", pz: \"". $objects['pz'] ."\", rx: \"". $objects['rx'] ."\", ry: \"". $objects['ry'] ."\", rz: \"". $objects['rz'] ."\", sx: \"". $objects['sx'] ."\", sy: \"". $objects['sy'] ."\", sz: \"". $objects['sz'] ."\", wx: \"". $objects['wx'] ."\", wy: \"". $objects['wy'] ."\", wz: \"". $objects['wz'] ."\", visible: \"". $objects['visible'] ."\", inside: \"". $objects['inside'] ."\", allvisible: \"". $objects['always_visible'] ."\", maxview: \"". $objects['max_distance'] ."\", collision: \"". $objects['collision'] ."\""; for ($FR=1; $FR<=sizeof($region_info); $FR++) { if ( ($region_info[$FR]['min_x']<=$objects['wx'] && $region_info[$FR]['max_x']>=$objects['wx']) && ($region_info[$FR]['min_y']<=$objects['wy'] && $region_info[$FR]['max_y']>=$objects['wy']) && ($region_info[$FR]['min_z']<=$objects['wz'] && $region_info[$FR]['max_z']>=$objects['wz']) ) { echo ", region: ". $FR .""; break; } } echo " }; BABYLON.Tags.AddTagsTo(objInstance, \"region\"+ ". $FR ." +\"\");"; // any mesh that is water needs the material added if ($objects['water']) { echo " objInstance.material = null; objInstance.material = ". $water_name[$objects['water']] ."_tex;"; } // add water reflection / refractions list($w_res) = get_query("SELECT `water`.`name` FROM `map_info_reflect` LEFT JOIN `water` ON `map_info_reflect`.`water_id` = `water`.`water_id` WHERE `map_info_reflect`.`object_id`=". $objects['object_id'] .""); while ($reflect = mysql_fetch_array($w_res)) { echo " ". $reflect['name'] ."_tex.addToRenderList(objInstance);"; } $last_package=$objects['package']; $last_obj=$objects['name']; } echo " } } } ); }"; ?>
  5. You can see how I used tags in this loader. I define sub regions on the map with tags to control visibility. http://red12.studio/Demos/Web/Include/Loaders/map_loader.php?region=1&zone=1
  6. WebAssmebly has been officially released for FireFox 52, and Chrome 58. Any plans to test this in the future? I know there were some tests previously on asm.js. Unreal has already released a new demo showing it off for their engine.
  7. Officially enabled by default in both Firefox and Chrome now. Microsoft appears to be the only hold out... again.
  8. As long as they aren't standing next to a wall close enough to clip out as they're leaving the characters personal space.
  9. Setting the alpha level or the specularpower doesn't seem to do anything about lowering the intensity of the skybox reflection. My guess is that it's something to do with the water material.
  10. I hacked something together... Now my next question... is there a way to tone down the reflection to make the refraction come through more? Basically make the water more clear, while still seeing the reflections.
  11. The mesh is flat, but you could have flowing water like a water fall that isn't flat that would may want refraction / reflection on. So I'm assuming that I will need to make a custom shader, or did I do something wrong with how I'm using water material?
  12. I have attached a picture, and you can use the mouse to drag and look around. Could take a minute to load Could the problem be that my mesh has a texture applied to it already? can that be resolved without reprocessing the mesh in 3DS?
  13. No matter what I do, I cannot get water material to work with existing meshes. I'm assuming that it doesn't work, and will only work with built in "ground" meshes. If so, this is a problem. My scene below is a good example. Odd shaped pool where a plane wouldn't work. Any help would be appreciated. I'm at a loss. http://red12.studio/Demos/Web/index_water_test.html