Jump to content

DynamicTexture do not work


imxood
 Share

Recommended Posts

(Sorry, my English is poor..) I want to use babylon file to load my scene(a box), and want to use DynamicTexture to update the box,

 

but there isnot word showed on the box......however,I get a box by using BABYLON.Mesh.CreateBox, use DynamicTexture to update the box, there are words showed on the box

here, code:

//load mesh
BABYLON.SceneLoader.ImportMesh("", "res/", "demo.babylon", scene, function(newMeshes, particleSystems) {
	
	scene.debugLayer.show();
	
	//dynamicTexture
	var wordTexture = new BABYLON.DynamicTexture("dynamic texture", 512, scene, true);
	wordTexture.drawText("me from Mars", null, 80, "bold 70px Segoe UI", "red", "#555555");
	
	//material
	var dyMaterial = new BABYLON.StandardMaterial("dyMaterial", scene);
	dyMaterial.diffuseTexture = wordTexture;
	
	//Box001, the mesh from babylon file
	Box001 = scene.getMeshByName("Box001");
	Box001.material = dyMaterial;
	
	//Box002
	Box002 = BABYLON.Mesh.CreateBox("Box002",6.0,scene,false,BABYLON.Mesh.DEFAULTSIDE);
	Box002.material = dyMaterial;

});

very thanks!

QQ截图20160909001242.png

Link to comment
Share on other sites

10 hours ago, Deltakosh said:

Hello

this seems like your box has no texture coordinates (uv). Which tool are you using to generate it?

I'm sorry to click "Report post" for replying  you, my English is pool:(, ,crying.......

Dear sir, I use 3dsmax...   for my problem, I can't know what to do, in 3dsmax, I made a plane, and exported to babylon file. in javascript, in the plane, BABYLON.Texture work, but BABYLON.DynamicTexture doesn't work with showing black;

sir, this problem has been bothering me for two days, but I have no way,,:(

//load mesh
BABYLON.SceneLoader.ImportMesh("", "res/", "demo.babylon", scene, function(newMeshes, particleSystems) {
					
	//scene.debugLayer.show();
					
	//DynamicTexture
	var dynamiTexture = new BABYLON.DynamicTexture("dynamiTexture", 1000, scene, true);//new BABYLON.Texture("res/pic.jpg", scene);
	dynamiTexture.drawText("- me from Mars...", null, 80, "40px Segoe UI", "red", null);
	
	//Material
	var dynamiTextureMaterial = new BABYLON.StandardMaterial("dynamiTextureMaterial", scene);
	dynamiTextureMaterial.diffuseTexture = dynamiTexture;
	dynamiTextureMaterial.backFaceCulling = false;
	
	//Plane002
	var Plane002 = scene.getMeshByName("Plane002");
	Plane002.material = dynamiTextureMaterial;
});

Thank you very very much for your comment!!

Link to comment
Share on other sites

Your 1st box appears to have no UV texture coordinates as DK said. First, I would assign a texture to your box in Max and then place the dynamic texture on a seperate channel. 

Also, try exporting using FBX and import into Blender to try and undersand the workflow a bit better. Also, I use both Maya and 3DSMax, and almost always export FBX to Blender - and then to .babylon, and have few issues.

I would assume that your transforms on the 1st (larger) box (cube) are not at a scale of (1,1,1). If you want to try your scene again and bypass the learning curve, reset all transformes before exporting. This will probably not solve your problem, but always a good step before exporting any objects for many reasons. If you are exporting to FBX, the are known material issues exporting from 3DSMax - which is why I recommend using Blender first as a test.

There is definately a process that must be entirely understood in unwrapping UVs to be compatible with the babylon.js framework.

DB 

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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