Search the Community
Showing results for tags 'Materials'.
-
Hi, Is there anyway to allow double side materials or mesh? I have a plane with a texture on. At the moment when the camera dips under the plane the texture isn't showing. When the camera is on top, it's showing fine. Thanks
-
Hi, I had some transparent textures that broke when updating to the current nightly build (from 3.2). After much searching, the problem seems to depend on the timing of when I call "mat.freeze()". Can someone confirm if this is a bug or not? Specifics: in my project I create and set up my materials and textures at init, and then freeze the material. I delay the "freeze" call, to give Babylon a chance to initialize, but this is while the game is paused so no renders are taking place. var mat = new BABYLON.StandardMaterial(name, scene) // set some colors... var tex = new BABYLON.Texture(url, scene, noMip, true, sampling) tex.hasAlpha = true mat.diffuseTexture = tex // freeze material after a tick setTimeout($ => { mat.freeze() }, 10) In 3.2 this worked fine, but in 3.3 my transparent textures are broken. If I delay calling "mat.freeze()" until after the scene has rendered at least once, things work as in 3.3. Bug or no? When is it safe to freeze materials? Thanks!
-
Hello community We have an object ( 2 meshes ) with multi material exported with 3dsmax to GLTF format. In inspector, we saw that the exporter splitted our object to 13 meshes. One mesh for each material. Is it possible to keep the same object but with a multi material option instead ? Thanks in advance. Have a nice day .
-
This may be a dumb typo error, but I'm asking just in case it's something truly weird. I want to utilize the Shadow-Only material, but it's not showing its effects. To clarify, using a default sphere and a directional light, I'm casting shadows on a plane. The shadows show on a non-Shadow-Only material, but once Shadow-Only is activated, the shadows disappear. (as exemplified by "testscene.js") (Efforts to work from the sample playground have been weird. While I got the sample to work by downloading it, it will no longer load my obj files. Either problem is fine, I just want to know what I'm doing wrong, or what's happening. (as exemplified by "index.html")) EDIT: I realised it has something to do with my hemispheric light, but I don't know why that is. I'd really quite prefer if I kept it, so if there are any explanations I'd be happy to hear it! index.html testscene.js
-
Hello, this is my first post, but visit the forum for a while and am thrilled. :-) I'm currently working on a Babylon project and I'm using a CustomShader (ShaderMaterial) for the Meshes. Now I wanted to use mesh.dispose(); and mesh.material.dispose(); to remove the textures, but it does not work. Whenever I check the size with scene.textures.length, it becomes more and more. What helps?
-
Hi Everyone I'm trying to build a material which has a gradient of transparency. At the moment it seems to be binary either on or off. Is there a way to enable blended alpha? At the moment, I'm passing a png file to the diffuse texture and using ...someMaterial.diffuseTexture.hasAlpha = true; Hope this makes sense.. Edit: Ok just found opacityTexture. Thanks if you read this anyway
-
I read in another topic/question here that you should not freeze materials of instances, and from personal experience I see (or should I say, "do not see") the problem...the instances are transparent. Is it better to give the instances their own material to share and freeze it, or to not freeze the material for that mesh and its instances? Also, what is causing the problem of the instances not being visible when the material is frozen? I have no background in 3d, so it could be something obvious, but I am still curious.
-
Hello! Does anyone have time to lend a hand with some optimisation please? I've been trying to get some dynamic ring shapes to look good and respond well, and performance seems OK on PC's (I've tested on 3 or 4 PC's with varying specs). On Macs (iMac, recent macbook pro and a mac mini) the CPU shoots up to 99% in Safari, so I'm obviously doing something wrong. Even with texture reflection and refraction turned off and lower detail it's still very jumpy and slow. I updated chrome on the mac, which seemed to help and gave much better performance - but it's still far from the performance of a PC. I have a feeling that Safari might just have a bad implementation of WebGL. The basic playground examples run really slowly too. I'm using a Lathe to create the ring, and I'm aware of the latheTesselation, which shouldn't be too high. The API says that the Lathe can be set to "updatable", and I've tried to use code to update it, but the 2 code examples that I tested just didn't work. I think this is because the update can only move existing points, and not replace them. Any time I want to update the ring parameters I just dispose of it and recreate it. Any tips are well appreciated - And sorry about the shoddy code!! http://tolli.co.uk/babylonjs/rings/
- 2 replies
-
- slow in safari
- optimisation
-
(and 2 more)
Tagged with:
-
I've exported a mesh from Blender that has 2 materials but I don't know how to access the 2nd material in javascript. The "subMaterials" array has length of 2 but the 2nd element is null. The .babylon file mentions the 2 materials. "multiMaterials":[{"name":"netball.Multimaterial#0","id":"netball.Multimaterial#0","materials":["netball.matBodymat","netball.matOutfitmat"]}], Do I need to do something special in Blender to make this work?
-
Is there a way to know if all the materials that have been created in a scene are done rendering without continually querying all the materials to find out if they are ready(material.isReady)? I am using several PBR materials and I have a screen that covers the scene until all the meshes are loaded, but I want to keep the scene from popping in materials after the screen is gone. Here is what I am working on for an example http://protest.jht.com/gea_engines101_new/ Thanks in advance
-
I am seeking help to solve this issue that has been a real challenge to me. I have a scene with an interactive car. The model was updated in Blender 2.78 and Blender exporter 5.1.2. The body, doors, hood, and trunk are separate meshes that use the same material. Everything seem to be okay when I view the scene in the sandbox. (All the meshes, materials and textures seem to be just right.) When I view the scene locally, a couple of the meshes will have the correct material and textures applied to them while they would be missing from other meshes that use the same material. When I view the scene live online, all the the textures will be missing. I have attached a couple of screen captures to explain what I mean. Here is the link to the online scene. Here is a link to the Babylon Scene and Blend File download. Note: I applied new materials to the meshes via the html file. I am not sure if this is an issue. The scene does not load in Firefox 50.1.0 The scene works in Google Chrome, Microsoft Edge and Opera.
-
Hi Everybody! I'm not sure if this is a bug or if there is an issue with my materials, but for some reason meshes with multiple materials aren't rendering properly on iOS. For a split second while the mesh is loading, I can see each material take up the correct set of vertices, but then once its done loading, the last material to load takes over the entire mesh. We are using the latest version of babylon.js Any input would be greatly appreciated.
-
Hello everyone, First of all, thanks for all the amazing contents I managed to find here. It really helped me to understand better how BJS works. Background : I am much more a back-end developer, so excuse me if I lack (too much) knowledge about front-end or 3D modeling. Anyway, I learned some Unity and Unreal by myself and built several Unity applications (no games, regular mobile apps, Augmented Reality apps, ...) so I understand a bit how 3D modeling works (textures, UV maps, normal maps, materials, baking, ...). I am thinking about using BJS, but can't set a tech stack until I am sure that it can answer all my needs. That's why I started building some POCs with BJS. The need : To make it quick : I have an application where I want to integrate a frame with a single 3D object (with BJS). I want to interact with this object and change its look just by clicking on a button in the interface (in less than a second would be great). The objects will be multiparts : for example, the obj of a table would include a feet part and a top part. I want to be able to change the top part and the feet part textures/mats separately. I need the result to be in very high quality and to display fast enough (but since I don't want to build a full world, just a single object, I hope this will be OK). What I understood / What I tried : Thanks to some tutorials/samples, I loaded some models from .babylon or .obj files , in the Sandbox or in a local application. I managed to change mats for these meshes using some code of the "rabbit sample" (glass, metal, ... materials). If I'm not wrong, I'll be able to change textures (with a .jpg or .tga file), the behaviour of light (to create metalic, glass, wood or plastic behaviour), the color, ... with something like : mesh.material.diffuseTexture = new BABYLON.Texture(texture, scene); or var mat = new BABYLON.PBRMaterial("clay", scene); mat.cameraExposure = exposure; mat.cameraContrast = contrast; mat.microSurface = 0.06; mat.reflectivityColor = new BABYLON.Color3(0.5, 0.9, 0.9); mat.albedoColor = new BABYLON.Color3(0.5, 0.5, 1); Plus, if I understood well, I can "isolate" my mesh after it's instanciation with a "onSuccess" event, to be able to access it easily after loading the page (or loading a new item). I am planning to create a scene from scratch and add just a simple background and lights to make the object looks great by itself :). Here is what I didn't understood (or not sure about that) : Q1 : what's the good way to load an object and to identify every sub-part of it ? For example, if my (lovely and friendly) graphical artists build and export an .obj "object1" with 2 sub-parts called "obPart1" and "obPart2" with Maya or 3DSMax, what's the best way to interact with obPart1 and obPart2 after loading object1 in BJS ? Q2: Am I forced to play with many maps for one object, or can I obtain sufficient result using multi-part object and a BABYLON.PBRMaterial for each sub-part ? Q3 : What's the main difference between using a .obj or a .babylon ? I would clearly prefer to directly use .obj files (to stay closer to standards and avoid to use plugins) but would I miss something that I couldn't replace in my BJS scene (like a light...) ? Q4 : If I am smart enough (crossing fingers), I should be able to display a glossy wood and a not glossy one with only one .jpg texture, just by having 2 different BABYLON.PBRMaterial, right ? Am I wrong if I am thinking about doing the same thing to have a blue wood and a pink one (erm ... why not ?) ? Q5 : Last but not least : if I am smart enough (crossing fingers to death), I could build a back-office where I can upload .obj or .babylon, identify sub-parts of it, chose wich texture/mat can be applied on which sub-part, and use all of this in the "display" part of the application. I may be a dreamer (but i'm not the only one ...) but if I didn't miss some main specifications, I believe that this could be achieved with a clever architecture. Am I mad to think about that ? I (really) searched in this forum (and some others) and in the documentation, sorry if I missed the answers (or didn't understood the words I read). I am much more used to back-end technologies so I may have not been as efficient as I use to be, but I'll learn fast ;). Feel free to tell me if I understood some parts wrong. Thanks a lot for your experience and answers :).
-
Hi all, I'm new and I already have some questions. First of all I must tell you that I am a 3d graphics operator and usually I always look for matches between 3ds Max and new software or 3D systems. Digita il testo o l'indirizzo di un sito web oppure traduci un documento. Annulla Visualizzazione delle traduzioni per Detto questo, mi sto approcciando a Babylon Js da pochi giorni, quindi cerco di usare 3ds max il più possibile, prima di mettere mano ai codici di programmazione o simili. Ho scaricato e installato l Traduci invece Detto questo, mi sto approcciando a Babylonjs da pochi giorni, quindi cerco di usare 3ds max il più possibile, prima di mettere mano ai codici di programmazione o simili. Ho scaricato e installato l That said, I'm approaching to Babylonjs from a few days, so I try to use 3ds max as possible, before you play around with the programming codes or something like that. I downloaded and installed the exporter for 3ds max 2016 to 2017, then I started working and good renderista'm trying to understand what are: 1 - The materials of 3ds max corresponding to the Babylonjs materials 2 - Where should I put the HDRI images to have the correct illuminzaione 3 - How to fix the position of the Arc Rotate Camera, so as to be able to orbit around the object, without being able to zoom in and out Thanks in advance.
-
Hi Guys, I am working with a custom model and I am attaching child meshes to it. I am trying to rectify a problem that I am having when I add colour to the model. I lose the 3d shape, the child meshes look flat and you cant differentiate between them When I remove the colour in the material, in greyscale it looks fine. see attached pictures for comparison. Also Multi Material doesnt seem to be working as expected. The next issue I am having is the orientation of the "base modal". When I init the script its rendering the base in an angle vs being upright, as per picture. If I apply a transformation to it, it does something funky to the rest of the world co-ord mapping and everything else breaks afterwards. I am new to this and in 3d programming in general. Any insights to help me solve these 2 issues would be helpful. My code can be found on http://www.babylonjs-playground.com/#15O3MB#1
-
Hi guys, does anybody here know whether Babylon.js supports material instancing or not? Thanks
-
I was wondering what other people do for there 3ds Max/Blender -> babylon.js workflows? I find that If I create a scene with multiple objects, materials & animation within 3ds max and then export to Babylon.js I will usually need to do some more work on the Babylon.js side (adjust and fine-tune material parameters, add advanced material types, minor repositioning to perfect things in the browser environment, additional animation easing and so on..). I will then re-export my using the SceneSerializer method so that it is saved using the standard format. The annoyance for me is then when I decide to swap out an object or make a change to my animation on the 3ds Max side - I then have to re-work all of the post-export modifications or dive into a huge scene.js file full of mesh vertices and animation keys to merge the two versions. Could there be a way to export from 3ds Max that will produce a folder with a main Scene.js file with references to a separate JS file for each material and each object. This would mean that the materials could be edited without hunting through a file of several megabytes, objects could be changed or added without re-exporting an entire scene and scene files which are a lot more manageable.
-
Hey everyone, I'm encountering a problem with the blender exporter. It's crashing 100% of the time while exporting (although almost always finishes exporting the whole scene with its materials). I'm using the latest 4.4.1 blender exporter and 2.76b blender on a mac. I'm attaching my export log if it's any help. Is there a way to get the blender log, if it would be more helpful? Really looking forward to the help as this problem has been driving me crazy (always having to reopen the blender file when I want to continue working after the export). Exporter version: 4.4.1, Blender version: 2.76 (sub 0) ========= Conversion from Blender to Babylon.js ========= Scene settings used: selected layers only: false flat shading entire scene: false inline textures: false texture directory: /**REMOVED**/ Python World class constructor completed processing begun of mesh: Glass_Dark processing begun of baked material: Glass_Dark Cycles baking texture, type: DIFFUSE_COLOR, mapped using: BakingUV num positions : 51 num normals : 51 num uvs : 102 num uvs2 : 0 num colors : 0 num indices : 60 processing begun of mesh: Lamp_Mesh_4 processing begun of baked material: Lamp_Mesh_4 Cycles baking texture, type: DIFFUSE_COLOR, mapped using: BakingUV num positions : 371 num normals : 371 num uvs : 742 num uvs2 : 0 num colors : 0 num indices : 684 processing begun of mesh: Door_Room2 processing begun of Standard material: Door_Room2_Material num positions : 20 num normals : 20 num uvs : 0 num uvs2 : 0 num colors : 0 num indices : 108 processing begun of mesh: Roof processing begun of baked material: Roof Cycles baking texture, type: DIFFUSE_COLOR, mapped using: UVMap num positions : 4 num normals : 4 num uvs : 8 num uvs2 : 0 num colors : 0 num indices : 6 processing begun of camera (FreeCamera): Camera processing begun of mesh: Walls processing begun of baked material: Walls Cycles baking texture, type: DIFFUSE_COLOR, mapped using: UVMap num positions : 952 num normals : 952 num uvs : 1904 num uvs2 : 0 num colors : 0 num indices : 1644 processing begun of mesh: Floor processing begun of baked material: Floor Cycles baking texture, type: DIFFUSE_COLOR, mapped using: UVMap num positions : 4 num normals : 4 num uvs : 8 num uvs2 : 0 num colors : 0 num indices : 6 processing begun of mesh: Door_Bathroom processing begun of baked material: Door_Bathroom Cycles baking texture, type: DIFFUSE_COLOR, mapped using: UVMap num positions : 79 num normals : 79 num uvs : 158 num uvs2 : 0 num colors : 0 num indices : 102 processing begun of mesh: Door_Outside processing begun of Standard material: Door_Outside_Material num positions : 18 num normals : 18 num uvs : 0 num uvs2 : 0 num colors : 0 num indices : 102 processing begun of mesh: Window_Big processing begun of baked material: Window_Big Cycles baking texture, type: DIFFUSE_COLOR, mapped using: UVMap num positions : 73 num normals : 73 num uvs : 146 num uvs2 : 0 num colors : 0 num indices : 96 processing begun of mesh: Window_Small processing begun of baked material: Window_Small Cycles baking texture, type: DIFFUSE_COLOR, mapped using: UVMap num positions : 71 num normals : 71 num uvs : 142 num uvs2 : 0 num colors : 0 num indices : 96 processing begun of mesh: Door_Room1 processing begun of Standard material: Door_Room1_Material num positions : 18 num normals : 18 num uvs : 0 num uvs2 : 0 num colors : 0 num indices : 102 processing begun of mesh: Window_Medium processing begun of Standard material: Window_Medium_Material num positions : 16 num normals : 16 num uvs : 0 num uvs2 : 0 num colors : 0 num indices : 96 processing begun of mesh: Small_Window processing begun of baked material: Small_Window Cycles baking texture, type: DIFFUSE_COLOR, mapped using: BakingUV num positions : 147 num normals : 147 num uvs : 294 num uvs2 : 0 num colors : 0 num indices : 204 processing begun of mesh: Big_Window processing begun of baked material: Big_Window Cycles baking texture, type: DIFFUSE_COLOR, mapped using: BakingUV num positions : 355 num normals : 355 num uvs : 710 num uvs2 : 0 num colors : 0 num indices : 480 processing begun of mesh: Medium_Window processing begun of baked material: Medium_Window Cycles baking texture, type: DIFFUSE_COLOR, mapped using: BakingUV num positions : 149 num normals : 149 num uvs : 298 num uvs2 : 0 num colors : 0 num indices : 204 processing begun of mesh: Lamp_Mesh_3 processing begun of baked material: Lamp_Mesh_3 Cycles baking texture, type: DIFFUSE_COLOR, mapped using: UVMap num positions : 581 num normals : 581 num uvs : 1162 num uvs2 : 0 num colors : 0 num indices : 684 processing begun of mesh: Glass_Window processing begun of baked material: Glass_Window Cycles baking texture, type: DIFFUSE_COLOR, mapped using: BakingUV num positions : 124 num normals : 124 num uvs : 248 num uvs2 : 0 num colors : 0 num indices : 144 WARNING: The following lamp not visible in scene thus ignored: Spot_Hall WARNING: The following lamp not visible in scene thus ignored: Area WARNING: The following lamp not visible in scene thus ignored: Lamp WARNING: The following lamp not visible in scene thus ignored: Spot_Bathroom ========= Writing of scene file started ========= ========= Writing of scene file completed ========= ========= end of processing ========= elapsed time: 0 min, 55.0042 secs
-
Hello guys, I have been playing with materials quite a lot lately. After spending quite some time pressing the "run" button in the babylon playground, I have decided I want a simple tool that will show me the changes I am making in real-time. And here it is - http://my-cac.com/materialEditor/ This is just a very first 0.001 alpha version. UI can be improved! But, I think people can benefit from such a tool. I am planning on uploading it to my github soon after I clean it up a bit. I hope you guys find it as helpful as I do. If you have any questions, let me know. It is pretty intuitive. Future plans: Image upload to a serverMaterial generation for a babylon sceneUI ImprovementsChange to babylon 2.0 (when it is out of alpha)Upload your own objectChange Light propertiesIf you have any suggestions, with pleasure! Have a good one!
-
Hello! I just registered but I have been a silent user of babylon.js for a little more than a year now, reading everything there is about this awesome engine and soaking up knowledge like a sponge. But there's one detail that I can't find any info about, maybe I just missed it... but it's been driving me crazy the last couple of days! I think I have visited every single page on the interwebs mentioning anything about materials and textures in babylon.js by now. Is it possible to apply two, or more, texture images on the same faces of a mesh? Let me give you an example: I have a large piece of cloth and the base diffuseColor is made up of a small cotton texture that is tiled into oblivion. On top of this I need to add stitches at specific places, using a larger texture image as an alpha and a regular diffuseColor for the color of the stitches. The point is to be able to change the color of the stitches just by changing the diffuseColor. Right now I can accomplish this by adding another mesh slightly above the cloth and texturing the stitches to that, but that makes the babylon file bigger with all the extra meshes and faces, on top of managing the model in Blender much more complicated. Just to give you an idea of what I want to do I'm attaching a screenshot of a test i made using the extra mesh.
-
In my morphing using SIMD testing, i finally switched to using the profiler. My measurements of deformation CPU are just not reliable. The Firefox Nightly profiler is kind of messed up though. I dropped back to my non-SIMD calls, and ran on FireFox 37 to get a base line. Found that updating positions & normals was only 0.78% of total CPU used, anyway. The split between evaluationMeshes & render was 32.85% & 55.76%, respectively. What surprised me is 9.54% of the total cost was in StandardMaterial.isReady(). Going to Babylon.Material, I see there is a way to avoid paying this tax foreverrrrrrrrrrrrrrrrrrrr. public checkReadyOnEveryCall = true;public checkReadyOnlyOnce = false;Unfortunately even if I switched all my materials to checkReadyOnlyOnce = true;, in the Babylon.StandardMaterial override of isReady(), where checkReadyOnlyOnce is taken into account is commented out . DK, I realize I been a pain in the ass ever since finding out I could do profiling, but this just does not scale. Amdahl's Law dictates that speed up is limited greatly by the amount of time spend doing things serially, i.e. javascript. Would not mind, if it went away after a few frames. Can that line can be un-commented? With either grabbing textures that are already stored locally in the app, or in-lining textures right into source code for the web, this should be largely avoidable.
-
I've been digging through Babylon.js lately and for the project I'm working on I'd like to be able to write a custom GLSL shader for my particle systems (for things like lit particles, soft particles, etc). I can't tell if this is something that's possible or not, I haven't been able to find any documentation on it, other than being able to change the blend mode...
- 1 reply
-
- particleSystem
- particles
-
(and 2 more)
Tagged with:
-
if i want to change the material of my player in the update function.. it does not set the new material.. it also doesn't keep the existing one.. it just resets the material setting to none.. is there something i have to do after changing the material to have it applied? thx !!
-
#1 are tilemaplocationcallbacks working in 1.2 ? # is it (will it be) possible to assign materials and collisioncallbacks to layers so i can put all my "ice" tiles in one layer (friction=0) and all my "lava" tiles in another (player.kill()) ? (or what would be the appropriate way to accomplish those things?) thank you all in advance !!