Tag Info

New answers tagged

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 ...


0

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 ...


0

I created a new project, ported everything over. It solves the problem, so I assume it is a Unity bug. I have no idea how to recreate it though.


5

The task is actually highly parallelisable on the GPU. Here is an algorithm that should work, assuming e.g. a 1024×1024 source texture ST. create a 256×256 render target, RT1 run a fragment shader that reads from ST and writes to RT1 and does the following: for each fragment in the render target get the (x,y) fragment coordinates sample 16 pixels from ...


0

As noted already, you cannot create a TextureArray with different formats or sizes. They all must have the same for both. That said, the binding limit for simultaneous textures with Direct3D 11 and Feature Level 10.0 is 128, so you could just bind up to 128 individual SRVs in a single pass. TextureArrays already require Feature Level 10.0, and Feature Level ...


1

Yes. Ensure that none of the vertices in the trunk are included in the bones controlling the arms. Check out the skin modifier documentation and how to either modify the envelopes you're using, or manually selected the vertices controlled by the underlying bone.


1

This might be related to using texture atlas techniques combined with mipmapping. Mipmapping means that you generate scaled down versions of your textures. These are used when looking at textures that are at a far distance or viewed at a sharp angle. The reason for this is that you want to sample a larger area of the texture when looking at it from a ...


2

From what I understand from your question: You don't want your model/dashboard to have so much shadow on it from certain angles. Here is a picture of a textured model with just the default lighting enabled: The dark side: Well if you want to make it look like there is lighting coming from the model you can add Emmisive Light. Change you ...


0

I should have read your post completely. Using glDrawElements is not a perfect fit for textured models because there can be shared vertices but those vertices cannot have same texture coordinates all the time. So you have to add all the vertices normally as you do in the case of using glDrawArrays. So using glDrawElements is useless in this case and it ...



Top 50 recent answers are included