arek3D Posted March 23, 2017 Share Posted March 23, 2017 Hello, I have noticed that there is a problem with UV mapping, if I use a dynamicTexture on my mesh, imported from .babylon file. I am sure that my mesh has proper UV mapping, I have checked it by using standard texture. If I use normal texture on this mesh, everything is ok. If I use dynamic texture on BABYLON.Mesh, everything is ok. If I use dynamic texture on my mesh, I have seen something like that: I can't find an example on the playground with a mesh with proper UV mapping, so I have chosen the skull Playground: http://www.babylonjs-playground.com/#1NQC5D#3 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 23, 2017 Share Posted March 23, 2017 Hello you cannot use the skull for this PG as it has no UV channel http://www.babylonjs-playground.com/#1NQC5D#5 So I guess the issue comes from your original mesh? Quote Link to comment Share on other sites More sharing options...
arek3D Posted March 24, 2017 Author Share Posted March 24, 2017 Oh, I didn't know about this rabbit This is simple plane from 3ds max with proper mapping. Typical texture works fine on that. But if I use DynamicTexture I get something like this: Could you try with attached file? Thank you for your help! plane2.manifest plane2.babylon Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 27, 2017 Share Posted March 27, 2017 Best option will be to provide a repro case on the PG Quote Link to comment Share on other sites More sharing options...
arek3D Posted March 28, 2017 Author Share Posted March 28, 2017 Yes, right, but I do not know how to import my .babylon file on playground Is it possible? Mesh:http://dev.chimeraprime.com/testvr/plane2.babylon Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 28, 2017 Share Posted March 28, 2017 Hello if your server is not strict on CORS you can simply load your file from where it is with SceneLoader.AppendScene Quote Link to comment Share on other sites More sharing options...
Wingnut Posted March 28, 2017 Share Posted March 28, 2017 Hi guys! @arek3D, I got a playground rolling for you, and am doing some dynamicTexture tests. I am getting same results as you so far. Could be my mistake, though. http://www.babylonjs-playground.com/#1CMD3G#32 No SceneLoader.Append in this one... I use ImportMesh instead, for this demo. As you can see, a second plane... created within the scene... is rendering the drawText fine. SO... it is my opinion... that your imported plane has no UVs set. I am also having troubles scaling it (line 13). The in-scene-made plane scales correctly in line 19. hmm. The imported plane has a different axes-orientation or something. There may be options in your modeling software for "generate UVs", or ways to "include UVs" during the export. I don't work with modelers very often - sorry. You COULD even set the UV's yourself, with JS, in the scene (by setting 4-8 Vector2 values on the mesh's vertexData object). We'll talk about that later. First, check your modeler and perhaps view the .babylon file with wordpad or online JSON viewer... see if there is UVS data in there, or only vertices and indices. Keep us posted. You should be able to use that playground above... for testing. Make more saves, bookmark the url after each save, etc. Have fun, you cannot damage anything in the playground... no matter how much you try. Good luck. arek3D 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 28, 2017 Share Posted March 28, 2017 Quote SO... it is my opinion... that your imported plane has no UVs se Agree! Quote Link to comment Share on other sites More sharing options...
arek3D Posted March 28, 2017 Author Share Posted March 28, 2017 Thank you very much for your answers! I will check that PG tomorrow. But how to explain the fact that when I put a standard texture, it works well on the same plane? Imho without UV channel it would not be possible. I use 3ds max 2016, with max2babylon exporter, but not the newest version, because it shows errors. Quote Link to comment Share on other sites More sharing options...
arek3D Posted March 29, 2017 Author Share Posted March 29, 2017 I think UV channel is correct in my mesh (this is default plane from 3ds max 2016. So UV must be correct. Moreover, I made a PG which prove that UV is incorrect only if I use DynamicTexture (in this example textures are swapped in the loop every 60 frames) http://www.babylonjs-playground.com/#1CMD3G#39 This is quite strange, isn't it? Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted March 29, 2017 Share Posted March 29, 2017 Hi again, good troublehshooting/research, Arek! I've been doing some testing: http://www.babylonjs-playground.com/#1CMD3G#40 According to console, the imported plane UVs is a Float32Array [ 0, 1, 1, 1, 1, 2, 1, 2, 0, 2, 0, 1] (two 3-point triangular facets) I don't think I have ever seen a UV array with 2's in it. As far as I know, all UVs, should be 0 to 1 inclusive, and never higher than 1. hmm. I created my own UVs (uvs3) in line 45, and poked it into the plane in line 46. Then I re-query the UV data from the plane, and send it to console. Notice it is NOT a Float32Array, but perhaps that is only because I didn't "cast" uvs3 as such. Not sure if I CAN force a standard array... to be Float32Array. (see update below) But, plane started showing the draw-text. I'll be darned. Quite strange indeed, Arek. Perhaps @Deltakosh (or others nearby) will be able to understand this. I'm kind of baffled. Possibly, there is a problem with the 3dMax exporter, but I speculate incorrectly quite often. I'll keep thinking and perhaps do more tests. Others will have ideas... I know it. We have a HUGE PILE of smart people nearby, including you, Arek! You made a very interesting "find". Well done. Puzzling. Update: Oh duh, Wingnut. There's a new Float32Array right there in line 33. (I borrowed that code from another forum post). I should learn to pay attention to life, huh? Thx to @JCPalmer for the Float32Array and convert-to-updatable info. mesh.setUpdatable(true) would be "nicer", huh? arek3D 1 Quote Link to comment Share on other sites More sharing options...
gryff Posted March 29, 2017 Share Posted March 29, 2017 @Wingnut and @arek3D Here is an PG example using Wingy's code from above but using a plane created in/exported from Blender Plane and text Looks fine. It prints out the UVs in the console, but they are : "uvs":[1,0,1,1,0,1,0,0] (from the .babylon file) Hope that helps in some way. cheers, gryff arek3D and Wingnut 2 Quote Link to comment Share on other sites More sharing options...
arek3D Posted March 30, 2017 Author Share Posted March 30, 2017 Thank you @Wingnut for your workaround!! I wrote proper UV values for my meshes and it works! In my free time, I will try to fix that issue with the newest exporter, which I had and I will test this strange UV behavior once again. Or maybe I should change 3ds max to 2017 version Wingnut and GameMonetize 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.