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
...
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, ...
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 ...
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 ...
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
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 ...
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 ...
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 ...
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
...
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.
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.
...
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 ...
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 ...
2
votes
Accepted
OpenGL color overlay
GL11.glColor3f(alpha, alpha, alpha); won't work for 2 reasons:
It's opaque. You'd need ...
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 ...
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 ...
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 ...
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 ...
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), ...
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
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...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
transparency × 150unity × 35
opengl × 35
shaders × 23
rendering × 22
textures × 20
java × 10
libgdx × 10
alpha-blending × 10
2d × 9
c# × 8
xna × 8
3d × 8
image × 8
alpha × 8
sprites × 7
graphics × 7
xna-4.0 × 7
opengl-es × 7
depth-buffer × 7
color × 6
android × 5
glsl × 5
tiles × 5
lwjgl × 5