Search the Community
Showing results for tags 'backface'.
-
Hi, How I can color the mesh backface only, the mesh maybe has a texture or not. Thanks in advance.
-
Is there any reason why the back ( face ) of my leaf texture is shining with specular when I turned off specular for the leaf texture? I circled in the color black, the leaf that is shining with specular white that should be off. As you can see, the front ( face ) of the leaves are fine. Here is the Source Code : meshTask.onSuccess = function ( task ) { task.loadedMeshes [ 0 ].position = BABYLON.Vector3.Zero ( ); // Decrease specular or what is called shine in the thread // Mat 94 - Bark Texture scene.getMaterialByName ( "Mat94" ).specularColor = BABYLON.Color3.Black ( ); // Mat 910 - Leaf Texture // Disable culling or what is called seeing half the leaves in the thread scene.getMaterialByName ( "Mat910" ).backFaceCulling = false; } Thanks!
-
hey guys, new to Babylon and i'm trying to figure out is there an easy function to disable rendering of any vertices not visible to the camera as well as to do flat shading? e.g. this scene in blender becomes very bizzare, i tried to do it with basic materials and just set it to shadeless but it renders it with shadow and for some reason it subdivide smooths all the polygons. I'm not sure why. Then when I disabled the fills and enabled rendering outlines it renders the backfaced ones. I tried to disable backface culling but it made no effect. so in short is there a way to render items as flat colours ignoring light data(or using it as a simple second colour e.g. toon shading) and is there a way to only render only what's visible to the camera ignoring back sides? Thanks so much for any useful info in advance <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>test1</title> <style media="screen"> html, body { overflow: hidden; width: 100%; height: 100%; margin: 0; padding: 0; } #renderCanvas { width: 100%; height: 100%; touch-action: none; } </style> <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script> <script src="js/babylon.js"></script> <script src="https://code.jquery.com/pep/0.4.3/pep.js"></script> <script src="js/cannon.js"></script> </head> <body> <canvas id="renderCanvas"></canvas> <script type="text/javascript"> if (BABYLON.Engine.isSupported()) { var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); //prevents the error when looking for manifest file engine.enableOfflineSupport = false; BABYLON.SceneLoader.Load("", "testScene.babylon", engine, function (newScene) { // Wait for textures and shaders to be ready newScene.executeWhenReady(function () { // Attach camera to canvas inputs newScene.activeCamera.attachControl(canvas); console.log(newScene.meshes) var sceneObjects = []; var sceneMaterial = new BABYLON.StandardMaterial("trans", newScene); sceneMaterial.alpha = 0.3; sceneMaterial.backFaceCulling = true; for(var i=0;i<newScene.meshes.length;i++){ sceneObjects.push(newScene.meshes[i]); //newScene.meshes[i].convertToFlatShadedMesh() newScene.meshes[i].material = sceneMaterial; newScene.meshes[i].enableEdgesRendering(.9999); newScene.meshes[i].edgesWidth = 4.0; newScene.meshes[i].edgesColor = new BABYLON.Color4(0, 0, 1, 1); } engine.runRenderLoop(function() { newScene.render(); }); }); }, function (progress) { }); window.addEventListener("resize", function () { engine.resize(); }); } </script> </body> </html> testScene.babylon
-
Hi, regarding a sphere in a sphere scenario, I would like to ask .. 1) Is intersection possible for an inner intersection event of the spheres? - If I take BABYLON.ActionManager.OnIntersectionExitTrigger this state will be reached if the small inner sphere is more than the half out of the outer sphere - If I take BABYLON.ActionManager.OnIntersectionEnterTrigger this state will be reached direct the scene is started .. and I need exact the intersection if a small inner sphere touches the inner wall of the outer sphere How to do? 2) How can a given sphere segment have materials on both sides of the mesh? At the moment I can give some material & color to the segment but if the segments turns around it is not to see anymore. My first thought was going in direction of backface culling or the DOUBLESIDE option var sphere = BABYLON.MeshBuilder.CreateSphere("sphere", {segments: 25, diameter: 5, arc: 1.0, slice: 0.2}, scene, false, BABYLON.Mesh.DOUBLESIDE); but it not seems to help. How to bring on some color to the inner side of the mesh, without having an inverse second mesh? Thanks and with best regards, Stefan
- 7 replies
-
- mesh intersection
- backface
-
(and 1 more)
Tagged with:
-
I'm trying to get lighting to work on the backface of a mesh, but it doesn't work. After reading through the lighting tutorial, it seems like it's not possible due to the normals. I was wondering if there was any trick I could use in order to get light to reflect off the opposite sides of a mesh.