Tag Info

New answers tagged

0

Now I am no unity expert (I opened it once two years ago), but I hope this helps. First you would want to find the width of the string (in pixels). Something along these lines: var textDimensions = GUI.skin.label.CalcSize(new GUIContent("text")); //textDimensions.x contains the width in pixels. Now you are going to want to see if that fits. If it doesn't ...


0

Assuming you just want to clip the text, there are several methods. http://stackoverflow.com/questions/3825979/c-limit-the-length-of-a-string


2

To apply different textures based on height the general method is to, in a pixel shader; Find the height of the geometry at the current pixel position. Perform a texture lookup on the heightmap that defines the geometry or just find the position of the current geometry as you would for lighting and find the y component. Supply your shader with some kind ...


1

Well, i'd probably start by taking a look at the blender unwrapping code, since blender is some open souce flavor; it appears to start here: https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/uvedit/uvedit_unwrap_ops.c I know the have a "pack lightmaps" command in their uv unwrap menu, but I wasn't able to locate it in unknown ...


0

Transforming uv coordinates should be good enough. You could do it while loading your model, or even in a shader. Whether the texture is upside-down in memory is irrelevant for performance when sampling the texture.


1

i do believe changing the color would be much less resource intensive, however the performance depends more on the number of different textures used. check out this article for a few good bits of ingenuity when it comes to managing textures and performance http://www.gamasutra.com/view/feature/131768/understanding_and_using_opengl_.php?print=1 my take ...


0

Ended up just taking the picture the mask and copying the pixels across if not a masked pixel: Texture2D BuildMask(Texture2D tex) { int x =0; int y=0; int width = Mathf.FloorToInt(maskTex.width); int height = Mathf.FloorToInt(maskTex.height); Texture2D tmpTexture = new Texture2D(maskTex.width, maskTex.height); //set all the ...


0

Would the proper solution be to load up a ByteBuffer with data from my png image, then when I'm back on the render thread call glTexImage2D? What I don't understand is whether or not OpenGL will actually copy the buffer into it's own location, or directly access mine. The latter approach would be ideal. This is basically what you want to do. ...


3

This effect can be achieved by drawing the blood in two layers. The bottom layer is the black border and the top layer is the red blood. Note that actual "layers" are not required, as long as the drops can draw in two phases, all black, followed by all red. Each droplet draws its shape as a black sprite. Then after all black shapes are drawn, they each draw ...


1

If you look closer - it is not border of(each) blood drops - it is a border of all blood-red area. And I think the border was added actually after rendering blood to look cartoonish. This could be post processing effect just as well as shader. It should not be difficult to implement edge-detection algorithm (plus you know the color you are looking for).


2

The first formula you mentioned is not suitable for the result you want to achieve. I suggest the following formula instead: float3 n = abs(input.normal.xyz); float2 tileUV = float2(dot(n, input.pos3D.zxx), dot(-n, input.pos3D.yzy)); The n vector basically selects the side of the cube, as exactly one coordinate is 1, the others are ...


0

This is a well-known feature of libGDX: the Y-axis has 0 at the bottom of the screen, not the top. (This is to be more consistent with 3D coordinate systems, which do likewise.) There are a couple of ways to "fix" this. Use a camera. You can transform the view. In your render method, calculate the Y position as screen.height - y - sprite.height. This is ...


1

I found out that the access violation was a bug in SDL that only happens in some drivers (intel graphics in my case) if I use SDL_RENDERER_SOFTWARE instead of SDL_RENDERER_ACCELERATED it works, so it is pretty much depending on your graphics card and its drivers.


0

Perhaps you can make a prefab after you have finished with the editing? I mean, bring it all into a blank map, edit as wished, and then make a prefab of that and access it from another project..


1

How do I know how to map lets say (3,4) to (u,v)? First of all, your assumption is wrong. You don't transform position coordinates to uv coordinates, your vertice already has a uv coordinate. Like the following: Where (100,125) is the position of the first vertex (in pixels) and (0,0) is the UV coordinate. Mapping that point to the texture is a ...


0

Each of the vertexes of the triangle will have a u,v coordinate assigned. When the triangle is projected onto the screen each point that is displayed on screen will have a set of barycentric coordinates. Then to get the texture coordinate you just take the average of the texture coordinates weighted by the barycentric coordinates. In openGL this is done ...


3

You absolutely can combine them! Many 3D games contain an image for the characters body and one for the head, and some combine the two for a single texture for the entire a model. Here's an example of a whole head's texture: Also check out this PDF if you'd like to learn more about texture mapping in general.


0

I didn't check thoroughly, but one major problem I see here is that you aren't following the OpenGL manual: This line of code is never valid: gl.glBindBuffer(GL.GL_TEXTURE0, vboTextureCoordHandle); You must use a valid buffer bind target, in this case GL_ARRAY_BUFFER. As it stands now, you're using your model coordinates as the texture coordinates also, ...


0

I figured out my "EDIT3" problem: I didn't look closely enough at the parameters of glDrawArrays(). Instead of saying gl.glDrawArrays(GL.GL_TRIANGLES, (int) vertices.get(0), vertices.capacity()); I should have been saying gl.glDrawArrays(GL.GL_TRIANGLES, 0, vertices.capacity()); because the middle parameter is the starting point. After that, the cube ...



Top 50 recent answers are included