strange transparency

applying the transparency bump diffuse shader, I’m geeting this strangeness which looks like no sorting is being done. The normals are proper.
Any idea how to fix this?

Could be this: http://forum.unity3d.com/viewtopic.php?t=8443&highlight=

Unity (like probably all other engines) does not sort individual triangles on semi-transparent objects - only separate objects are sorted by distance; and then each object is drawn. So for complex concave objects, you can see artifacts like this.

…ever wondered why games avoid semi-transparency like plague? Or if they absolutely need it, they cover objects with bunch of special effects to cover the artifacts?

Are you saying per poly sorting is not supported at all (I would have to redo quite a few critters and re-think how they would be done - hint?) or do I just need to change the sorting mechanism on the shader I use ?

The underlying graphics layers (OpenGL and DirectX or any real-time I’ve seen on a GPU) do not sort polygons. For every object they would have to be resorted in every frame to keep them sorted based on location of the camera as it moves. The pixel shader is not going to give you access to the order the polygon fragments are sent to the shader either. Geometry shaders might be able to do this in the coming years. There just isn’t enough horse power CPU/GPU to handle that kind of thing yet.

So yes, you need to remove the translucency from your objects if you want to avoid that artifact. Its not a unity thing, just a real-time graphics thing. As Aras said you can try to mask it with more visually obvious texture tricks, like a more obvious bump map.

Ricko

Maybe you could do something similar to the Vegetation shader and use AlphaTest to cover up the artifacts. See the documentation

Very nice eagle btw. I have some prey for you :wink:

61663--2259--$prey_123.jpg

I once had a similar problem with an eagle model inside Torque, and the solution was to use two separate materials, with two diferent UVs and two textures: one for the entire body, with no transparency, and other just for the big feathers with transparency, for the wings.

I haven´t tryed yet with Unity, but maybe this could work here too.

Thanks Gus, it works with Unity.

Thanks Metervara, I’ll try dive into shader thing when I’m done with the first pass - and yes the eagle needs food - once I’m through with network rigging it, we could pit the two in a network contest?

Ricko - if Opengl doesn’t sort polygon, how do you explain that Maya and XSI display concave translucent objects properly and that it’s inter-transparent object that’s an issue?

They don’t. I don’t have Maya here to confirm, but I know for a fact XSI has the same transparency issue with real-time previews. In the OpenGL based preview in XSI any “convex” object looks like it is rendered correctly because the back facing polygons are culled, which in essence sorts out the back overlap (any polygon with a face normal greater than 90 degrees from the camera direction is not rendered). Face culling, luckily, is part of the OpenGL pipeline (with hardware support even) but sorting polys is not.

With “concave” objects like your bird of prey it depends on how deep the overlap is or if you are lucky enough for the polygons to be in the depth order from the camera. I can post some character samples from XSI showing the same artifact displayed in your first post in this thread, if you want.

Of course if you meant the ray-traced rendered views in Maya and XSI (like Mental Ray), which I don’t think you meant, then the answer is the polygons are sorted and it is not real-time, and has nothing to do with OpenGL.

That is not to say that you can’t incorporate your own quick sorting algo (box sort) with an OpenGL display, but the sorting is not currently part of the OpenGL pipeline and you definitely take a performance hit doing so with each object. There has been some interesting academic work in the past few years on trying to find ways to fix this with GPU tricks and I think geometry shaders in the coming years may have a shot at it, since you have access to more of the information than you get in a vertex shader or fragment/pixel shader.

Ricko

Maya sorts polygons on the CPU, when you turn on the option (Which by default is off). Obviously sorting each polygon each frame is slow and not a good idea for realtime use.

I see, thanks for the tutorial on real time graphics limitations, that’ll help a great deal in the future.

Anyone undertaking the same fixing venture needs to be careful of import>share materials.

Hmm this thread is probably dead, but replying anyway:

There is a good trick if you want separate characters (like the eagle in the screenshot) to be transparent without artifacts. What you do is render the whole object opaquely to a separate rendertarget, and then draw a semi-transparent billboard with that rendertarget as a texture. The whole scene (objects + rendered billboard) need to be drawn back-to-front. One snag with this is that you won’t get correct zbuffering against opaque objects, unless you also do render-to-zbuffer and use that to set depth values when rendering the billboard. (This requires a readable z-buffer target.)