Skip to main content
5 votes
Accepted

Issue with Texture2D memory leak in Unity

Assets in Unity (textures, materials, etc) are not garbage collected as readily as other types. Unity will clean up unused assets on scene loads, but to keep this cruft from piling up it's our ...
DMGregory's user avatar
  • 136k
3 votes
Accepted

Learning how to make imposters manually in Unity - how to render an object to a texture not what camera sees?

There are a variety of different imposter techniques. Level of detail is probably the easiest to achieve, but has two main drawbacks. The noticeable 'pop' effect when you swap between low and high ...
Reuben Crimp's user avatar
3 votes
Accepted

Achieving 2D Lighting for Terraria-Like Game

First you draw your color map Then you draw your light map And finally you multiply both. If you want a some sort of secondary lighting in your game, and if your game world uses grid for terrain ...
Ocelot's user avatar
  • 1,433
3 votes

Render 2D texture on the cube texture at given location

Why render the sun into the skybox? Just render the skybox and then draw the sun without using a depth test. This way you don't have to modify any textures and then redraw them. It's much easier to ...
user1118321's user avatar
  • 2,642
2 votes

XNA draw a rectangle 3D perpendicular to camera

This can be done many ways, here I'll give you non language or engine specific answers. The first way to do it is useful, if you don't want to or can't use shaders, you need to get the angles of the ...
Bálint's user avatar
  • 15k
2 votes
Accepted

Why does rendering to a texture cause transparency here?

A couple of things i try to do first to debug it. For your ui just set the pixel shader to write out white with alpha set to 1.0f. If that is rendering and is no longer transparent then you can ...
ErnieDingo's user avatar
  • 1,180
2 votes

How can I make my Camera's RenderTexture output have a transparent background?

For Unity 2019.4 I needed to set one camera as an overlay camera via... "Camera Component" --> "Render Type" --> Overlay. Secondly, I needed to take the other camera and add ...
mrVentures's user avatar
2 votes

How can I make my Camera's RenderTexture output have a transparent background?

I had the same problem and realized that my RenderTexture had a depth of 24, so no alpha. Here's a piece a code that to allows me to take a picture of a 3d model to use it as a sprite, with no ...
Vince's user avatar
  • 21
2 votes

How can I Fade Paint over time?

