Planetside Software Forums

General => Terragen Discussion => Topic started by: Dune on November 14, 2018, 07:47:52 am

Title: Twist & Shear issue
Post by: Dune on November 14, 2018, 07: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?
Title: Re: Twist & Shear issue
Post by: Tangled-Universe on November 14, 2018, 12: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 :)
Title: Re: Twist & Shear issue
Post by: WAS on November 14, 2018, 02: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?
Title: Re: Twist & Shear issue
Post by: Matt on November 14, 2018, 04: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.
Title: Re: Twist & Shear issue
Post by: Dune on November 15, 2018, 04: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  ;)
Title: Re: Twist & Shear issue
Post by: Dune on November 15, 2018, 12: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.