Jump to content

Problems with opacityTexture


Recommended Posts

Hi community,


I get some weird appearance trying to use alpha blending. 


1) (see image attachment 1) I do neither use alpha testing nor alpha blending. The texture is a PNG file with alpha information. The result looks fine. 


2) I add alpha testing to the diffuseTexture propery. Everything is nice. 


3) I add an opacity texture. Now the result looks weird. It seems that the normals of some polygons have flipped. 


My code is as follows:

var createScene = function () {    var scene = new BABYLON.Scene(_babylonEngine);    var light = new BABYLON.PointLight("point", new BABYLON.Vector3(10, 10, 10), scene);    var camera = new BABYLON.ArcRotateCamera("Camera", 0, 1.2, 10, new BABYLON.Vector3.Zero(), scene);    camera.attachControl(canvas, false);    // changing the wheel precision to get a smoother mouse wheel scrolling    camera.wheelPrecision = 20;    BABYLON.SceneLoader.ImportMesh("", "_3D/models/", W2PTT_CONFIG["productCategory"] + ".babylon", scene, function (newMeshes) {        camera.target = newMeshes[meshToAssignTextureToIdx];        		var textureFile = "../userData/textures/_templates/TemplateForMiniCooler.png" + W2PTT.utils.createCacheBuster();        //var textureFile = "../userData/textures/_templates/tree.png" + W2PTT.utils.createCacheBuster();//		        var textureFile = "../userData/textures/merged/" + W2PTT_CONFIG['shotID'] + ".png" + W2PTT.utils.createCacheBuster();        var material = new BABYLON.StandardMaterial("texturePlane", scene);			material.diffuseTexture = new BABYLON.Texture(textureFile, scene); 			material.diffuseTexture.hasAlpha = true;			material.opacityTexture = new BABYLON.Texture(textureFile, scene);			material.opacityTexture.getAlphaFromRGB = true;			//material.opacityTexture.hasAlpha = true;			//material.backFaceCulling = false; 			//material.diffuseTexture.getAlphaFromRGB = true;			//material.specularPower = 256;			//material.alpha = 1;					                newMeshes[meshToAssignTextureToIdx].material = material;    });    scene.registerBeforeRender(function () {        light.position = camera.position;    });    return scene;};

Any ideas? 


Thanks for your help. 



The mesh is an exported Blender file. 




Link to comment
Share on other sites

Hi Deltakosh, 


something offtopic here: 


I think you are the creator of BabylonJS, aren't you? So is it just a coincidence that your nick includes the name "Kosh", one of the most important figures in the TV series Babylon 5? And did BabylonJS get its name from the series?

If it is so: congratulations, good choice!  :)

I like this series so much, even more than StarTrek and I'm a big fan of G'Kar and of course - Kosh. Probably one of the most underrated TV series ever. 



Link to comment
Share on other sites

This is BY FAR my best TV show ever. I'm a huge fan of Babylon 5 and this is why I named the engine "Babylon.js"


Kosh, Vorlon Ambassador, was my nickname since I'm 20 or so (and I'm 40) :) I added "delta" because as a wow player I created "kosh" then "alphakosh", "betakosh", "gammakosh" and then "deltakosh" which is now my main character :D

Link to comment
Share on other sites

To all german Babylon.js users who may be interested to the TV series that lent its name to Babylon.js: 


Tele5 is broadcasting Babylon 5 atm every afternoon from 4 to 6 pm. It's worth to have a look at. Today season 4 (of 5) has started. But since Babylon 5 has an epic story you may be a little confused, be aware of that. However, the danger of becoming addicted still remains...  ;)

Link to comment
Share on other sites

  • 1 year later...

I doubt you will get an answer from a user that was last active in 2014.


BUT! It seems like the w2ptt is simply a placeholder for strings :-) It contains the current product-category name (the babylon file to be loaded) and adds what seems to be cache-prevention-url-param to the texture. that's about it...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...