Rolento

Members
  • Content count

    52
  • Joined

  • Last visited

About Rolento

  • Rank
    Advanced Member
  • Birthday
  1. 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...
  2. 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).
  3. DOH! Yep that fixed it! Deltakosh you are.... a super star! Thanks for this enhancement (im sure others will love this too).
  4. 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?
  5. 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!
  6. 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
  7. 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: http://www.babylonjs-playground.com/#1PLEVL#1 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: http://www.babylonjs-playground.com/#1PLEVL 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.
  8. Hi @jerome Thanks for the research and summary of the problem. The workaround you suggest is quick and easy to implement, perfect.
  9. @aWeirdo The alternative solution you provided works perfectly for me (Internet Explorer & Firefox). http://www.babylonjs-playground.com/#18KHF6#10 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?
  10. 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 ( http://www.babylonjs-playground.com/#18KHF6#9) 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.
  11. 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 (http://www.babylonjs-playground.com/#10VHTS#12) - sorry, I dont know who created this PG (thanks anyway!). Here is the modified version of your code: http://www.babylonjs-playground.com/#18KHF6#9 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!
  12. 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...
  13. I am using BABYLON.ArcRotateCamera to visualise and move through my 3D scene. However, I am trying to change the way in which the .alpha rotation works. My understanding of ArcRotateCamera: By default the .aplha is used to rotate the camera around the "Y" axis and .beta rotates the camera around "X" axis. What I want ArcRotateCamera to do: I want to change the .alpha rotation such that it rotates around the "Z" axis instead of the default "Y" axis. Does anyone know how I can do ths? FYI - I have experimented with creating custom camera inputs (which is great for manipulating mouse buttons/wheel actions) but I can see no way obvious of achieving the above, hence there is probably another approach that is needed. Thanks...
  14. Hi Wingnut / all I just checked the code and running locally (as per Adam's reply) I see no issue. Do you see issues when running locally using latest version of C2D? Cheers
  15. Hi Guys It might be worth you looking at the original issue I posted in the below PG (as it shows the issue more clearly): http://www.babylonjs-playground.com/#RF9W9#406 * see lines; 88, 104, 105 From what I can see this is a problem linked to adding a CAP to the extrusion as Jerome reported... Fingers crossed it is easy to fix...