topvip27 Posted November 9, 2020 Posted November 9, 2020 How to use a plane or a three-dimensional object as a mask when the edge has a gradual transparency effect. This effect is not mix of A and B, just a transparency gradual effect on the edge of A/B itself.
rohit.gonsalves Posted November 9, 2020 Posted November 9, 2020 Dear @topvip27, The question seems that you are talking about transition and mixing. But the description above is incomplete to understand what you need? Please elaborate more with images and effect you want. Probably this will help to understand and solve your problem. Rohit
topvip27 Posted November 10, 2020 Author Posted November 10, 2020 The B edge gradient in the picture below is a transparent alpha channel change, B has nothing to do with the colors of A/ C/D, how to achieve this rendering effect?
werner.poetzelberger Posted November 10, 2020 Posted November 10, 2020 In the Material under Common>Transparency Alpha blending. Or you can use Alpha Test with Dithering. There are even more blending possibilities like add or multiply. Be aware, that Alpha Blending relies on 'sorting'. Its kind of 'Layering objects' for the blending. Is this what you are looking for? Best.w.
topvip27 Posted November 11, 2020 Author Posted November 11, 2020 Thank you for reply. This question is not a simple mixing. Please look at the picture below. What I need is the red area to achieve the effect of picture B above. I don’t know how to achieve it~_~!
rohit.gonsalves Posted November 11, 2020 Posted November 11, 2020 Dear @topvip27, To achieve such result, you may use a texture with transparency of varying alpha and apply to this material. You will get such result. Using Abledo Color and alpha will be applied to every pixel and you will not have gradient alpha. You can have Gradient alpha texture prepared in photoshop or another editor and use it in texture. Other settings seems correct and will give you desired result. Rohit
topvip27 Posted November 11, 2020 Author Posted November 11, 2020 Thank you Rohit. Take a look at this picture. It is a transition from A to B, but white is used for the transition. The effect I want is to use the Alpha value of A to transition to B. I don’t need white C for the transition. ~_~
werner.poetzelberger Posted November 11, 2020 Posted November 11, 2020 (edited) Hmm. I dont see an issue with that as far as I understand this (although your image is hard to read). So you have a cube, and the edges should be transparent, right. If you use the texture you have C it wont work as alpha channels are white = opaque, black = transparent, so you need to invert the alpha channel. Then set the ONLY the material you want to be transparent to ALPHA BLEND. You should also not mess around with the rendering order as long as you dont want to achieve a special effect, leave it at default. The most convenient option IMO would be: Use a Dithered Gradient in the alpha channel C (from white to black), then use ALPHA TEST. This uses only 0 and 1 values for the alpha values, BUT it respects the render order at all time in your scene, no matter which elements else you use. A tip: If you want to make sure, that you get what you design, dont use DXT compression (or be sure, what DXT1, DXT3 DXT5 is!) but use a 8.8.8.8 dds instead. And be aware of MIPMAPPING! Best. Werner Edited November 11, 2020 by werner.poetzelberger
topvip27 Posted November 12, 2020 Author Posted November 12, 2020 (edited) Dear Werner, I am not using one box, but three plane. The effect I want to achieve is the first picture. (I use Adobe Photoshop simulation) Edited November 12, 2020 by topvip27
werner.poetzelberger Posted November 12, 2020 Posted November 12, 2020 What is this image on the planes? A Projection? If you can tell the bigger picture, maybe we can find a way: Best.w.
topvip27 Posted November 13, 2020 Author Posted November 13, 2020 The three planes are used as masks. The image is a projection or a camera signal or the bottom image
werner.poetzelberger Posted November 13, 2020 Posted November 13, 2020 Do you want to use these masks in a 3D space or is your desired result a pure 2D overlay. Do you try to achieve a simulation of a 'mapping', projecting onto geometry?
topvip27 Posted November 13, 2020 Author Posted November 13, 2020 I use it in a 3D space, I use CAVEMESH to display the contents of the three planes, to achieve the effect of the picture
andrey-kozlov Posted November 13, 2020 Posted November 13, 2020 Hello @topvip27, Here's my approach. I rendered those planes into a separate buffer. Then I blurred that buffer to get smooth transition. After that I applied that buffer to a post-processing pass to make the final image. I don't need these planes to participate in the main rendering pipeline so I've masked them with the zero viewport and shadow mask. Also I used auxiliary pass shader so I've checked Auxiliary state. All the logic is implemented in a scriptable material. You can attach it to scriptables materials and the logic should work even in the editor. And this is the result: Materials are attached, drop them to /data folder. But you need replace these lines with your own objects Object plane = node_cast(engine.world.getNodeByName("Plane")); Object plane1 = node_cast(engine.world.getNodeByName("Plane_1")); Hope it helps! mats.zip 2
rohit.gonsalves Posted November 13, 2020 Posted November 13, 2020 Dear @andrey-kozlov, Are these Scriptable material from 2.13? Rohit
andrey-kozlov Posted November 14, 2020 Posted November 14, 2020 Hello Rohit, I totally forgot that editor integration is a nice new feature of 2.13. It's a small spoiler then. Will be delivered soon. But scriptable materials themselves were implemented a couple of releases ago. To see my material in action in Play Mode you need to execute this code somewhere on world init: var mat = Unigine.Materials.FindMaterial("example_mat"); Unigine.Render.AddScriptableMaterial(mat);
Recommended Posts