Hot answers tagged

9

Here's few things i could gather up, hope this helps you. There's multiple ways to get this done. You can write shaders or if you don't mind about having very simple glass, you can use default shaders and some PNG magic. Glass Shader made by Alastair Aitchison Reflective transparent "Glass shader" made by benoculus Unity asset store search: Glass Free ...


9

TextureAtlas#findRegion(String) returns a region with a name that matches the name specified. It does not copy the region, therefore any changes you make to the region will be reflected in the TextureAtlas. To overcome this issue, simply instantiate a new TextureRegion object and pass it the region found inside your TextureAtlas: background1 = new ...


8

since you admittedly don't have much experience with 3D and (presumably) OpenGL, I'll give you a "bird's eye" overview of the process. I'll do my considerations about OpenGL, but the basic reasoning yields for other APIs too. When you render something with a modern version of OpenGL you create objects that will reside into the GPU memory, and then mostly ...


5

If the textures are the same general "shape" (dimensions, mip levels, etc.) then use texture arrays. You can pack differently "shaped" textures into different arrays if you have any regularity, which you should. This approach gives you all the advantages of individual textures (e.g., no bleeding) plus all the advantages of a texture atlas (e.g. fewer state ...


4

Solution 1: Rotate your UVs in your vertex shader The vertex shader is where per-vertex attributes can be modified before rendering. These values are then linearly interpolated to generate values for all fragments of your polygons. As a rotation of your your UVs is a linear transformation, you only need to recalculate the values in the vertices, and linear ...


4

You shouldn't really worry about cutting of the other half of the sphere since Unity doesn't render faces that are looking away anyway. That doesn't solve your problem however. Try to save your sphere as a .blend file. Or if you did that, export it as an .fbx. If you really want to save resources you should bake(bake texture) your full sphere unto a ...


3

Scripts put in a folder named Editor affect Unity's editor, rather than running when you play the game. You can use this functionality to extend the capabilities of the editor, to run custom functions you create. For example, here's a script that adds a window with buttons for custom functions: http://wiki.unity3d.com/index.php?title=FindMissingScripts You ...


3

If the only difference between the quads is their physical size in window coordinates ("one is bigger than the other on-screen"), and all other things (shader, textures, et cetera) are equal, then the only significant difference in the pipeline will be that the rasterizer must fill more fragments for the quad that is larger on-screen. This means that if the ...


3

Here are two approaches that I've used before: The approach I prefer is to create an indirection map: Render the UV coordinates themselves to a texture Iterate the raw pixels of the 3D view which need to be updated. Splat into the model texture for each UV pixel The other approach I've had success with is un-projecting and raytracing Invert your ...


3

So you're not using a modelling program- thus you'll have to provide the cube/texture information yourself from code. Let's start out simple with one textured triangle. VertexPositionTextures contains Vertex (location of points in space) and texture (where does that point match to a point on an image). Keep in mind that the location for the texture is on a ...


3

Yes, it can. But certain devices will suffer. For example, iOS PVRTC texture compression doesn't work without square textures. I think Unity makes them square, so you end up with your textures taking up a bunch more RAM to accommodate PVRTC. See Unity Documentation: 2D Textures for more details.


3

1. Creating textured model in Blender First, add a new texture by going to texture panel on the right. Select type "Image or Movie", click "Open" and locate your texture file. Then, move your mouse to the 3d view, press Tab to select the default cube, then press "U" and select Unwrap. Go to UV Image Editor: and select the texture: At this point, the ...


3

You are checking how many bytes there are per pixel, but you are not checking how colours are ordered, and it could be RGBA or BGRA (or possibly something else). You need something like this instead of mode = GL_RGBA (little-endian machines): if (surface->format->Rmask == 0x000000ff) mode = GL_RGBA; else mode = GL_BGRA; If you want a more ...


3

To get rid of the jagged lines add 1 line of transparent pixels around the rectangle texture. The issue with the dark lines is that you are most likely using black transparent pixels (color #000000). The issue is most likely to be gone if you use colored transparency instead. - Repeating the border pixels of your sprite - but simply with alpha=0


3

As /u/slime73 pointed out, you are missing , after your T coordinates. float vertices[] = {// X Y R G B S T -0.5f, +0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f // Top-left +0.5f, +0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f // Top-right +0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f // ...


3

This depends on the details of your rendering setup, but here are the most common out-of-the-box behaviours: 1. Painter's Algorithm Many 2D frameworks simply layer sprites in the order they are drawn (so you need to draw your background before your foreground). In this case, whichever sprite occurs later in your drawing (ie. drawn from a later command, or ...


3

The texture regions inside don't need to be powers of two. But texture compression cells are often 4x4 so you have to be careful when using compressed textures that the edges of two texture regions don't share the same cell or they'll be compressed together which will degrade the quality if they have different colors. You should leave a N pixel border ...


2

I know this is a couple years late but maybe someone searching for a solution will come across this. So in order to change the "Default" file type assigned to new Output Elements created in Render to Texture, you can do the following. 1 MaxScript > Open Script 2 Navigate to the MacroScripts folder in you installation directory 3 Open ...


2

Yes, you can use that code to update a Unity RenderTexture (not simply a Texture2D). You need to make sure that code executes on the render thread. To do that, make sure you only call it in response to the GL.IssuePluginEvent (which will translate to the C++ function UnityRenderEvent).


2

In theory, loading many textures will be slower. In practice, the actual amount by which it is "slower" is probably negligible. There are two main bottlenecks: Reading the texture file off the disk. Sending the texture to the GPU. Files on disk have some small-but-non-zero overhead in terms of book-keeping information for the filesystem. Thus, 16 files ...


2

I figured it out. I forgot to set the "wrap mode" for each of the 6 textures to "clamp" rather than repeat. This seems to make all the difference when preventing seams for the skybox material.


2

I'll post the answer as the question is related to my previous misunderstanding of how textures and texture units work. You can load as many Textures as you want into the OpenGL memory, all assigned to Texture Unit #0. OpenGL always returns a new handle for each of these textures. When applying the texture, you just have to bind to the appropriate handle ...


2

Unity is pretty smart about keeping stuff around that you need in the future. What's more difficult is telling it when to get rid of stuff you don't need anymore. So yes, once this texture is loaded, it will recognize that and not load it again provided something hasn't removed it from memory in the meantime.


2

It looks like the Wings3D object doesn't have texture coordinates. There is a texture applied, it's just not applied correctly. Without texture coordinates, it'll just stretch a single pixel of the texture over the entire object.


2

If you open the image above in its full resolution and look closely (with something like Magnifier on Windows), you should see that all the pixels simply have something like a blurred edge. Since there can be seen standalone "edges" of pixels, it is clearly not a post-processing method. When looking at screenshots in different resolutions, the edge ...


2

A possible problem is in your SetInStartPosition(). For setting the Y position it should be position.Y = screenBounds.Height - texture.Height... not screenBounds.Width - texture.Width...


2

I don't think it's possible to specify a source pitch for the buffer in CPU memory like you could with a lower level API. However, you can specify an offset into your pixels using a DataView, so you could upload a 1000x100 portion of the texture that way.


2

Try turning off backface culling. In your shader, put "Cull Off" in the "SubShader" section.


2

This deserves a very broad answer because texturing is historically THE one big job of graphics renderers. Put shortly, this happens during rasterization. Rasterization is a process in the rendering pipeline, where the graphic card generates pixels (fragments) from geometry and then passes it on to the next stage of the pipeline, the pixel (fragment) ...


2

A tough one. Let's try. Let noise be your (infinite) noise function. Let Seam_noise be a seamless noise function in the dimension of your tiles. (here is an example , you can download c# code with a seamless perlin noise implementation ) Follow an example of seamless perlin repeated 4X4 times (the red quad is your tile dimension) Consider a "filter" ...



Only top voted, non community-wiki answers of a minimum length are eligible