8 votes
Accepted

How to write a transparent shader for a sprite that ignores transparent sprites behind it?

Just change your Stencil like below Image: Stencil Op/Comparison Values Comparison Functions ...
Seyed Morteza Kamali's user avatar
6 votes
Accepted

Modern OpenGL, billboarding, alpha transparency

With the help of Bálint, I successfully got the issue fixed. Bálint suggested using the discard keyword in GLSL to discard pixels that are not visible (i.e, ...
Daniel_1985's user avatar
6 votes
Accepted

Can I clip a collection of geometry to render only inside a particular worldspace volume?

One way to do this is with the clip function in a shader, which aborts rendering of a pixel if it fails a particular condition. This lets you create custom-shaped ...
DMGregory's user avatar
  • 132k
6 votes

How to render transparent meshes without sorting?

Yes, it's possible. The general idea is called order independent transparency (OIT). OIT often relies on some form of sorting still (you in fact must having some form of sorting for certain types of ...
Sean Middleditch's user avatar
6 votes
Accepted

How to get rid of the white border/background on my png image?

Use a file format that supports alpha (png), an editor that can save it with a transparent background (gimp2, photoshop, basically not paint) and make sure you load the sprite correctly
Bálint's user avatar
  • 14.8k
4 votes

How to detect collision only in non-transparent texture?

I had faced similar problem, when I was building a tower defense game.Where I needed to check for collision between tower boundary (ellipse) and enemies (rectangle), first method : I have used the ...
Shersha Fn's user avatar
4 votes

Depth Peeling implementation problem: How to render the next layer? (OpenGL)

You should perform the depth test in the fragment shader "manually". OpenGL doesn't support multiple depth tests, and that its just what you need to render the second nearest pixels, because: You ...
Ivelate's user avatar
  • 383
3 votes

Fade in rendering mode doesn't work as intended

Here's a simple fix you can use when rendering a solid object like a building. We'll copy the building and render it twice in the same location: Drawing only to the depth buffer, without writing ...
DMGregory's user avatar
  • 132k
3 votes

How to change the transparency of an object in using code?

In recent Unity version, this code is invalid gameObject.renderer.material.color.a = 0.0f ; instead first you have to get materail from rendere like this ...
Muhammad Faizan Khan's user avatar
3 votes

Why is my alpha transparency not working correctly in Unity?

Try using a different shader on your material. Unlit/Transparent should do the trick, though without any lighting.
Iggy's user avatar
  • 640
3 votes

How are semitransparent polygons rendered in the correct order?

TLDR; this is one of the holy grails of computer science. It is very hard to correctly sort transparent polygons, especially when they intersect. See also painter's algorithm and this SO question. ...
Draco18s no longer trusts SE's user avatar
3 votes
Accepted

How front-to-back blending works?

I think a figured it out. I was correct about back-to-front blending. The destination color stores the already blended layers in premultiplied format, we assume that the alpha is 1. We don't care ...
racz16's user avatar
  • 151
2 votes

How can I render all objects behind a plane with a specific transparency value?

Draw the floor (transparent part) after drawing the rest of the objects with transparency blending turned on. Otherwise you can pass a currentFloor uniform to the fragment shader and a floor ...
ratchet freak's user avatar
2 votes
Accepted

OpenGL color overlay

GL11.glColor3f(alpha, alpha, alpha); won't work for 2 reasons: It's opaque. You'd need ...
Draco18s no longer trusts SE's user avatar
2 votes
Accepted

Why isn't my image's transparency honoured in the Unity sprite?

This may help: "simply change the render queue: - select Object Material - change view to Debug Mode (Inspector Window top right drop down menu) - change Custom Render Queue value for ...
n_plum's user avatar
  • 394
2 votes

UE4 How to Avoid Boundary Seams with Multiple Refractive Meshes

You don't say if your boxmodel uses separate materials per face - if not, I suggest that you do this. Then pre-pass each face before drawing the block, checking for a water block against each face; if ...
JonS's user avatar
  • 299
2 votes

Modern OpenGL, billboarding, alpha transparency

Yes it's the render order, but not in the way you think. The depth buffer only contains 1 dimensional data, it can't represent transparency. Even if part of the texture is transparent, it will still ...
Bálint's user avatar
  • 14.8k
2 votes

How are semitransparent polygons rendered in the correct order?

Option 1: Additive blending One easy trick you can use for explosions and such is using a special blend function. glBlendFunc( GL_ONE, GL_ONE ); This is called ...
Bram's user avatar
  • 3,729
2 votes

How to get 60fps animation in terms of rounding/truncating position/alpha floats

There’s no case I can think of where rounding values during an animation is a good idea. Color and opacity already get “rounded” by the display’s color depth (i.e. to one of 256 brightness values), ...
Noah Witherspoon's user avatar
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
Accepted

Unity Vertex Color Shader with Transparency

After continuing testing different combinations of Shader parameters I got it working like this: I feel silly because this actually makes sense, so I don't know why I didn't try that...
Daniel Marques's user avatar
2 votes

Add oceans to an earth model with only continents?

You can upscale the earth model, subdivide the larger triangles that end up underwater and make sure the new vertices are all the same distance from the center as the existing vertices. There are 2 ...
ratchet freak's user avatar
2 votes
Accepted

Add oceans to an earth model with only continents?

I have been able to achieve it with very little changes: background water sphere uses material with standard shader and Transparent rendering mode continents-only ...
aybe's user avatar
  • 773
2 votes
Accepted

Rendering order objects with transparency?

The usual way is: Render opaque objects first Blending disabled (this does not save memory — the render target still has just as many pixels with just as many bits of colour information — but it ...
DMGregory's user avatar
  • 132k
2 votes
Accepted

Does OIT Rendering work for semi-transparent textures with opaque parts?

As documented in the link you cite: Both new methods guarantee correct coverage of background ie. they promise that the right amount of the opaque pixels behind all the transparent objects will be ...
DMGregory's user avatar
  • 132k
2 votes

Does OIT Rendering work for semi-transparent textures with opaque parts?

I found a suprisingly simple solution for my Problem. Now I don't add my Texures that have either fully transparent or opaque Pixels to the transparent mesh/buffer, but instead to the mesh for solid ...
TheBaum's user avatar
  • 43
2 votes
Accepted

Can't make simple shader transparent in Unity

This is covered in the documentation: Optional parameters Transparency and alpha testing is controlled by alpha and alphatest ...
DMGregory's user avatar
  • 132k
1 vote
Accepted

DX11: Alpha blending not working with textured quads

You need to set your alpha blending state according to the effect you want to achieve. In the Output Merge Stage (when you combine the objects you're drawing with the backbuffer) the blending occours ...
Liuka's user avatar
  • 585

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