Jump to content

Mask edge transition effect


photo

Recommended Posts

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.

Link to comment

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

Link to comment

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.
  

Link to comment

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~_~!

过渡区示意.png

Link to comment

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

 

Link to comment

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. ~_~

过渡区示意1111.png

Link to comment

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 by werner.poetzelberger
Link to comment

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)375326863_.thumb.png.5f8431d3ce891bac0524ebd3f7438bac.png

过渡02.png

Edited by topvip27
Link to comment

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?

Link to comment

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.

image.png

Also I used auxiliary pass shader so I've checked Auxiliary state.

image.png

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.

image.png

And this is the result:

image.png

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

  • Like 2
Link to comment

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);

 

Link to comment
×
×
  • Create New...