Jump to content

Fading an object (and its shadows) in and out


photo

Recommended Posts

As I add new objects into a scene I want them to fade in (from full transparent to full opaque) and then fade them out again later. I seem to have achieved the fading effect I'm after by setting blending to Src = "src alpha" and Dest = "one minus src alpha" and then adjusting the alpha value of the material color over time. The problem is that even though the object fades correctly, the shadows stay solid the whole time. I've played around with cast translucence but that adds a funny wavy look to the shadows and still doesn't seem to fade correctly. How can I just get the alpha of the shadows to fade consistently with the alpha of the object casting them?

Link to comment

You can adjust object's far LOD distance on the fly and simulate fading with it. Of course, it would be 'alpha-dotting', but not real 'alpha-fading', but may be one day we'll succeed convincing frustum that in year 2012 we have enough computing power to fade objects instead of inventing own square wheels..

Link to comment
Maybe you have to enable translucent shadows on your lightsource.

To be clear, I did already set that flag on the lightsource, and was able to get translucence working. It just doesn't give the desired effect, like how it applies shadows to the bottom surface when that shadow would usually be obscured by the top surface. Translucence tries to do too much and I don't want all the extra stuff. I just want the shadow to fall the same as it normally would but get lighter as the object becomes more transparent.

 

 

You can adjust object's far LOD distance on the fly and simulate fading with it. Of course, it would be 'alpha-dotting', but not real 'alpha-fading'

I haven't really played with LOD yet, but I had a look at the 'alpha-dotting' in the LOD tutorial and my initial thought was yuck, that looks horrible. That thought was quickly followed with, I still can't tell how the shadows would look in that case, and what happens when I actually want to use LOD for its intended purpose? Good suggestion, but if that's my only option I think I'd rather just put up with the solid looking shadows.

 

I'll be very surprised if there isn't an easy solution to this. Seems like it would be a very common requirement.

Link to comment

We miss alpha fading in LODs switching too (current LOD fade effect looks unusable for us).

In case Frustum will read this topic - it would be very nice to have alpha fading also for delay loaded objects (so that they could appear smoothly).

Link to comment

It's a holy war for the Alpha grail ;)

We understand your reasoning, but I'd try to put forward arguments why things are the way they are with alpha blending in the engine. the biggest problem is, alpha blending is incompatible with deferred rendering. That is a stopper for huge dynamic light optimization. And as lights do tend to kill the performance very often wasting this opportunity is definitely not a good decision.

'Dotted' alpha fading is actually looking very decent, you just need to set up LODs properly and choose reasonable distances. And of course it's exaggerated in the tutorial - if it's not seen, how you are supposed to show what's being tweaked? :( For example, check set up trees in the library - they have dotted alpha fading on trunks and leaves.

Link to comment
For example, check set up trees in the library - they have dotted alpha fading on trunks and leaves.

.. and for example, check 'Trees Of Pangea' SpeedTree 4.0 demo built in 2004 with 100k+ trees looking much better (normal/density maps, realistic wind animations, normal-based lighing, baked shadows, etc.) with alfa faded LOD transitions and 150+ fps on my hardware..

 

Another weird problem is presence of `dots` on still frames - there is always possibility that players stops in some range to the object when it is in half of alpha transition.. and until he moves again, he'll see dotted shadows and objects.

Link to comment
  • 1 year later...

Hi!

have a similar issue.
some z-depth fighting when i blend objects that are on same position.
one object masks the other although alpha is 0
"abusing" LOD fading would be sufficient for now, since i don't use LODs for those objects:

You can adjust object's far LOD distance on the fly and simulate fading with it. Of course, it would be 'alpha-dotting', but not real 'alpha-fading', but may be one day we'll succeed convincing frustum that in year 2012 we have enough computing power to fade objects instead of inventing own square wheels..

but how can i change it on the fly?
is there a way to animate visible distance with tracker?

regards

Phil

Link to comment

We miss alpha fading in LODs switching too (current LOD fade effect looks unusable for us).

In case Frustum will read this topic - it would be very nice to have alpha fading also for delay loaded objects (so that they could appear smoothly).

 

We are also not current using LOD fading, It is usable only for very limited cases. For majority of objects it is too much visible, so LOD "popping" is lesser evil.

Link to comment

i have an asset that needs to be "configurable", so i need to blend in/out different meshes.
using blending with src alpha and one minus source alpha should do the trick,.. but:

1. although alpha is 0 i can still see silhouettes of objects slightly - when skipping problights better,.. but: https://developer.unigine.com/forum/topic/2403-skip-light-prob/

2.them objects seem to mask each other out, can be reproduced with samples/materials - transparent
    if try to move 2 of them angels at same or very close position sometimes issues like that occur,.. only half angel visible...

so using fading like LODs fade would be an option - maybe not the most beautiful, but still it would blend for maybe half a second rather than just popping from one frame to the other, which is a bit weird since them are different meshes with different materials.

 

Link to comment
×
×
  • Create New...