Search the Community
Showing results for tags 'normal'.
-
Hi, I'm a newbie on BJS. Recently, I export the TOB js file from blender. When I use MeshFactory Class to import the mesh on BJS , Everything is alright. (pic1) When I start to apply the vertexDeform function in QueuedInterpolation.1.1.js , the morphing works well in positions However the texture turns out discontinuous effect. (pic2, triangle discontinuous dark shadow) It seems like something incorrect. Maybe normals or shadows or something else? After tracing the code in QI, I found that the compute normals is involved in vertexDeform related function So I try to cut down the problematic mesh part and remove the shape group in blender and export again, just wanna try if ComputeNormals could work well or not. But the new TOB js shows the same outcome. (Procedural is simple : (1) instance the mesh (2) Re ComputeNormals in BJS ) (a tiny clue : the fail area is just around the boundary of two different materials, don't know whether it's related) Call helps for the experts in this forum 1. What causes this issue? 2. Are there any recommended solutions to deal with this problem? (I'm afraid the vertexDeform/Morphing of Blender output mesh should always do the ComputeNormals function) The playground is as following ( Mesh.js without shape group. Just want to make sure the ComputeNormals works well or not) https://nedbenson.github.io/BJS_game/index.html
-
Hi all, This may be an easy question but I cannot seem to solve it myself after several attempts. For my Model Train Simulator in BabylonJS I'm creating a helix/spiral track, allowing trains on a lower section to quickly gain altitude within a short area (e.g. climbing a mountain). This is often used in 'hidden' sections on model train displays to have a train pass a valley track and next pass a mountain bridge which is position much higher (Y position) in the scene. When I construct the points of a helix/spiral using the formula from the docs https://doc.babylonjs.com/babylon101/parametric_shapes https://www.babylonjs-playground.com/#165IV6#61 And then use Path3D on these points to get the normals see the docs https://doc.babylonjs.com/how_to/how_to_use_path3d https://www.babylonjs-playground.com/#2DLXYB#1 https://www.babylonjs-playground.com/#8ICWNU Then I get an ever increasing cant/superelevation of my track, see the blue arrows in the picture which indicate the 'up' vectors. The result is that the track at the top has a cant. I use the Tangent, Normal and Binormal from the Path3D of the line/points to set the track rail and bed geometry, and position the train always perpendicular to the track (that is: up). But I want to have the Up vector always Vector3.Up(), or at least that there is no cant/superelevation and I can continue placing 'flat' track with it's normal Vector3.Up() on the top. The big blue arrow indicates Vector3.Up(). Current 'vector up' results from Path3D in my game: Blue = up vector (from Path3D). Large blue with _ = helix direction (Y axis) Yellow line through track = Line through the spiral center points (radius * cos t, radius * sin t, ascentfactor * t) Desired 'vector up' on the spiral/helix: (image found at http://www.easyhelix.com) Hope someone knows how to 'alter' the results from Path3D so I get the helix point orientation but without the cant/superelevation. So that I can 'lay the track' properly without trains 'falling off the track' because of cant/superelevation. Bonus questions: - the yellow marked area in the skybox marks another bug that is caused with a reflection texture intersection with the skybox. the default background color comes through on the waves. - the red box marks a mesh (air balloon) with a physics impostor that is already moving, but I want the physics computation to be paused until the user presses some 'start to play'-button, instead of physics computation right from the moment the scene is loading Happy coding, Q
-
Hi everybody! I get the following errors (relevant excerpt) in the console: BJS - [13:19:53]: Unable to compile effect:... ... BJS - [13:19:53]: Error: ERROR: 0:1001: 'vBumpInfos' : undeclared identifier ERROR: 0:1001: 'y' : field selection requires structure or vector on left hand side meanwhile trying to add a normal map (by means of bump texture) to any PBR Material. My material definition is: var myMaterial=new BABYLON.PBRMaterial("plastic",Scene); myMaterial.reflectionTexture=txtHDR; myMaterial.bumpTexture=new BABYLON.Texture("assets/textures/11_onetile.png",Scene); myMaterial.cameraExposure=exposure; myMaterial.cameraContrast=contrast; myMaterial.microSurface=0.96; myMaterial.albedoColor=BABYLON.Color3.White(); myMaterial.albedoTexture=new BABYLON.Texture("assets/textures/QIS_Exterior_BaseColor.png",Scene); myMaterial.reflectivityColor=new BABYLON.Color3(0.07,0.07,0.07); myMaterial.metallicTexture=new BABYLON.Texture("assets/textures/QIS_Exterior_Metallic_PBR.png",Scene); myMaterial.useRoughnessFromMetallicTextureAlpha=false; myMaterial.useRoughnessFromMetallicTextureGreen=true; If I remove the offending line: myMaterial.bumpTexture=new BABYLON.Texture("assets/textures/11_onetile.png",Scene); the material works flawless (but of course without normal map). My question: Are BJS PBR Materials compatible with Normal Maps?
-
Hello everyone! First post! I have been playing around with bablyon (you can guess, I am not a pro graphics programmer) and the first issue I bumped into is: is there a simple way to get the normal of a surface? If not, I was thinking on using the following to calculate the normal of a plane. P---Q| |R---TTake (P-T) × (Q-R). Basically have the cross product of the plane's diagonals. Is it at all a good solution? Is there a better or simpler way to do this? Thanks