Jump to content

Several questions


reddozen
 Share

Recommended Posts

Is it posiable to add textures to babylon scenes? seems to be accepting the color but not the texture.

 

Example:

BABYLON.SceneLoader.ImportMesh("", "../Models/", "hod_f00.babylon", scene, function (newMeshes, particleSystems) {    var groundMaterial = new BABYLON.StandardMaterial("newMeshes[0]", scene);    groundMaterial.diffuseTexture = new BABYLON.Texture("ground.jpg", scene);    groundMaterial.diffuseTexture.uScale = 6;    groundMaterial.diffuseTexture.vScale = 6;    groundMaterial.specularColor = new BABYLON.Color3(0, 0, 0);    newMeshes[0].material = groundMaterial;});

I've noticed that if you push the sky boxes out too far, they go gray and get blocky. Is it posible to add exclusions to the view range of camera, or even float a smaller skybox around the camera so that as the camera moves the skybox moves proportionately to the X and Z axis?

 

 

lastly, would it be posible to make a simple way to create layered textures through a GLSL shader?

 

Example:

groundMaterial.layerdTexture(<Layer>, <Base Texture>, <Base Type>, <Alpha Texture>, <Scene>)Layer: The texture layerBase Texture: the colored textureBase Type: repeating or stretchedAlpha Texture: blank for none or based on the Base Texture. Otherwise, a stretched alpha map.

I hope this makes since. I have had a hard time even finding a solid example of this in GLSL.

Link to comment
Share on other sites

Waht do you mean by "add textures". All our demos and samples use textures and you can find a tutorial right here:

https://github.com/BabylonJS/Babylon.js/wiki/04-Materials

 

Perhaps on your example, the object does not have coordinates textures?

 

You can change the range of the camera with camera.minZ and camera.maxZ. For now, alas, there is no way to apply different ranges to differents meshes 

 

Could you be more precise about layered texture? What kind of output do you expect? 

Link to comment
Share on other sites

About the textures. I'm able to add them fine to things like planes or objects that I create within babylon. I'm wondering if there's a way to add textures to objects loaded in through BABYLON.SceneLoader.ImportMesh() function. I haven't been able to get that work.

 

Yes, the object has no textures linked in through the *.babylon file. I was hoping to be able to load them outside of blender.

 

I guess I could reposition the skybox in the render loop based on the camer position as "center". I'll try it out.

 

Basicially I need to be able to lay my sand texture down, then my dirt, then my grass. However, with each layer i need the texture to repeat, and then the alph texture to stretch and drape the entire object to control where the previous layer is sceen through. If this doenst make since, I'll link you to a few files as an example.

Link to comment
Share on other sites

Your loaded object should not have textures coordinates. If you export your object from Blender you have to generate textures coordinates.

 

For your layer question have you look at this article:

http://blogs.msdn.com/b/eternalcoding/archive/2013/08/06/babylon-js-creating-a-convincing-world-for-your-game-with-custom-shaders-height-maps-and-skyboxes.aspx

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...