vujadin / BabylonHx

Port of Babylon.js 3D engine to Haxe.
http:/paradoxplay.com/babylonhx
Apache License 2.0
187 stars 43 forks source link

No more textures #95

Closed mightymarcus closed 8 years ago

mightymarcus commented 8 years ago

When I assign a texture to a material, the mesh becomes invisible. That happens only on android.

In the last version of BHx applying a bumpmap totally kills the performance.

vujadin commented 8 years ago

What framework you're using BHx with (Lime/Snow/NME)?

vujadin commented 8 years ago

also, bumpmap kills the perf on all targets or only on android. does it help if you freeze material? if possible try to build the same code with snow to see if it works on android and if there's any diff in performance

mightymarcus commented 8 years ago

Thanks for the reply.

I'm using Lime.

Bumpmap kills performance only on android (web and native).

Freezing doesn't help.

I can't even build a BHx Sample with snow, I get a bunch of errors on each target.

Maybe I'm too stupid.

But I made this little game some month ago.

http://worldsnews.org/slm/

There is a bumpmap on the Mesh in the front. This runs smooth at 60FPS on my device (even in the browser). When I use the last version of BHx (the one before the latest), it just needs a single cube with a bumpmap texture on it, and the FPS is dropping down. This means there has to be a bug, because it was much better in the older version then. There I used lime too.

Maybe try it yourself with snow and compare the performance with lime. I really don't get it running with snow.

''' public function new(engine:Engine) { var scene = new Scene(engine); var light = new DirectionalLight("light", new Vector3(0, .4, .8), scene); var cam = new FreeCamera("freecam", new Vector3(0, 0, -5), scene);

    var box = Mesh.CreateBox("box", 2, scene);

    var mat = new StandardMaterial("boxmat", scene);
    var btxt = new Texture("assets/textures/groundbump.png", scene);

    mat.emissiveColor = new Color3(0, 0, 0.4);
    mat.diffuseColor = new Color3(0, 0, 1);

    btxt.uScale = 4;
    btxt.vScale = 4;

    mat.bumpTexture = btxt;

    box.material = mat;

    scene.executeWhenReady(function() {
        engine.runRenderLoop(function()
        {
            box.rotation.x += 0.01;
            box.rotation.y += 0.01;
            scene.render();
        });
    });
}

''' groundbump

mightymarcus commented 8 years ago

Ok, even with 3 cubes it runs fine now. I don't now what happend. Maybe my phone is as tired as me ;)

mightymarcus commented 8 years ago

Coming back later, need a fps counter to measure the difference.

vujadin commented 8 years ago

I can't get anything to render on android?! 'Basic scene' doesn't work too, 'BumpMap' sample neither ...

vujadin commented 8 years ago

snow build works fine (web and win, android build doesn't work, have no idea why) there's no pref drop with bumpmaps: http://babylonhx.com/demos/bumpmapstresstest/ both web and win builds work fine (those are instances but still... maybe I should use clones instead)

mightymarcus commented 8 years ago

Yes, the problem with the bumpmap occurs only on android for me Desktop is fine.I have a scene with some simple meshes and a ground. The ground gets a bumpmap texture and fps is dropping down so it is stuttering. And I can't try the latest Bhx version to see if the problem is gone because when I use a texture the mesh gets invisible.

vujadin commented 8 years ago

I've tried on friends phone with android 4.1.2 and everything works fine, with and without bumpmaps. I have android 5.0.2 and nothing renders, not even LineMesh or mesh without textures in material. Another friend of mine has samsung s6 with android 5.0.0 and meshes with textures do not render (but those without textures do). So this is really strange... What version of android do you have ?

mightymarcus commented 8 years ago

I have version 6.0. Maybe it's the shaders/opengl versions that works on one device but not on the other. I added some custom shaders in a demo and the most of them didn't work (this was on windows 10) until I added #version 130 to the shader code.

vujadin commented 8 years ago

I've fixed this. I'll push the fix in a few hours when I get back home

vujadin commented 8 years ago

this should be fixed now, I've just pushed an update. please check

mightymarcus commented 8 years ago

Right.