Dad72 Posted June 7, 2015 Share Posted June 7, 2015 So I don't need to declare the geometry which the dynamic texture is applied?No, You recover texture as yourTextureDynamic._canvas.toDataURL() Quote Link to comment Share on other sites More sharing options...
Wingnut Posted June 7, 2015 Share Posted June 7, 2015 Hi dbawel... nice words... and know that YOU are one of the Brainiacs, too. You have taught us TONS... and we highly anticipate seeing (and hearing about) your project. DB, are users painting/drawing on the dynamic texture... while it is mapped onto something OTHER THAN a plane? In other words... given a 5-sided cylinder, are the users painting/drawing upon the sides of the cylinder? So, when you save these textures, they are often "specially painted" for certain mesh shapes? Are you wanting the texture to "carry along with it"... some information about what mesh shape this texture was created-upon? Otherwise, the mapping of the texture... onto ANY mesh... is really determined by the UVs of the mesh. SO a dynamic texture that was drawn-upon while the texture was mapped on a 5-side cylinder... will likely look like crap when mapped onto a box. The user did the drawing, while it was mapped onto a 5-sided cylinder (example). How would you "carry" the information about WHAT MESH the DT was drawn-upon initially? Not sure. I think I would try to append the mesh constructor line onto the image data... as a sub-array. For example, somehow store BABYLON.Mesh.CreateCylinder("cyl1", 4, 3, 3, 5, scene); WITH the texture. Later, when you load it into the project, you can grab the constructor line, and make the exact mesh that the original DT was drawn-upon. Then the mapping will be perfect, because you have presented the DT exactly how is was painted. Just some thoughts. Not sure how the subject went here, but I'm game. Quote Link to comment Share on other sites More sharing options...
dbawel Posted June 7, 2015 Share Posted June 7, 2015 I'm using a process very similar to joshcamas' projecting through a canvas with a texture (color), and a second canvas as a mask canvas with a brush gradient the same color as the object -which is a Babylon ground object and appending the dynamic texture on the ground object with an x,y pick and pointerdown event. I don't foresee the uv mapping as an issue, although I am moving the ground object's local center axis to mirror the canvas' x,y pick point.@wingnut and @dad72 - You guys are always gracious in your kind words towards the various skill sets found on this forum. Perhaps one day I'll actually earn the respect you give. Maybe this next app might give me the props to stand among the greater group. In the meantime, I'm good just to have a voice here.And @dad72 - so I should be able to pass the dynamic texture back though the canvas to record it? I had not considered this, if possible, this would simplify the process greatly. I'll give it a shot - thanks.Also thanks for the advice to use an array to store and recall the pick info to reconstruct the color as bitmap onto a plane- which is all I should need for v1. Things will get more interesting when I implement more complex mesh geometry in the collaborative design process. I'll then need to restore the exact geometry and uv mapping or it will not have any relevance to the initial session.I look forward to the feedback from posting here, as I'm sure there will be obvious improvements that I won't see as the only developer on the app. That is, once I finally get the gui integrated, the necessary use of so many canvas' got real confusing real fast. But I feel I'm close now -just a few bugs to fix - features, right? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted June 8, 2015 Share Posted June 8, 2015 Yes this texture can be recharged from a dynamic texture after being saved.loadedTexture = new Image();loadedTexture.crossOrigin = "Anonymous";cheminImage = "root/"+nameTexture+".png?" + (new Date()).getTime(); //Important: ?" + (new Date()).getTime(); For the cache of the textures.loadedTexture.src = cheminImage;loadedTexture.onload = function() { textureContext.save(); textureContext.clearRect(0, 0, textureSize.width, textureSize.height); textureContext.drawImage(loadedTexture, 0, 0); textureContext.restore(); textureGround.update();} Quote Link to comment Share on other sites More sharing options...
dbawel Posted June 8, 2015 Share Posted June 8, 2015 Hey dad, Thanks for the heads up on time stamping the bitmaps - otherwise, it wouldn't work, and would be nothing but problematic. Cheers. Quote Link to comment Share on other sites More sharing options...
max123 Posted October 19, 2016 Share Posted October 19, 2016 On 3/21/2015 at 2:29 AM, Deltakosh said: Hey team! Look what I found for you on the playground http://www.babylonjs-playground.com/#1BAPRM (Doc here: http://doc.babylonjs.com/page.php?p=25094 ) Super-very-ultra cool!! 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.