• Content Count

  • Joined

  • Last visited

  1. @NasimiAsl very nice. about real inner reflection and ray refraction, can we do that in live render but limiting the bouncing effect for 2 or 1 and see how it looks like? that will be the very close to reality. and we have to take in consideration the index of refraction of the diamond material, 2.417 The reason why I wanted that is that modifying the parameters of the diamond(depth, crown angle, pavilion angle), will impact the sparkle. But with fake approach, all the diamonds will look the same no matter if you stretch that diamond like a pencil or flatten like a pie. Not in reality. So that is the whole point if you can do that. But not sure how will be possible in live render... thanks again @NasimiAsl
  2. this is impressive. those sparkles are amazing @Sebavan
  3. I see that you are using these masks(http://i.imgur.com/QxxS3VP.jpg) to create some effect. That is fake and I think it it not looking realistic. The best approach will be to figure out how to bounce light from one face to another.
  4. just look at this real beauty: https://www.jamesallen.com/loose-diamonds/round-cut/1.02-carat-g-color-vs2-clarity-ideal-cut-sku-2359303 just give it a spin
  5. @NasimiAsl thank you, this looks the best so far. how do we add the index of refraction? In the attached pic I used the real IOR, but in some tutorials, some people go like R:2.4, G:2.5, B:2.6 just to accentuate the effect of scintillation. I know you cannot simulate 100% realistic diamond due to the RGB monitors limitation. For light bouncing effect inside the diamond(that will give the fire/scintillation), will it be needed a loop for all the facets and compute light as it refracts? thanks a lot for your work
  6. now I just have to implement this: http://www.babylonjs-playground.com/#FT2RY#104 made by @NasimiAsl
  7. thanks all. I finally just got the diamond's parameters and plug them manually in babylon.js http://www.babylonjs-playground.com/#1H7L5C#39 But the glass shader it is not behaving like a glass, but more like a mirror. While this looks ok on a sphere and create the feeling of a glass sphere, is does not look ok here. There is no transparency so you can see inside. Alpha is not the answer here. Also there is no way as far as I know to let the light in and bounce inside. Is this possible with babylon.js? I know in blender I can do it and the diamond will look very realistic. It is called glass bsdf shader. Is there any similar work done in babylon.js?
  8. @grire974 I think I am having the same issue. I have a code in python: z_axis = (0.0, 0.0, -1.0) segments = 32 table_radius = 0.6 height_flat = 0.35 for index in range(segments): quat = Quaternion(z_axis, (index / segments) * PI_2) result = quat * Vector((table_radius, 0.0, height_flat)) converted: var segments = 32; var table_radius = 0.6; var height_flat = 0.35; for(var index = 0;index < segments;index++){ var quat = new BABYLON.Quaternion(0.0,0.0,-1.0,(index / segments) * PI_2); var a = new BABYLON.Vector3(table_radius, 0.0, height_flat); var result = quat*a; //does not work } I also tried the code from your suggested math page, but I get negative numbers under sqrt and even with abs still nothing useful. Can you share your piece of code with the conversion? I am stuck at this point...thanks
  9. thanks all. @jerome that is not parametric in the truly sense. You can scale it or change some colors of the faces. But you are not altering in any way the actual shape. @Deltakosh it worked but not sure how well. This is what I did: var PI_2 = Math.PI * 2.0; var segments = 32; var table_radius = 0.6; var crown_height = 0.35; for(var index = 0;index < segments;index++){ var quat = new BABYLON.Quaternion(0.0,0.0,-1.0,(index / segments) * PI_2); var a = new BABYLON.Vector3(table_radius, 0.0, height_flat); var m = new BABYLON.Matrix(); quat.toRotationMatrix(m); var result = BABYLON.Vector3.TransformCoordinates(a, m); } so after doing all the conversion from python to Babylon, I get some verts and faces. Not sure how correctly. More exactly: for vertices, I get an array 66 X 3; for faces, I get an array 3 X 32 X 3; see attached image. At this point I am not sure how to link them all in one mesh...CreatePlane? CreateLines?
  10. wow, did not expect so many useful replays. Thanks guys. So, let me reiterate what I would like to accomplish. The diamond should load in a browser and you plug in your parameters. Based on those parameters, the object is rendered as you go. As far as I know, blender is a stand alone software, not providing any web interface. Modifying those parameters in Blender is not what I wanted. (for each modification, you have to export from blender, import in babylon). I tried to rewrite the code from python in Babylon, but I am stuck at the matrix transformation/rotation step...maybe that should be in another thread? Let me summarize it here: Python: PI_2 = pi * 2.0 z_axis = (0.0, 0.0, -1.0) segments = 32 table_radius = 0.6 crown_height = 0.35 for index in range(segments ): #Quaternion(axis, angle) quat = Quaternion(z_axis, (index / segments ) * PI_2) vec = quat * Vector((table_radius, 0.0, crown_height)) as you can see, in Python you multiply those. But this doesn't work in Babylon. I read more here how_rotations_and_translations_work, here quaternion and here Applying_Rotations. I tried this: var PI_2 = Math.PI * 2.0; var segments = 32; var table_radius = 0.6; var crown_height = 0.35; for(var index = 0;index < segments ;index++){ var a = new BABYLON.Vector3(table_radius, 0.0, crown_height); var quat = new BABYLON.Quaternion(0.0,0.0,-1.0,(index / segments ) * PI_2); //TransformCoordinates(vector3, matrix) var result = BABYLON.Vector3.TransformCoordinates(a, quat);} but get Cannot read property '0' of undefined at the TransformCoordinates line.
  11. thanks georage. This script uses polyhedra.js as import, where all the shapes are hard coded parameters. For example: OctagonalPrism : { "name":"Octagonal Prism", "category":["Prism"], "vertex":[[0,0,1.070722],[0.7148135,0,0.7971752],[-0.104682,0.7071068,0.7971752],[-0.6841528,-0.2071068,0.7971752],[0.6101315,0.7071068,0.5236279],[1.04156,-0.2071068,0.1367736],[-0.7888348,0.5,0.5236279],[-0.9368776,-0.5,0.1367736],[0.9368776,0.5,-0.1367736],[0.7888348,-0.5,-0.5236279],[-1.04156,0.2071068,-0.1367736],[-0.6101315,-0.7071068,-0.5236279],[0.6841528,0.2071068,-0.7971752],[0.104682,-0.7071068,-0.7971752],[-0.7148135,0,-0.7971752],[0,0,-1.070722]], "edge":[[0,1],[1,4],[4,2],[2,0],[2,6],[6,3],[3,0],[1,5],[5,8],[8,4],[6,10],[10,7],[7,3],[5,9],[9,12],[12,8],[10,14],[14,11],[11,7],[9,13],[13,15],[15,12],[14,15],[13,11]], "face":[[0,1,4,2],[0,2,6,3],[1,5,8,4],[3,6,10,7],[5,9,12,8],[7,10,14,11],[9,13,15,12],[11,14,15,13],[0,3,7,11,13,9,5,1],[2,4,8,12,15,14,10,6]]}, etc. You cannot change the size of that shape by modifying the crown angle or pavilion angle or table size, etc
  12. Hello, Any of you did a procedural diamond creation? Is that possible in Babylon? I found a python script but in blender. So just curious if there is anything like this for Babylon. I am frustrated for so much search with no answers. Thanks, add_mesh_gemstones.py