frag is declared as returning a Vector (float4). What you are actually returning is a Scalar (...
Draco18s no longer trusts SE's user avatar
2 votes
Accepted

Noticeable quality loss on texture captured using Graphics.Blit vs Shader output directly to a mesh

When you draw a piece of geometry with a shader directly, the GPU evaluates that shader once for every screen pixel the geometry covers. (Or more, if you're using SSAA) Every single one of those ...
DMGregory's user avatar
  • 136k
2 votes

Why is my Canvas/RawImage not included in my Camera's RenderTexture output?

UPDATE: Upon opening up this test project another day, this seems to be broken once again (even with my Canvas set to World Space). I'm suspecting this might be a ...
Nathan Friend's user avatar
2 votes
Accepted

Sprite created with RenderTexture and ReadPixels() has multiplied colors

Use Graphics.CopyTexture() instead of ReadPixels() CopyTexture Docs Not sure why ReadPixels is doing the weird stuff, but CopyTexture doesn't. Here's the updated ...
Acme Nerd Games's user avatar
1 vote

Why does rendering to a texture cause transparency here?

In the event that somebody with a similar problem stumbles onto this thread, I'll share what eventually fixed my issue. I took ErnieDingo's advice and took a closer look at the z-buffer. Looking for ...
Scorch's user avatar
  • 277
1 vote
Accepted

How to convert depth values into Unity's distance

As described in the docs, Linear01Depth() is for getting the depth as a fraction of the way between the near and far planes. To get an eye space depth value in ...
DMGregory's user avatar
  • 136k
1 vote

Unity: Render 1st Texture to 2nd Texture

Turns out it's simple, if you get great advice from DMGregory. Graphics.Blit(sourceRenderTexture, targetRenderTexture, unlitMaterial, -1); is the answer. I'm ...
marcgfx's user avatar
  • 121
1 vote
Accepted

dx11 Rendering to target texture shows only clearcolor(ImGUI-Custom Game Engine)

I managed to solve the triangle rendering problem via changing ClearDepthStencilView() 0u to 1u ...
Roveldo's user avatar
  • 76
1 vote

Rendering to Texture with Transparency in Monogame?

Digging up this old post since it has no verified answer. I had the same issue with drawing to multiple render targets. Then drawing them stacked as layers. Nothing was working till I discovered ...
Joshua sweet's user avatar
1 vote

Rendering to Texture with Transparency in Monogame?

Turns out, while no documentation I've seen backs this up, that if you throw a texture2D directly at the screen via rendertarget being null, it gets wiped out by any RenderTargets you draw via ...
user130089's user avatar
1 vote

Dr.Strange's door in Unity3D, how to put a projected void on a plane?

If I understand correctly, I think I came across a Brackey's youtube tutorial awhile back demonstrating a similar technique. You can have two completely different environments, but see through the ...
gjh33's user avatar
  • 691
1 vote

How can I pack repeated textures into one texture efficiently?

Since the question is about "efficiently" packing a mix of repeated and non-repeated textures into a texture atlas, the answer is: most likely no, you can't. As DMGregory said Texture Arrays are ...
Stephane Hockenhull's user avatar
1 vote
Accepted

Combining multiple diffuse textures into one leaves strange distortions?

DMGregory's suggestion to use a different format is simple and straight forward. So perhaps try that first and see if it solves your issue. However, if you for some reason want to keep using PNG, you ...
Morten's user avatar
  • 616
1 vote

Combining multiple diffuse textures into one leaves strange distortions?

This often happens when saving in PNG format. As Morten Andersen points out, those streaky stripes are a telltale sign of PNG compression in zero-alpha areas. The reason is that PNG exporters assume ...
DMGregory's user avatar
  • 136k
1 vote

Screen Capture rendered on a RenderTexture in Unity

I found one possible solution, but I haven't had time to try it. I will make a separate program that captures screenshots at around 30 FPS using DirectX (SharpDX) and these frames will be pumped into ...
Lázár Zsolt's user avatar
1 vote

How Do I 'Reset' my Render Texture When I Stop a Video Player?

I ended up going on to other projects, but found myself needing a solution to this issue again. It took me a few hours, but I was able to find a solution. I wrote a script to use the render texture I ...
Pamela Cook - LightBe Corp's user avatar
1 vote

How Do I 'Reset' my Render Texture When I Stop a Video Player?

I did a quick test on my machine, a quick solution to that would be to disable the VideoPlayer component by calling ...
Tom Tsagkatos's user avatar
1 vote
Accepted

Using a Compute Shader in Unity to convert a texture to a float array

Ok, thanks to some direction from @DMGregory I reconsidered and solved my own question. The answer was in two parts: I was combining the x and y coordinates (id.x and id.y) strangely, and I was using ...
EmmetOT's user avatar
  • 121
1 vote

How can I make my Camera's RenderTexture output have a transparent background?

If you want to layer cameras on top of each other and use the lower layered camera as the "background" to the other cameras, you need to set the Clear Flags of the higher layer cameras to Depth Only. ...
John Hamilton's user avatar
1 vote

SDL2 Draw scene to texture. SDL2 RenderTexture like SFML

Afaik this function could be of help: https://wiki.libsdl.org/SDL_SetRenderTarget Do you really need to rely on SDL2? SFML has built-in support for OpenGL and would be the better choice.
Uriens The Gray's user avatar
1 vote

problem in texturing

I searched MSDN AND I saw default sampler is wrap. But! that was XNA not dx11 if you don't setting your sampler state it's fine dx11 will set default sampler state. check here what is default state ...
Yunsung Jung's user avatar

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