Mezzorio Posted September 5, 2017 Share Posted September 5, 2017 Hey! I wanted to know if the library has been updated yet to perform this function, as I found a couple of post from 2014 talking about it being in future updates @Deltakosh, An example post I found and wanted to know if it's here as would be suuuuuper useful to me right now in my current project build, if you know of another way also of it being done please let me know, please find the babylon playground link and youtube video of my build as my textures are not very good at working! https://www.babylonjs-playground.com/#80E5N5 Quote Link to comment Share on other sites More sharing options...
JohnK Posted September 5, 2017 Share Posted September 5, 2017 Though the aim is different to yours perhaps the topic may help Head on to second page and beginning of May where Nesh108 has a solution. Since he has found a way to form a mesh from the visible outline of a sprite you could do the same and then you could have a shadow from your mesh. Of course an immediate issue is that Nesh108 was using simple pixel sprites your image outlines are much much longer. Anyway good luck. Other may have better ideas. Quote Link to comment Share on other sites More sharing options...
Mezzorio Posted September 5, 2017 Author Share Posted September 5, 2017 15 minutes ago, JohnK said: @JohnK Thanks I'll read into that and have a play around! If I get it working i'll post a playground in here! Quote Link to comment Share on other sites More sharing options...
Wingnut Posted September 5, 2017 Share Posted September 5, 2017 Was there a comment missing in that last post, Mezz? Hey @JohnK I'm glad you brought this up. I told Mezz about Nesh's cookie cutter here. I think it blew his mind. You probably know about it, because I pinged you... within that post. You can tell JohnK is a genius, because he thinks just like me. I haven't been able to find out from Mezz... if he NEEDS the "click non-transparent part of images" feature, or not. If he can get-away-with using a button, then... with transparent image backgrounds and alpha testing, he should be able to accomplish this overlapping effect... without needing the Nesh cookie-cutter. At least I think so. Fun challenge, though. Gruesome. Hopefully, Mezz is making us a 8-10 sprite testing playground, now. Perhaps he will put a transparent-background image on each sprite, then we will overlap them... and start crying due-to sprite depth-testing issues. (nah, just kidding, maybe.) Quote Link to comment Share on other sites More sharing options...
Mezzorio Posted September 7, 2017 Author Share Posted September 7, 2017 https://www.babylonjs-playground.com/#41N19L#4 I NEED the transparent part of the images to not be clickableeeeeeeee help! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 7, 2017 Share Posted September 7, 2017 Hello! you can get the texture coordinates of the picked mesh with pickingInfo.getTextureCoordinates(). It is a vector2 that you can then use with your sprite image to get the pixel color. I recommend loading the sprite image, saving it inside a canvas, then using the context.getImageData to get the colors Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 7, 2017 Share Posted September 7, 2017 Oh..I've just seen that you are using sprite picking and not mesh picking Sprites make sense for performance but you won't be able to get the color info easily Quote Link to comment Share on other sites More sharing options...
Mezzorio Posted September 11, 2017 Author Share Posted September 11, 2017 On 07/09/2017 at 6:50 PM, Deltakosh said: Oh..I've just seen that you are using sprite picking and not mesh picking Sprites make sense for performance but you won't be able to get the color info easily This was my fix https://www.babylonjs-playground.com/#VEGKI1#8 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 11, 2017 Share Posted September 11, 2017 It works 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.