Author Topic: Displacement not working correctly, geometry skews  (Read 1350 times)

2023-01-03, 17:36:31

steyin

  • Active Users
  • **
  • Posts: 375
  • BALLS
    • View Profile
    • Instagram Page
I'm using Corona 8 HF 2, and while trying to use displacement, the geometry is skewing upward instead of projecting out straight as it should be. I can't find any reason as to why this is happening. Attached is a test with a basic checker map applied to a box (all segments set to 1) and UVW set to real world scale; same result whether using it as a map in the material or with the displacement mod.

I've tried different world space settings, changing the screen size, using different maps, etc. Same results/error every time.
Thanks in advance for any help.

2023-01-03, 17:58:23
Reply #1

steyin

  • Active Users
  • **
  • Posts: 375
  • BALLS
    • View Profile
    • Instagram Page
I tried with setting the Screen (px) setting to .1 in the override, which produces a near correct result but results in a memory error (this machine has 40 gigs), For a mere box to not displace normally at 1 px seems absurd. My coworker sitting next to me is using Vray and their displacement mod and has no issues with clean displacement doing the same.

Something is screaming wrong here to me.

2023-01-03, 18:54:46
Reply #2

BardhylM

  • Active Users
  • **
  • Posts: 56
    • View Profile
    • Behance
It is how it works in Corona, as I think the displacement is projected from the middle of the polygons or something like that.
You can add some supporting loops near edges, chamfer edges or split edges around object where you want straight displacement (perpendicular to the surface).
As why is it like this, it has been discussed here a while and you can find topics that explain this I think.
It is the simplest way of doing displacement and it works in most of the cases, until it is found a new "revolutionary" way of dealing with it.
Hope it helps a little!

2023-01-03, 19:41:01
Reply #3

steyin

  • Active Users
  • **
  • Posts: 375
  • BALLS
    • View Profile
    • Instagram Page
I had to add a tessellate modifier set to operate on polygons/edge, tension of .0001 and 4 iterations to get the desired result. I link in 3D geometry from AutoCAD so this seems to be the easiest way to deal with this. Not perfect, but enough.
I just don't understand why VRay has no issues/needs no additional geometry/tessellation, etc. One would think being under the same roof now that Corona could implement the same strategy/coding.

2023-01-04, 09:39:26
Reply #4

philipbonum

  • Active Users
  • **
  • Posts: 73
    • View Profile
This is indeed a bit of a iffy workaround, but maybe it's because Corona fixes the edges of the cube, ie no holes between the sides?

I can't double check with V-Ray since it doesn't have an infinite demo version with watermark, so:
I see that in FStorm it only makes this fix if the smoothing groups of the object are set up that way. Maybe Corona should have a switch somewhere where you could change how you want it to behave? Since it doesn't seem to respect the smoothing groups in the same way

Talking about this specific displacement example, how do people fix the jagged displacement from Corona without maxing out their RAM? It's a headache trying to get clean looking edges(see attached). I have to bring screen size all the way down to 0,2 px, and then it uses like 8GB of RAM and adds 5 seconds before it shows up in the VFB.

Are there any plans to improve the displacement? I'm not sure if you could "steal" something from FStorm, but that displacement is clean, fast, and barely registers on the VRAM

2023-01-04, 10:41:54
Reply #5

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8856
  • Let's move this topic, shall we?
    • View Profile
    • My Models
I see that in FStorm it only makes this fix if the smoothing groups of the object are set up that way. Maybe Corona should have a switch somewhere where you could change how you want it to behave? Since it doesn't seem to respect the smoothing groups in the same way

Corona displacement used to work like that many years ago and there were much more complaints about that, than there is about current behaviour.

Talking about this specific displacement example, how do people fix the jagged displacement from Corona without maxing out their RAM? It's a headache trying to get clean looking edges(see attached). I have to bring screen size all the way down to 0,2 px, and then it uses like 8GB of RAM and adds 5 seconds before it shows up in the VFB.

Can't speak for others, but i tend to keep my expectations realistic and not expect perfectly perpendicular displacement to look smooth like butter. Maybe that's because i don't have much experience with other advanced renderers. Anyway, small blurring of your displacement maps can make a huge difference in displacement quality.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2023-01-04, 10:49:17
Reply #6

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8856
  • Let's move this topic, shall we?
    • View Profile
    • My Models
Random idea for the devs, maybe Corona could cheat somehow, by modifying normals of displaced geometry so that sharply displaced faces would have their normals averaged, to help hide those jaggies. The bigger difference in grey values between adjacent pixels in displacement texture, the more averaged normals would have to be on corresponding displaced faces. Not sure how feasible this would be technically.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2023-01-06, 10:14:28
Reply #7

Aram Avetisyan

  • Corona Team
  • Active Users
  • ****
  • Posts: 561
    • View Profile
I'm using Corona 8 HF 2, and while trying to use displacement, the geometry is skewing upward instead of projecting out straight as it should be. I can't find any reason as to why this is happening. Attached is a test with a basic checker map applied to a box (all segments set to 1) and UVW set to real world scale; same result whether using it as a map in the material or with the displacement mod.

I've tried different world space settings, changing the screen size, using different maps, etc. Same results/error every time.
Thanks in advance for any help.

Hi,

You most probably need to check the smoothing/normals of the object. Displacement in Corona takes into account the surface normals, so if you create a plane and rotate its normals, displacement will happen in that direction. See attached image.
On a simple box, yes, that is how Corona works, it will skew the displaced surface towards the edges, and it is to keep the continuity of the displacement. Think of it as normals being gradually bent to 45 degrees from polygon center, when using 1 subdivision for each side. If you detach the faces, you will see no distortion. The workaround in your case may be to increase the segments.
VRay handles this case of 3D displacement in a similar manner, the same skewing effect can be seen there as well.

It is generally a good practice to have a optimally dense enough mesh for displacement.
Aram Avetisyan | chaos-corona.com
Chaos Corona Support Representative | contact us

2023-01-06, 16:18:27
Reply #8

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 12768
  • Marcin
    • View Profile
Which behavior looks most "correct" to you? :)

Also, if we would calculate displacement "straight" without interpolating between normals, then what would a corner of a brick wall look like, even if it was high-poly and with correct uvw mapping?
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us