Skip to content

Commit d0ec5ba

Browse files
committed
Mobile Optimized SaltFlatsEnv
Added a version of SatFlatsEnvironment for Mobile, Dropping the ground from 66k to 30k polygons, dropped the diffuse texture from 4k to 2k, and disabled Normal Map math when on Mobile `SaltFlatsEnvironment_mobile.fbx`
1 parent 0c0f535 commit d0ec5ba

14 files changed

Lines changed: 548 additions & 499 deletions

File tree

docs/bots/siteContent.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@
7070
"type": "image",
7171
"src": "../pages/pxlNav/images/userDetails.webp",
7272
"alt": "Showing User Details in different CGI programs",
73-
"caption": "Add custom User Details to objects in your 3d modeling software, Allowing pxlNav to better understand your FBX file."
73+
"caption": "Add custom User Details to objects in your 3d modeling software, Allowing pxlNav to better understand your FBX / GLTF file."
7474
}
7575
],
76-
"content": "\n The background of this page is running '<span class=\"textNudge\">pxlNav</span>',\n <br>&nbsp;&nbsp; A javascript package to extend Three.js for more interactive / game like mechanics.\n\n <br>\n \n <br><span class=\"textNudge\">pxlNav</span> is a player controller + rendering set-up that brings more interactive functionality to Three.js.\n <br>&nbsp;&nbsp; It's basically a wrapper for Three.js, using Three's renderer, character rig + animation features, to create something like a game engine... I guess.\n \n <br>\n <br>\n <br>\n <div class=\"innerCenter\">\n Install it for your web project using NPM\n <div class=\"textBoldBox\">npm -i pxlnav</div>\n <br>\n If you are familiar with GLSL,\n <br>Press the <span class=\"textBoldBox\">Y</span> key to use the <span class=\"textName\">Shader Editor</span> in <span class=\"textNudge\">pxlNav</span>.\n </div>\n\n <br>\n <br>You can use any 3d modeling software to make interactive environments called <span class=\"textName\">Rooms</span>, making it a little easier to make games/interactive environments.\n \n <br>\n <br>It supports rig + animation fbx files for your character animation, and a simple curve in your scene can act as your camera path ( add another if you want the camera to look somewhere as it's traveling the path ).\n <br>&nbsp;&nbsp; Animated textures by using a second texture, particle effects, FPS navigation, ground collision, obstacles, items, portals, and more.\n\n <br>\n <br>Lets say, in Maya or Blender, you make a scene, add extra User Detail attributes to your objects to tell <span class=\"textNudge\">pxlNav</span> how to interact with them.\n <div class='textSpacer'></div>\n Giving you the ability in your modeling software to set up-\n <br>&nbsp;&nbsp; Teleporter colliders within scene or between <span class=\"textName\">Rooms</span>, set item pick-ups, ground colliders, animated textures, and more set in your 3d modeling software of choice.\n <div class='textSpacer'></div>\n <br>&nbsp;&nbsp; For customized object coding in javascript, mark objects as 'isScripted' and you can easily access that specific object by name in code.\n <div class='textSpacer'></div>\n <br>&nbsp;&nbsp; Then <span class=\"textNudge\">pxlNav</span> loads your FBX and acompanying javascript file as a <span class=\"textName\">Room</span> that can be portal'ed to if ya wanted.\n\n \n <br>\n <br>Note : GLTF & GLB using Draco compression is nearly implemented & bug free, added to the next version of pxlNav, v1.0.0\n <br>&nbsp;&nbsp;&nbsp;&nbsp; To be released with support for React & Next and example projects for each.\n <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; See the <span class=\"textName\">v1.0.0-dev</span> branch for progress.\n <br>\n <br>\n ",
76+
"content": "\n The background of this page is running '<span class=\"textNudge\">pxlNav</span>',\n <br>&nbsp;&nbsp; A javascript package to extend Three.js for more interactive / game like mechanics.\n\n <br>\n \n <br><span class=\"textNudge\">pxlNav</span> is a player controller + rendering set-up that brings more interactive functionality to Three.js.\n <br>&nbsp;&nbsp; It's basically a wrapper for Three.js, using Three's renderer, character rig + animation features, to create something like a game engine... I guess.\n \n <br>\n <br>\n <br>\n <div class=\"innerCenter\">\n Install it for your web project using NPM\n <div class=\"textBoldBox\">npm -i pxlnav</div>\n <br>\n If you are familiar with GLSL,\n <br>Press the <span class=\"textBoldBox\">Y</span> key to use the <span class=\"textName\">Shader Editor</span> in <span class=\"textNudge\">pxlNav</span>.\n </div>\n\n <br>\n <br>You can use any 3d modeling software to make interactive environments called <span class=\"textName\">Rooms</span>, making it a little easier to make games/interactive environments.\n \n <br>\n <br>It supports rig + animation fbx files for your character animation, and a simple curve in your scene can act as your camera path ( add another if you want the camera to look somewhere as it's traveling the path ).\n <br>&nbsp;&nbsp; Animated textures by using a second texture, particle effects, FPS navigation, ground collision, obstacles, items, portals, and more.\n\n <br>\n <br>Lets say, in Maya or Blender, you make a scene, add extra User Detail attributes to your objects to tell <span class=\"textNudge\">pxlNav</span> how to interact with them.\n <div class='textSpacer'></div>\n Giving you the ability in your modeling software to set up-\n <br>&nbsp;&nbsp; Teleporter colliders within scene or between <span class=\"textName\">Rooms</span>, set item pick-ups, ground colliders, animated textures, and more set in your 3d modeling software of choice.\n <div class='textSpacer'></div>\n <br>&nbsp;&nbsp; For customized object coding in javascript, mark objects as 'Scripted' and you can easily access that specific object by name in code.\n <div class='textSpacer'></div>\n <br>&nbsp;&nbsp; Then <span class=\"textNudge\">pxlNav</span> loads your 3d scene file and accompanying javascript file as a <span class=\"textName\">Room</span> that can be portal'ed to if ya wanted.\n\n \n <br>\n <br>Note : GLTF & GLB using Draco compression is nearly implemented & bug free, added to the next version of pxlNav, v1.0.0\n <br>&nbsp;&nbsp;&nbsp;&nbsp; To be released with support for React & Next and example projects for each.\n <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; See the <span class=\"textName\">v1.0.0-dev</span> branch for progress.\n <br>\n <br>\n ",
7777
"pageURL": "https://procstack.github.io/pxlNav/Whats_pxlNav.htm",
7878
"relativeURL": "./pxlNav/Whats_pxlNav.htm"
7979
},
242 KB
Loading

