Jump to content

Sprites and Shadows


Mezzorio
 Share

Recommended Posts

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.  :D

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

Link to comment
Share on other sites

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 :)

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