• Content count

  • Joined

  • Last visited

About Rolento

  • Rank
    Advanced Member
  • Birthday
  1. Hi All I have been exploring multimaterial texturing today and its great. However... I have encountered an issue that I can see no obvious solution to. What I am wanting to do is have "smooth" blended transitions between each of the multi-textures that are applied to the shape. Provided below is the 3D scene I have created which has the multimaterial textures applied: As you can see there are two textures that are being alternated across the face of the 3D model - each transition is a "hard" transition whereby there is no blending. Question: What I am wanting is for each texture transition to be blended - is there an easy way to do that? One solution "hack" is to create a 3rd texture that is a blended rendition of the two textures, then I could insert this blended texture between each of the transitions. Hopefully there is a simple solution that prevents me from having to go down this route! Thanks in advance...
  2. Hi @gryff Sorry for the delayed reply, I have been off the scene recently (too much work - grr). Thanks for your pointers/advice, the approaches you have provided will help my get what I need done. Much appreciated!
  3. Hi @gryff Thanks for the reference sites and advice. I will have a play and see what works best for me. By the sounds of it the Blender decimator is not too hot, and it seems I would be better off using another solution like MeshLab. Anyway, I will give both options a try. Thanks.
  4. Hi @8Observer8 The example you provided is useful, it neatly shows how a simple scene can be put together using an imported model and texture file. I guess one of the challenges I have is that the models I am importing will be complex (i.e. have many subset meshes which require different materials to be assigned). So, I need to experiment with code/processes that help me achieve that. I think with the help I have received thus far I should be in good shape. Fingers crossed...
  5. Hi @gryff Thanks for the clarification regarding how materials are assigned to a shape - the process is now a lot clearer in my mind. Regarding decimation of models, I will take a look at MeshLab because my challenge is that I am being provided with high fidelity models that frequently exceed the 64k limit. So I need to decimate them so I can use them as desired. So thanks again for pointing me in the right direction (btw - I did not even know Blender had a decimation tool so I will play with that too).
  6. DOH! Yep that fixed it! Deltakosh you are.... a super star! Thanks for this enhancement (im sure others will love this too).
  7. Hi Deltakosh Awesome!!!!! But... I have a problem (I think) - when I click on the PG link for some reason the rendered scene does not seem to have the displacement map applied correctly (i.e. it looks stretched as per the original PG I posted). Would I be correct in assuming that the PG is not referencing the latest source code as contained within the GIT repo?
  8. Hi David Thank you for the information, I will check out the references and try and knock something together. This is exactly the kind of guidance I was looking for, so thanks again!
  9. Hi All I am trying to import a 3D model (created in Blender or 3D Studio Max) and I am also wanting to have all materials imported and applied to the 3D model too. So in essence I want to do the following: 1) design model in 3D Studio Max (create mesh and apply all textures to subset meshes at design time) 2) export 3D Studio Max model and convert to Babylon model (both mesh and textures materials included in exported file) 3) create a simple playground script that loads the exported model (and meshes) from step 2, then render them in a 3D scene I have searched the forums and I cant find anything obvious that talks to the above design/development process. If someone can point me in the direction of documentation that enables me to achieve 1, 2, 3 above I would very much appreciate it. FYI - my main questions are: 1) when creating the 3D model in 3DS or Blender is there anything specific I have to do to ensure the "materials" are correctly exported such that BabylonJS can read the model and materials and render them? 2) if the exported file (from 1) has to be converted into a specific BabylonJS format is there a tutorial? 3) what BabylonJS code do I need to use to; import the 3D model, import the materials, apply the materials to the model? 4) as I understand a 3D model imported cannot be more than 64k vertices due to WebGL constraints, in this situation is there a decimation tool that is recommended to simplify the complexity (vertex count) of the model? Ideally if someone has a PG script that explains how to import a 3D model and have the materials applied that would be great. * I suspect the above has been documented somewhere, unfortunately I cant find it (so I apologise if thats the case) Thanks in advance
  10. Hi All I am experimenting with displacement mapping and have had a degree of success, but have encountered some issues that the community might be able to help with. Looking at the <shape>.applyDisplacementMap() function it can be seen that it does not support the ability to control how a displacement map texture is applied to the shape. Therefore, if you create a complex 3D model that requires greater control over how the displacement map is applied (i.e. tiled) to it then unfortunately you will encounter problems. I started out by creating a 3D model and then applying texture, bump and displacement map to it. I used the standard applyDisplacementMap() function which produced the following result: The above example illustrates how the displacement map is being stretched across the entire geometry of the shape – which is not what I want. I want the ability to control how the displacement map is tiled across the geometry of the shape – similar to that of uScale & vScale for bumpTexture: e.g. mat2.bumpTexture.uScale = 5; mat2.bumpTexture.vScale = 9; I looked at the underlying functionality of applyDisplacementMapFromBuffer() in an attempt to try and extend it to have greater control over the tiling – but TBH I am not understanding how some of the key lines of code are working. So, I decided to take another approach. Before I explain my solution “I KNOW” this is not a scalable solution and not efficient on many levels. However, it enabled me to apply a tiled displacement map to small geometry shapes – this allowed me to envisage what shapes will look like when displacement maps are applied correctly. NOTE: the main issue with the approach I took is memory allocation – i.e. you will hit out of memory if you try and apply my method to a large 3D model mesh. The interim solution I created is to create a displacement map texture (image) that is sized and tiled appropriately such that I can apply it to the 3D model geometry using the applyDisplacementMapFromBuffer() function. The solution I created is below: Explanation: line 94: obtains the displacement map image (not tiled) line 97: creates a tiled displacement map image (mirroring that of the bumpTexture uScale/vScale) line 99: apply tiled displacement map to 3D mesh line 101~102: free resources (because line 97 is very resource intensive!) The above solution generates nice results as per the PG example – but this is not something that is scalable (the right approach is ofcourse to tile a smaller texture across the geometry of the 3D mesh). I am hoping (praying) that one of the Babylon JS arch master developers can tweak the applyDisplacementMap() function such that the uScale/vScale tiling can be controlled. Perhaps someone can point me in the right direction so I can do this myself? Anyway, I hope this example is of some use to the community.
  11. Hi @jerome Thanks for the research and summary of the problem. The workaround you suggest is quick and easy to implement, perfect.
  12. @aWeirdo The alternative solution you provided works perfectly for me (Internet Explorer & Firefox). However, a friend of mine using a MAC (Safari) discovered that the system crashes (well the 3D objects vanish from the scene) when he moves the mouse on to the canvas region. Unfortunately I dont have a MAC so I cant debug this - does anyone else see this problem?
  13. Hi Wingnut LOL - RolentoCam, well my knowledge of BJS camera's is somewhat limited at the moment, so the RolentoCam could be unpredictable if you were to use it! That said, I have ran into a glitch - basically when I use the code ( in the PG everything works fine. However, when I added the code to one of my local projects (I thought it was working) but its not. Basically for some reason the addEventListerner() functions are not working - e.g. ... canvas = document.getElementById("renderCanvas"); ... canvas.addEventListener('pointerdown', function (e) { ... } In the above example for some reason the pointerdown event is not being caught. I double checked that the canvas was named correctly in the HTML code and it is - i.e. <canvas id="renderCanvas"></canvas> So, im baffled as to why this is not working. Something silly no doubt, if you can think of anything obvious let me know. I will try debugging this more tomorrow.
  14. Hi Wingnut Ha, that makes much more sense now Thanks for explaining... I added your code to my project, and... it works a treat! The zoom seems to work for me too, so im a happy chap. The only thing that does not work is the inertia effect - so I applied an algorithm that I found here ( - sorry, I dont know who created this PG (thanks anyway!). Here is the modified version of your code: This code is a little mangled now, i.e. the main function is manipulating the camera making it tightly coupled, but it does the job. If you know of a better way of applying inertia please let me know. Once again thanks!
  15. Hi Wingnut I love your disclaimer - but whatever help you can provide will always be well received by me, so shoot away! I just finished reading your post and at first glance it looks like it provides what I am looking for (so a big thanks to you once again!). I have not got into the nuts and bolts of what you have done (im going to do that this evening) but fingers crossed there is no black magic and I can manipulate the code as needed. Actually - the one area I would like to learn more about is "camera.camgiz". I have no idea how you know about this, when I search the BabylonJS documentation I find no references to it, so this does feel like were dabbling with the dark arts! If you know of a page that explains camgiz that would be great, otherwise I guess you have to delve into the code? The core BGS team in fairness have done a great job with camera and inputs, but I have to agree with your above request. An intuitive easy to use configurable system enabling events/inputs to be linked to objects of varying types would be spot on! Fingers and toes crossed. If I make any useful tweaks to your code I will repost what I have done hoping it might help others. IF anyone has any other pointers please shout...