Jump to content

Distance controlled transparency


photo

Recommended Posts

Posted (edited)

Hello,

Is it possible to have an alpha-blended material whose transparency multiplier/transparency pow are controlled by the distance to the camera?

  • Can we write an expression in the surface material parameters with the camera distance as an input?
  • Or should I go with a new shader? (but how to get the eye distance?)

(note: this is for a loooong cable material. I tried using the LOD fade but the result is not convincing, the transparency+wire inflation turns out really better in the distance)

Thanks!

Edited by Amerio.Stephane
Posted

Hi Stephane,

You can control all of the material parameters via code (C++ / C# / UnigineScript), so you simply need to write a custom logic that will change transparency multiplier based on some calculated value. No additional shader is required.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted

Hi Silent,

I already though about this, but I fear this could be too costly (not tested, though). I have more than 10.000 cables. Won't adding a component/update for each of them be too much?

(I'll try, nothing beats manual timing in the end)

Thanks!

Posted

If these meshes are identical you can use MeshCluster to increase the performance a bit. You also can perform visibility checks per object group and spread the 10.000 objects update for 60 or more frames to reduce the overall peak load.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted

Sounds like some fragment-shader-based approach could both provide muuch better quality (per-pixel distance fade) and performance (batching 10000 instances using same cable material into much fewer batches)

×
×
  • Create New...