Hue-shifting is one possibility that would let you get a range of colors without losing the color details. The basic idea is to convert each pixel from RGB to HSV space, then offset the hue by a user-defined amount, then convert back to RGB. Actually, this can be done more efficiently by applying a rotation matrix to the RGB values: create a matrix that ...
Use parallax scrolling. Have multiple background layers which scroll with different fractions of the speed of the main viewpoint. The lower the layer, the slower it scrolls. This isn't just a great way to provide an illusion of depth, it also makes the backgrounds look less repetitive because the objects on the different layers will appear in different ...
You can implement IPointerEnter and IPointerExit interfaces and keep boolean for 'over state':
public class TestOver : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
public bool isOver = false;
public void OnPointerEnter(PointerEventData eventData)
The problem you are facing is that you can't simply "tint" the whole image, the appearance you see is more than just a base color. For one you have fine gradients from one one material to the other, but more importantly you also have reflections,highlights and shadows, which are not influenced by the base color. (Those are basically added on top of it.)
Precisely, to repeat a texture.
So, if you have a quad, and the texture coordinates go from 0 to 1, the texture will be drawn once. If the coordinates go from 0 to 2 and wrap is set to GL_REPEAT, then the texture will be drawn twice.
Try it and see it by yourself
You could use polygons, or you could do a quick and dirty hack and just get a political map like this one:
. Then, pick a unique color for each country and flood fill it in paint or photoshop. Then, you have a simple file that just has the mapping of countries/provinces to particular colors. Just something like this:
A way to build an infinite background for a 2D game is the following:
Using a graphics editor software (like iDraw for Mac) create an image A that represents a portion of your background. This image should have a limited size.
Duplicate A and mirror it on the Y axis, this is B
Now paste (horizontally) togheter A and B, this is AB.
Finally import the image ...
SDL uses a type called SDL_RWops for this purpose. This is essentially a wrapper around a stream. When you call a function like IMG_Load(filename) it is just a small wrapper around IMG_Load_RW(ops) which constructs the ops using SDL_RWFromFile. You can create an SDL_RWops yourself (it's just a struct with some function pointers) if you have a custom stream ...
JPG is lossy. Don't use that for sprites -- you will end up with nasty artifacts that will look bad. There's a couple reasons you might want to use colur-keying, but they're a bit lost in todays hardware. Taking a quick look at color key advantages:
They use up less disk space -- there is no alpha channel to store
By consequence, their memory foot ...
I suspect you are using an inefficient implementation of the flood fill algorithm especially that the application freezes when applied on large images.
By looking quickly at your code I can identify few problems
It seems your code has a Big O( N^2 * K ) and might even be O(N^3), which translates to your code like this:
toProcessList.Count // Looping ...
Not all textures use texture coordinates that come from the mesh data. For example, with projective texturing, you transform the world into the space of the texture. Well, a lot of that world falls outside the [0, 1] range of the texture. Without some sort of clamping mode in place, you're going to get problems.
Yes, you can encounter texture coordinates greater than 1.0 and smaller than 0.0.
This depends completely on the model, you loaded. Normally, for each vertex there is position, normal, and texture coordinate stored. In most mesh file formats, the texture coordinate is not restricted to any range.
This is used to repeat a texture. For example, to span a ...
Layers work well.
Here's some maths:
Suppose you have a railway track that's been poorly made such that the like __ __ notice the gap between them. When the wheel rolls over them it makes a small notch (tiny notch).
If the track length is l and the wheel has radius r then 2pi r is the circumfrence of the wheel, ration=l/(2pi r) if the ratio is say 10.25 ...
Here is another idea which seems to be missing:
In case of long distance backgrounds, like sky boxes, Parallax layers doesn't really feel good. Think of the stars for example, when walking on earth, or even better through out the night, all the stars move together, though we know they are hundreds or thoughts light year away from each other. The thing is ...
The "Couldn't load file" error message you see is caused by two possible things:
The path is invalid (probably this one)
The file format is not supported (rare, but possible what OS are you using? I have seen this with Macs)
First, check if the path is truly correct. Check this:
the problem was in my images size , i set the viewport to be 800x480 but the images size was 800x420 , i just changed the image size to 800x480 and in setSize() i changed it like the following :
1f * sprite.getHeight() / sprite.getWidth() );
and its work perfectly now.
You can, but you'll need permission from the original copyright owner - there's no way around it, unless there's some license attached allowing you to do that specifically.
It doesn't matter whether you modify or edit the images (or any other copyrighted work).
Some legislations got special rules for such, e.g. it's possible that something is so obvious or ...
This seems to be a job for a procedural pixel shader.
The advantages over using an image are:
You don't need to provide huge bitmaps
It is procedural, so it doesn't have to repeat a fixed image (it can vary infinitely)
If you want a paralax effect, you can simulate thousands of planes, which would be impractical using images
You can do very advance effects,...
The artifacts are caused by scaling the images using point sampling / nearest neighbourhood filtering, which effetively doubles some of the pixels from the original image.
To get better results, switch to bilinear filtering which uses weighed average of multiple pixels. The result will be a little blurry, but should look a lot better than the current one.
They are hooking into the EditorApplication.hierarchyWindowItemOnGUI event. In their case they are storing a single icon texture within their editor script, and then checking the type of the object in the hierarchy, exiting the routine as soon as they've either decided there's nothing to do or they've found a specific icon to show.
I've linked to their code ...
Sadly, there is no built in to do this at the time of writing. Instead this is what exists:
A bug report: Getting depth texture from viewports.
A proposal: Accessing different viewport buffers through ViewportTextures. Feel free to upvote it, and comment why you need it in your project.
And a pull request to add this feature: Add access to the viewport's G-...
First of all 1920x1080 is not power of two, even if your card support NPOT textures I think it's a best practice to use a POT texture.
Second let's calculate the size in bytes. 1920 * 1080 * 4 = 8294400 bytes that is around 8mb of memory. Since the answer is tagged as android I assume you are talking about a mobile platform. A lot of the mobile platforms ...
Use it individually. Texture atlases are used to gain efficiency by minimising texture swaps for many small textures, and avoiding wastage due to textures having to be bumped up in size to dimensions that are a power-of-two. A single image on an atlas gains you nothing except more book-keeping, and if the atlases are required to be power-of-two in size, your ...
I think you are probably misunderstanding the coordinate system in which you are working. Higher numbers for X and Y are not necessarily up and right on the screen. So you're most likely seeing an upside down quad, or your camera is behind the thing you're looking at and you're seeing its back (a double-sided quad will show the mirror image of your texture ...