Author Topic: Twist & Shear issue  (Read 259 times)

Offline Dune

  • Member
  • *
  • Posts: 15127
    • www.ulco-art.nl
Twist & Shear issue
« on: November 14, 2018, 11:47:52 AM »
If I have a twist and shear shader before a compute terrain, the displacement is not properly calculated for pops (image 1). If I disable the T&S pop is allright (2). But I needed the wall to have a less steep angle locally, so I added the T&S after a compute terrain. Then the pop was calculated allright (image 3).
But I don't know why the T&S shader isn't calculated properly... bug?

Offline Tangled-Universe

  • Terrevangelist
  • *
  • Posts: 6183
    • CGScenery.com - Terragen Tutorials!
Re: Twist & Shear issue
« Reply #1 on: November 14, 2018, 04:21:14 PM »
Seems like the shearing displaced the coordinates horizontally almost exactly the size of your population square, hence there's only a little row of instances present. I wonder if a lower lean factor in example 1 would cause a proportional shift of the population or whether it would 'snap' into the boundaries suddenly, like it does in example 3 when it's after a compute node.
If there's snapping behavior then perhaps there's a bug somewhere, but for now I tend to say you're doing a whole bunch of complex stuff before even computing anything and it's simply going haywire.
In a simple setup there are no issues with the T&S shader versus sampling populators, I just checked that.
All I can think of is that sometimes, when using large terrains with large altitude differences, the 3D preview draws a rectangle in the UI while the coordinates are actually somewhere else. So you think it's in the correct place, but it actually isn't.

The screenshots are impossible to interpret as there's so much going on.
Several surface layers as holders for displacement functions with certain displacement factors we don't know, neither displacement type, slope/altitude key etc. etc.
Not to mention the clutter of nodes which are also typical for my own works as well :P but very hard to understand for someone without a similar brain :)

Offline WASasquatch

  • Member
  • *
  • Posts: 3225
Re: Twist & Shear issue
« Reply #2 on: November 14, 2018, 06:33:59 PM »
Would using a Compute Normal with a small patch size help? I imagine with a patch size of 20, and that following geometry, it may cause issues?

Online Matt

  • Planetside Staff
  • *
  • Posts: 3545
  • I'm the crazy one
Re: Twist & Shear issue
« Reply #3 on: November 14, 2018, 08:37:53 PM »
The lateral displacement caused by the Twist and Shear shader is laterally displacing the instances too. It seems to be behaving correctly, except that it seems to be culling instances that end up outside the box for some reason. The culling is probably a bug. Is it like this when rendered?

The difficulty is that the bounding box of the population creates initial undisplaced positions for the instances by projecting vertically from the bounding box. This produces predictable results when the terrain is displaced vertically. In your case your displacement is at a 45 degree angle or so. The populator’s bounding box doesn’t know this. The instances are displaced correctly, but from an unintuitive initial position.

Try rotating the populator area so that the pop’s “downwards” projects down towards where the instances originate, and I think you should see more instances placed within the bounding box.
« Last Edit: November 14, 2018, 08:40:23 PM by Matt »
Just because milk is white doesn't mean that clouds are made of milk.

Offline Dune

  • Member
  • *
  • Posts: 15127
    • www.ulco-art.nl
Re: Twist & Shear issue
« Reply #4 on: November 15, 2018, 08:06:31 AM »
I will try rotating. I've overcome the problem by adding the T&S after computing for the pop, but the instances might float then, due to the lateral shift of terrain after it. Haven't checked that.

Less T&S is indeed giving more instances, Martin.

This is a complicated setup anyway, needing a river eat away at a bank, but the bank may not be steeper where it's eaten away, but I still needed to subtract the river from the bank to get the depth there, hence it's initial steepness... and it needs to have an undercut too where the bank is eroded. And all procedural, a mask would probably have made it easier. Or warp the bank by the river may have worked, but I didn't want to change the whole setup, and didn't want to have similar curves in river and bank.

Enough to keep the brain from falling apart, anway  ;)

Offline Dune

  • Member
  • *
  • Posts: 15127
    • www.ulco-art.nl
Re: Twist & Shear issue
« Reply #5 on: November 15, 2018, 04:12:25 PM »
I found a better solution, move the cliff eastward locally by soft altitude, instead of warping. No strange displacements on top either and pops just fine.