Not logged inOpenClonk Forum
Up Topic General / Feedback and Ideas / Display of material behind Objects - Finding a solution?
- - By ala [de] Date 2014-04-09 12:50
Hi,

In recent OC settlement rounds, I was reminded of a problem which always annoyed me. It's the possibility of material ending up behind an object, which cannot be seen by the player. It's especial fatal with small lava puddles behind a vehicle or a building.

Minor annoyance is solid material for example earth landing behind a building from an earthquake - or through a loam bridge which got build. There is also snow of course. But the major threat comes from liquids.

-------------- Finding a solution

--

I talked with Sven about this some weeks ago.

My first suggestion was making liquids semi-transparent and creating it in front of objects. (This would also have been nice for showing the background material behind the water, would probably look awesome), however Sven said that this doubles the landscape calculation and is not a valid option.

--

So my second idea was to make the objects, which are covered, semi transparent. Now, this would work nice for a building under water - but it get's tricky for objects only partly covered in material. Now we'd have transparent buildings shining around, only because of small pixels of earth or water somewhere on the object, also not great.

---

This is where my thoughts are stuck.
So, does anybody have an idea how to solve this problem :)?
Parent - By Clonkonaut [de] Date 2014-04-09 13:06
Do we have any benchmark information on how harmful doubling or quadrupling landscape calculation would be?
Reply
Parent - - By Sven2 Date 2014-04-09 13:08
Why not just create most buildings behind the landscape? It's not just liquids after all, but sometimes solid pixels are annoying as well. This wouldn't require any engine work, but just a different default plane for buildings.

> however Sven said that this doubles the landscape calculation and is not a valid option.


It would require two landscape drawing passes (or some kind of z buffering); not two calculation passes.
Parent - - By Zapper [de] Date 2014-04-09 13:12

>Why not just create most buildings behind the landscape?


Because they would need to be in front of tunnel but behind earth.
Is there a plane that does this? I thought it can be either behind the landscape (also behind tunnel) or in front of everything.
Parent - By Sven2 Date 2014-04-09 13:22
Right, that's not possible yet.

It could be done with z-buffering though (unlike semi-transparent water, which would probably require another pass).
Parent - By Clonkonaut [de] Date 2014-04-09 13:26

> It would require two landscape drawing passes (or some kind of z buffering); not two calculation passes.


Now, how harmful is that?
Reply
Parent - - By ala [de] Date 2014-04-09 13:30 Edited 2014-04-09 13:32

>Why not just create most buildings behind the landscape?


Well would buildings not just simply disappear in a lake? (but for earthquakes it would make sense to see your building literally buried).
Parent - By Sven2 Date 2014-04-09 13:31
Indeed, they would.
Parent - - By Armin [de] Date 2014-04-11 11:22 Edited 2014-04-11 11:28
You can display your semi transparent building and the building which is above the water at the same time. It would only require some lines in CreateConstructionSite to create the same graphic (without being in the background) again. Corrent me if I'm wrong but a 50% transparent layer of a in front of the same building is non-visible as long as there is no lava,water etc.? The only problem I see here is that all building graphics lag like the double amount of construction graphics.
Parent - By Matthias [de] Date 2014-04-11 14:24
Only as long as the graphics itself has no transparency. If, for example, the building has a semi-transparent glass part, it'd be twice as opaque.
Reply
Parent - By Maikel Date 2014-04-09 13:08
Actually materials (or at least the material pixels) could have a Plane like objects, that would mean if I empty my barrel that some pixels could be created with a Plane in front of the clonk and some with a Plane behind the clonk. And the clonk would appear to be in the middle of the water.

I think you always have the problem that the material is either behind or in front of the object.
Parent - - By Pyrit Date 2014-04-09 13:45

>Second idea


You could draw objects behind water, and as soon as there's one pixel of water in front of it, draw a second, semi-transparent image over object in front of the water.
Parent - - By Zapper [de] Date 2014-04-09 15:21
No, anything that is bound to a condition ("if there is water") would not work - it would simply be way too slow to do the checks.
It's either always or never!
Parent - - By ala [de] Date 2014-04-09 16:13

>No, anything that is bound to a condition ("if there is water") would not work - it would simply be way too slow to do the checks.


If I recall this correctly, a "water check" is done anyway. (for swim action stuff or for objects floating up in water).
Parent - - By Zapper [de] Date 2014-04-09 16:30
But if at all, it is probably only done for the center of the object or something. Not for the complete shape
Parent - By Sven2 Date 2014-04-09 16:45
If a big object is submerged halfway, we'd run into problems anyway. Modulating it with water color would look silly for the part that is still outside.

A very cool solution would be a pixel shader that post-processes the drawn landscape+objects according to material. For water, it would modulate and blur the objects. Lava could add bloom.
Parent - - By B_E [de] Date 2014-04-09 17:33
As stupid as it sounds - can't you just draw certain Object categories (C4D_BehindLiquid) behind the liquid, which you could then see if the liquid material was translucent? Then it would also only apply to the submerged parts of the object.
Parent - By Clonkonaut [de] Date 2014-04-09 17:47
That still requires more than one landscape drawing pass, as Sven described above:
1. Draw material
2. Draw objects
3. Draw liquids
Reply
Parent - By Armin [de] Date 2014-04-11 11:33 Edited 2014-04-11 11:55
My idea would be that materials create colored waves and bubbles etc. in the shape of little particles all the time or only when in front of buildings. Imagine a hut which is half in the sea, so you can see some small, blue or white lines passing by. And light yellow bubbles even show the exact surface of lava seas.
Up Topic General / Feedback and Ideas / Display of material behind Objects - Finding a solution?

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill