How to draw a border around a image texture in threejs? - three.js

I am building an image editor in threejs. There can be more than one images in the screen at a time and if a particular image is clicked a border should be added to the clicked image. Is there a builtin feature in threejs that i can use?

Related

How to set my Image Mask in Hexagon Shape in unity?

I Have hexagon sprites over Image and in back my screenshot image but Here, problem is my image shape square but i want try to fix in hexagon shape
So what i do ? please give me any suggestions
frame without image:
frame with image:
You can have a look at the following blog post:
https://subscription.packtpub.com/book/game_development/9781785885822/1/ch01lvl1sec13/adding-a-circular-mask-to-an-image
Basically, you create your hexagon shape in, for example, Gimp, fill it with white color and leave the rest transparent. Be sure to add the alpha channel to your layer. Export as a PNG and apply it to your sprite with the correct unlit transparent shader.
Create UI Panel And ADD COMPONENT
Image
Mask
In Image Component You set Your Any Shape's Image
And Also Add One Image Into Panel That you mask in this Shape
Check it out for more information https://youtu.be/g3gpXmo8zRo

How can I have a png image with transparency, visible only from *front*?

I'm using a prefab for a box shape, which has a front and back plane.
My images are PNG and have transparent areas around the edge. I dragged the image onto my front plane, which now has a drop-down box for "Shader".
First I chose Shader: "Standard" but the transparent areas of my PNG image weren't transparent, so in order to fix that I changed it to "Sprites / Diffuse"... now the image looks fine (from the front).
However, when I rotate the shape, the image is also visible from the back. I want a way to not see the image / texture from the back.
How can I make the images only visible from the front side of a plane, whilst also preserving the transparency areas of the image / texture?
If you are using the standard built-in shader, you need to set the rendering mode to transparent in order for the texture's alpha channel to be transparent. The sprite shader, by default, forces the rendering of otherwise invisible back-faces, whereas the standard shader does not.

Unity3D: Sprite renderer vs image renderer issues on canvas

I'm using sprites for an animated menu in my game.
I tried two methods:
Image Renderer: Replacing the image per frame with the sprite slice in the animation window
Sprite Renderer: Same method
I'm playing the sprite animation with no loop then rotating the transform on the z-axis.
The problem is that with the image the Screen Space overlay works well but the rotation of the transform causes the sprite to look glitchy and rough. With the sprite renderer however the Screen Space must be put to Camera and the sprites get placed between other assets in the world.
Example: http://postimg.org/image/436q9jvax/
Is there a way to either fix the roughness on the rotation using image or force the Camera Screen Space on top? My only concern with the 2nd option would be in relation to responsiveness for multiple devices.
The easiest fix was to apply "sorting layers" to the canvas with the sprite renderers on to keep it on top.
I did however incorporate #beuzel's idea about separate cameras in the end and opted for 2D sprites with physics instead of a 3D rendered animation on canvas.
http://postimg.org/image/6qmtiirb9/
Thanks for making the good sample. A fix for the menu intersecting the world is using a seperate camera for the GUI layer. The rough animation might be a pixel perfect setting in the sprite rendering (just guessing).
I don't have enough reputation points to write this as a comment.

Blending two sprites in OpenGL ES without affecting background

Basically what I want to achieve is a sprite highlight animation effect as displayed below.
The idea is that the white-translucent gradient sprite moves on top of the other sprite (left-to-right), using a blend mode like Overlay (Photoshop). The difficult part is that the top gradient sprite should only be drawn on the visible pixels of the sprite underneath. The other part of the gradient overlay should be discarded to not affect the background or other sprites underneath (like on the image to the far right).
Is it possible to achieve that effect with a clever combination of OpenGL blend modes and how, or would I have to create a custom shader to combine these sprites?
Background: I'm using libgdx with OpenGL ES 2.0 and the app runs on Desktop, Android and iOS.
There arÄ™ many ways to do it. The simplest one:
You should render button and hilight in a single pass. In fragment shader, after sampling button texture and hilight texture calc the output color as for blending (could be mix(c1,c2,c2.a)) and alpha as button texture alpha only. Of course enable blending in usual way: (srcalpha,1-srcalpha)

How to rotate an image in a picturebox?

I have a picture in a PictureBox. I want to rotate it by any angle.
And auto resize the PictureBox according to the rotated picture dimension.
Is there any sample code/project?
You can rotate images inside of pictureboxes and I believe auto resizing is a property you can easily select on pictureboxes. A sample project that shows rotating images can be found here:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=25764&lngWId=1

Resources