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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 (...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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
...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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.
...
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.
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
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
rendertexture × 86unity × 54
rendering × 18
textures × 15
shaders × 12
camera × 12
opengl × 10
c# × 6
directx11 × 4
texture-atlas × 4
post-processing × 4
unity-urp × 4
directx × 3
graphics × 3
sdl2 × 3
graphic-effects × 3
depth-buffer × 3
viewport × 3
frame-buffer × 3
rendertargets × 3
compute-shader × 3
2d × 2
xna × 2
monogame × 2
godot × 2