抗锯齿在Babylon js中不起作用

时间:2017-03-28 20:59:28

标签: babylonjs

我正在尝试将抗锯齿应用到我的场景中。这是我使用的代码:

var canvas;
var engine;

window.addEventListener('DOMContentLoaded', function(){
    canvas = document.getElementById("renderCanvas");
    engine = new BABYLON.Engine(canvas, true);

    var createScene = function () {
        var scene = new BABYLON.Scene(engine);
        scene.clearColor = new BABYLON.Color3(0, 1, 0);
        var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 5, -10), scene);
        camera.attachControl(canvas, false);
        var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0), scene);
        light.intensity = 1.88;

        var box = BABYLON.SceneLoader.ImportMesh("box", "", "box.babylon", scene, function (newMeshes, particleSystems) {
            newMeshes.position = new BABYLON.Vector3(0,0,0);

        });
        var postProcess = new BABYLON.FxaaPostProcess("fxaa", 1.0, null, null, engine, true);

        return scene;

    };
    var scene = createScene();
    engine.runRenderLoop(function () {
        scene.render();
    });
});

物体仍然是锯齿状的。知道如何让它更顺畅吗?

enter image description here

完整代码:

float getArea(int choice, int final, int initial, int rectangle)
{
  double i = initial;
  float area;
  while(i < final)
  {
    area += final;
  }
  if (choice == 1)
  {
    //left sum
  }
  else if (choice == 2)
  {
    //mid point sum
  }
  else 
  {
    //right sum
  }
  return (area);
}

1 个答案:

答案 0 :(得分:0)

我们在3.0中重写了FXAA。你试过新版本了吗?可在此处获取:https://github.com/BabylonJS/Babylon.js/tree/master/dist/preview%20release