About ready to finish my “hand inside rhino” plugin, but ive hit a snag, the Rhino6 materials which are correctly transparent in regular rendered view turn more opaque in the display conduit. all the other materials in the scene work as expected. Any ideas why?
Video to clarify, see prior to invoking the hardware and after, only the hand “changes” its transparency in the conduit to be about 50% more opaque. Id prefer it stay the same as it was originally, anyway to control that?
@ChristopherBotha Which conduit channel are you drawing your transparent object(s) in?
There is no such thing as “transparency” to a computer, a computer screen, or a graphics card… There is only the human perception that something is transparent. How that perception is accomplished depends on the technique being used. Some techniques are simple and fast, but don’t fool your eye as well, others take a more direct approach that tries to get as realistic results as possible (which is slower, but the results are better).
In order to make something appear transparent on the screen, you have to “blend” the transparent color with the background color… That requires the two following things to be true:
- All objects that will appear “behind” the transparent object MUST be drawn before the transparent object.
- All transparent objects MUST be drawn in a specific order so as not to interfere with themselves or other transparent objects. For example: Draw all transparent objects from furthest to nearest order…also known as “The Painter’s Algorithm”.
Now, it’s possible that there’s just a bug in Rhino, and the materials are getting messed up due to some caching bug… Or… It’s possible that you’re drawing things in the wrong channel, and messing up the requirements for achieving the transparency effect.
That being said… Rhino doesn’t provide a very good way for doing this from a plug-in perspective (unfortunately)…mainly because of the special requirements I listed above…(the real big problem is the one where “transparent objects interfere with themselves”, which I won’t go into here). The only provision for a plug-in is that you can specify “when” your objects get drawn. Since transparent objects must be drawn last, and in a specific order, that means you cannot draw them in the SC_DRAWOBJECT channel…it also means you cannot draw them in the SC_PREDRAWOBJECT channel…basically, you cannot draw them before or during the time when Rhino is drawing all other objects… That means a channel like SC_POSTDRAWOBJECTS is probably the best place to draw them… Rhino will handle the “interfere with themsleves” problem for you, but will not handle the order… If you’re drawing more than one transparent object, then it is up to you to make sure you draw them from farthest to nearest order, relative to the camera. Long winded reply for just saying “Draw in a post draw channel” I know…but I felt it necessary to explain why you need to rather than just blindly tell you.
So given all of that… If you are already drawing in a post draw channel, then I’m probably going to need a small snippet of code that demonstrates what it is you’re doing, so that I can watch when and why Rhino is messing up the material.
its in predraw right now, Ill move to post draw and give some feedback. Thank you for the breakdown of the process.
Ha! win and loose in post draw. Better transparency on the hand, but in the opposite direction now, no transparency when more than one layer of the mesh is in front of the ring, ill stick to predraw, its close enough, many thanks for the help