Three.js - Add image to ExtrudeBufferGeometry - three.js

I want to add an image (a factory layout displayed on the floor) to an ExtrudeBufferGeometry (the floor) which is based on a shape with holes. I only want to cover the surface and not have it wrap around the corners - is that possible? If not, I am fine with a 2D geometry/plane as well as long as I can still punch in some holes.
I have successfully added said image to a PlaneGeometry but that does not allow for any holes.
I also managed to add it to the ExtrudeBufferGeometry but it looks like it only covers the border area as you can see colors when viewing it from the side. If I set the texture's repeat value using texture.repeat.set(), I can see the image properly. However, I do not want it to be repeated. It should only be displayed once. I'm having a hard time knowing what properties to set and change to achieve the desired result.
I researched a lot to get to this point but I cannot find a final solution for my specific problem. Any help or suggestions are highly appreciated - thank you!
Edit:
I managed to do it using ShapeGeometry. However, I still need texture.repeat.set(), otherwise it will be a tiny image on one side. Can anyone tell me how to adjust the scale?

Related

Rotation Without Resizing

I'm creating a skin (possibly a set of skins) which I plan to publish at some point. As I was working I ran into an issue with rotating an image meter. Its size is dynamic to a scale variable.
The image is resized when it is rotated. I believe this is due to the diagonal of the image not fitting within the frame of the meter. Although I'm not sure how I can solve the issue.
The Following is the code of the Image Meter:
[icon0]
Meter=Image
ImageName=#Resources\images\gear.png
W=(50*#scale#)
H=(50*#scale#)
X=(5*#scale#)
Y=(5*#scale#)
ImageRotate=90
When the value of "ImageRotate" is changed from 90 to 45 the icon scales down.
I tried to look at an example which created the effect that I wanted, but I couldn't figure it out. I also looked for a forum, or information in the "Rainmeter Manual" to find some useful information. I found something about the ScaleMargin, but it didn't seem to have the effect I wanted.
Thank you in advance for any help that I get.
I think you need to calculate the maximum possible W/H after rotation yourself. Possibly change X/Y too, if you want it to rotate around origin.
There is an example shown here. It uses Rotator meter .
Looking at that example, your code would be like:
[icon0]
Meter=Image
ImageName=#Resources\images\gear.png
W=(SQRT((50*#scale#) ** 2 + (50*#scale#) ** 2))
H=(SQRT((50*#scale#) ** 2 + (50*#scale#) ** 2))
X=(5*#scale#)
Y=(5*#scale#)
ImageRotate=90
Haven't tested it myself, you may need DynamicVariables=1 for #scale#s, and you probably need to calculate X and Y if you want to rotate around the center of the image. Not sure what you want though, I'll leave it to you.
Edit:
You may also need DynamicWindowSize=1 under [Rainmeter] section as well. Otherwise it will crop the image after rotation, if it doesn't fit the initial size of the skin.

how to use texture masks in game Maker?

First off I'm not totally sure if "texture masks" is the correct term to use here so If someone knows what it is then please let me know.
so the real question. I want to have an object in GameMaker: Studio which as it moves around it's texture changes depending on its position by pulling from a larger static image behind it. I've made a quick gif of what it might look like.
It can be found here
Another image that might help explain this is the "source-in" section of this image.
This is a reply to the same question posted on the steam GML forum by MrDave:
The feature you are looking for is draw_set_blend_mode(bm_subtract)
Basically you will have to draw everything onto a surface and then using the code above you switch the draw mode to bm_subtract. What this will do is rather than drawing images to the screen it will remove them. So you now draw blocks over the background and this will remove that area. Then you can draw everything you just put on the surface onto the screen.
(Remember to reset the draw mode and the surface target after. )
Its hard to get your head around the first time, but actually it isn’t all that complex once you get used to it.

How to remove regular strips

I want to remove the regular strips of the image as shown as follow. I try many methods, and they do not work, such as image media filter and FFT filter.
Could you tell me how to remove the strips?
All that black is removing a ton of information from the image. You have two options available - either re-capture that missing information in a new shot, or attempt to invent / synthesize / extrapolate the missing information with software.
If you can re-shoot, get your camera as close to the mesh fence as you can, use the largest aperture your lens supports to have the shallowest possible depth of field, and set your focus point as deep as possible - this will minimize the appearance of the mesh.
If that is the only still you have to work with, you've got a few dozen hours of playing with the clone and blur tools in front of you in just about any image editing software package you like.
Photoshop would be my go to tool of choice for this. In Photoshop CS5 they introduced something called content aware fill. I'm not sure if it will help you in this specific case because there is SO MUCH black that Adobe's algorithm may think other parts of the mesh are valid sources for filling in the mesh you're trying to clear out.

I need help drawing sunrays, glimmers, bursts, sparkles, etc in C

I am in the process of learning how to create a lens flare application. I've got most of the basic components figured out and now I'm moving on to the more complicated ones such as the glimmers / glints / spikeball as seen here: http://wiki.nuaj.net/images/e/e1/OpticalFlaresLensObjects.png
Or these: http://ak3.picdn.net/shutterstock/videos/1996229/preview/stock-footage-blue-flare-rotate.jpg
Some have suggested creating particles that emanate outwards from the center while fading out and either increasing or decreasing in size but I've tried this and there are just too many nested loops which makes performance awful.
Someone else suggested drawing a circular gradient from center white to radius black and using some algorithms to lighten and darken areas thus producing rays.
Does anyone have any ideas? I'm really stuck on this one.
I am using a limited compiler that is similar to C but I don't have any access to antialiasing, predefined shapes, etc. Everything has to be hand-coded.
Any help would be greatly appreciated!
I would create large circle selections, then use a radial gradient. Each side of the gradient is white, but one side has 100% alpha and the other 0%. Once you have used the gradient tool to draw that gradient inside the circle. Deselect it and use the transform tool to Skew or in a sense smash it. Then duplicate it several times and turn each one creating a spiral or circle holding Ctrl to constrain when needed. Then once those several layers are in the rotation or design that you want. Group them in a folder and then you can further effect them all at once with another transform or skew. WHen you use these real smal, they are like little stars. But you can do many different things when creating each one to make them different. Like making each one lower in opacity than the last etc...
I found a few examples of how to do lens-flare 'via code'. Ideally you'd want to do this as a post-process - meaning after you're done with your regular render, you process the image further.
Fragment shaders are apt for this step. The easiest version I found is this one. The basic idea is to
Identify really bright spots in your image and potentially down sample it.
Shoot rays from the fragment to the center of the image and sample some pixels along the way.
Accumalate the samples and apply further processing - chromatic distortion etc - on it.
And you get a whole range of options to play with.
Another more common alternative seems to be
Have a set of basic images (circles, hexes) and render them as a bunch of bright objects, along the path from the camera to the light(s).
Composite this image on top of the regular render of you scene.
The problem is in determining when to turn on lens flare, since it is dependant on whether a light is visible/occluded from a camera. GPU Gems comes to rescue, with better options.
A more serious, physically based implementation is listed in this paper. This is a real-time version of making lens-flares, but you need a hardware that can support both vertex and geometry shaders.

Detecting Object/Person in an image

I am new to Matlab, I am working on a project which will take input an image like this
as we can see it has a plain background (blue), and system will generate it's passport size image with given ratios, first I am working to separate background and person, the approach I searched is like if there is a blue in combinations of rgb matrices of image, then it is background, and rest is a person, but I am little bit confused that if this approach is correct or not, if it is correct then how can I find that current pixel is blue or not, how can I do it with matlab function find. Any help would be appreciated.
If you want to crop your image based on person's face, then there is no need in separating the background from the foreground. Nowadays you will easily find ready implementations of face detection, so, unless you want to implement your own method because the ready one fails, this should be a non-issue. See:
Show[img,
Graphics[{EdgeForm[{Yellow, Thick}], Opacity[0],
Rectangle ###
FindFaces[img = Import["http://i.stack.imgur.com/cSwzj.jpg"]]}]]
Supposing the face is detected correctly, you can expand/retract its bounding box to match the size you are after.

Resources