docs/js/pxlRooms/SaltFlatsEnvironment/Assets/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Texture files can be included/embeded within the FBX,
1+
Texture files can be included/embeded within the FBX / GLTF,
22
But its advised against doing that.
33
There is some image management done in pxlNav for easier accessibility to shared resources
44
Being, if an already loaded image is requested again,
Binary file not shown.

docs/js/pxlRooms/SaltFlatsEnvironment/SaltFlatsEnvironment.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export class SaltFlatsEnvironment extends RoomEnvironment{
5050
this.assetPath=assetPath+"Assets/";
5151

5252
this.sceneFile = this.assetPath+"SaltFlatsEnvironment.fbx";
53+
this.sceneMobileFile = this.assetPath+"SaltFlatsEnvironment_mobile.fbx";
5354
this.animInitCycle = "Walk";
5455

5556
// Animation Source & Clips are managed under the hood,
@@ -355,18 +356,26 @@ export class SaltFlatsEnvironment extends RoomEnvironment{
355356
[
356357
UniformsLib[ "lights" ],
357358
{
358-
'normalTexture' : { type:'t', value: null },
359359
'noiseTexture' : { type:'t', value: null },
360360
'smoothNoiseTexture' : { type:'t', value: null },
361361
'cloudTexture' : { type:'t', value: this.cloud3dTexture },
362362
'fogColor' : { type: "c", value: this.fogColor },
363363
}]
364364
)
365-
envGroundUniforms.normalTexture.value = this.pxlUtils.loadTexture( this.assetPath+"BasinTerraces_normal.webp", null, textureOptionsLinearSRGB );
366365
envGroundUniforms.noiseTexture.value = this.pxlUtils.loadTexture( "Noise_UniformWebbing.jpg" );
367366
envGroundUniforms.smoothNoiseTexture.value = this.pxlUtils.loadTexture( "Noise_Soft3d.jpg", null, textureOptionsRepeat );
367+
368+
// No need for normal maps on mobile
369+
// Just wasted resources with little pay off
370+
let enableNormalMap = !this.mobile;
371+
if( enableNormalMap ){
372+
//'normalTexture' : { type:'t', value: null },
373+
envGroundUniforms.normalTexture = { type:'t', value: null };
374+
envGroundUniforms.normalTexture.value = this.pxlUtils.loadTexture( this.assetPath+"BasinTerraces_normal.webp", null, textureOptionsLinearSRGB );
375+
}
368376

369-
let mat=this.pxlFile.pxlShaderBuilder( envGroundUniforms, envGroundVert(), envGroundFrag() );
377+
378+
let mat=this.pxlFile.pxlShaderBuilder( envGroundUniforms, envGroundVert(enableNormalMap), envGroundFrag(enableNormalMap) );
370379
mat.side=FrontSide;
371380
mat.lights= true;
372381

@@ -394,6 +403,15 @@ export class SaltFlatsEnvironment extends RoomEnvironment{
394403
this.materialList[ "SalioaPlant_geo" ]=salioaMtl;
395404

396405

406+
407+
// -- -- --
408+
409+
// Check for Mobile, use mobile scene file if so
410+
// I'll set up something more automatic for `pxlNav` in a future update
411+
if( this.mobile && this.sceneMobileFile ){
412+
this.sceneFile = this.sceneMobileFile;
413+
}
414+
397415
// -- -- --
398416

399417
return this.pxlFile.loadRoomFBX( this );

0 commit comments

Comments
 (0)