Tag Info

New answers tagged

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


0

The procedure is called UV Mapping or Coordinates. Here's a good tutorial for OpenGL: http://www.opengl-tutorial.org/beginners-tutorials/tutorial-5-a-textured-cube/


1

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


0

If this should be a general possibility to change textures of objects dynamically, then I don't suggest to use a script on each object. May think of building ur own component, that loads a texture and looks every draw if has to change the texture. If this should only be for a few objects, about 1-10 in ur scene it's totally ok if u want a quick'n dirty ...


1

There's three members of a D3D11_MAPPED_SUBRESOURCE: a pointer to the beginning of the data; the number of bytes from the beginning of one row of data to the next row of data; the number of bytes from the beginning of one depth slice of data to the next depth slice of data. As none of these members communicate anything about the actual extents of a row ...


2

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


1

This is an old topic, and I had a similar problem to the topic. I had my texture coordinates just fine, but by lerping the camera position (which changed my element's positions) like so: public static void tween(Camera cam, Direction dir, Vec2 buffer, Vec2 start, Vec2 end) { if(step > steps) { tweening = false; return; } ...


1

If you want to use it as sprite then change the import settings 'Texture Type' to 'Sprite(2D and UI)'. This will bring it back to its original dimensions. If you want to use it as texture then this wont matter, the texture depends upon the 3d object UV mapping, so it will scale properly. For particle you can convert the entire image to have square ...


1

Yes! I have figured it out. LWJGL texture files must have dimensions equal to powers of 2 (2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048 etc). Otherwise OpenGL will clamp them to nearest power.


1

As described here (last chapter), please check the value of the field renderCalls in your SpriteBatch (you have only one unique SpriteBatch instance right ?), this should tell you the real number of draw calls that the batch has made. If you have more renderCalls than what you would expect then maxSpritesInBatch value is too low or your sprites have ...


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


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.


0

I don't exactly understand how would ray-tracing change anything, here is how it usually goes: You can have a texture for any parameter you like, but the most common is a diffuse(color) map, so you just sample this based on the texture coordinates and use the texture in place of the single-color diffuse. You could also combine the texture with an arbitrary ...


1

Some ideas: You could ignore the issue, and do what you're currently doing. Assuming those texture and shader comparisons are to OpenGL IDs (which are just integers), it's unlikely those checks are going to create a huge performance bottleneck. Comparison of integer values on modern CPUs is rather fast. Unless your profiler has told you this is currently a ...


1

What a dump question. I put the cubemap to the wrong samplerCube. I assigned the map to cubemap[1] not cubemap[0]. Great example of "I wouldn't do something like this. The error must be somewhere in the OpenGL code!" :D


1

Terrain has a "setAlphaMaps" function you can use to modify the terrain splat maps at runtime. You can find the documentation (along with an example) in the official unity documentation here: http://docs.unity3d.com/ScriptReference/TerrainData.SetAlphamaps.html Just make sure you call Terrain.Flush when you're done. As your target is a vector3 you will ...


1

The solution suggested by Sebastian would work, but you'll end up with a lot of code just for a "fade out/fade in" animation. Libgdx has built-in functionnalities for that in Scene2D, you should use them. (Actions, Stage, Actor) That would make your code as simple as that : myPlayer.addAction(Actions.sequence(Actions.fadeOut(0.15f), ...


1

Why not set the alpha value of the sprites directly via sprite.setAlpha(float)? Of course you would have to call that by your rendering method and calculate the amount of alpha alteration using deltaTime. https://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g2d/Sprite.html#setAlpha-float-


0

This problem may be related to mipmapping. The pixels along the edge are being mapped to a much more copressed LOD than the rest of the sphere, so the entire map is actually being compressed into that line. You may try putting in a tex2Dlod call in the shader and forcing the LOD to 0: return tex2Dlod(TextureSampler, float4(u, v, 0, 0)); Explanation and ...



Top 50 recent answers are included