Planetside Software Forums

General => Terragen Discussion => Topic started by: Hannes on October 13, 2020, 01:33:36 AM

Title: Object procedural texturing issue
Post by: Hannes on October 13, 2020, 01:33:36 AM
I don't know, if this was mentioned before. At least I couldn't find something.

In some of my attempts of creating new shaders I found that using procedural breakup or masking can create weird faceted artifacts on the shaderball object (I ran it through Poseray first and recalculated normals). See image below.
The two shaderballs on the left have "use smooth normals" checked, the two on the right have it unchecked. So unchecking it makes the PF look good, but the object itself is faceted, which is of course not good.
This happens with other imported objects as well, no matter if it's an obj or a tgo.

Is there any workaround for that?
I attached the file for testing it.
Title: Re: Object procedural texturing issue
Post by: Dune on October 13, 2020, 03:09:27 AM
Maybe it's a bug, since the new feature in the latest version that can recalculate normals in TG. I hope Matt will chime in here...
Title: Re: Object procedural texturing issue
Post by: Hannes on October 13, 2020, 03:32:24 AM
Thanks Ulco! I tested the file with an older version, and it's the same. Yes, hopefully Matt can shed some light on this.
Title: Re: Object procedural texturing issue
Post by: Dune on October 13, 2020, 04:24:59 AM
So it's not that >:(  I'll download your stuff and have a look...
Title: Re: Object procedural texturing issue
Post by: Hannes on October 13, 2020, 05:04:00 AM
Thanks a lot, Ulco! Much appreciated. :)
Title: Re: Object procedural texturing issue
Post by: Dune on October 13, 2020, 06:31:44 AM
Confirmed. And it's both in standard renderer as in PT. And also in version 4.38 before introduction of smoothing options. Bug, I suppose. Strange that I never noticed it in my people and stuff. Have to check that out as well!
Title: Re: Object procedural texturing issue
Post by: Hannes on October 13, 2020, 06:38:39 AM
Thanks again, Ulco!!


Quote from: Dune on October 13, 2020, 06:31:44 AMStrange that I never noticed it in my people and stuff.


Yes, I didn't notice this as well... :(
Title: Re: Object procedural texturing issue
Post by: Dune on October 13, 2020, 07:46:29 AM
Just tested one of my employees, and it looks normal :P  So maybe it's the shaderball? My tgo has not been taken through PR, as normals were already okay. The guy had no bump and just a procedural surface texture from PF and transform to world.
Title: Re: Object procedural texturing issue
Post by: Hannes on October 13, 2020, 07:53:03 AM
Weird! I have to do some tests as well...
Title: Re: Object procedural texturing issue
Post by: WAS on October 13, 2020, 01:34:36 PM
Distort by normal doesn't understand object normals well is my guess. Happened on my pop rocks too, I just turned down distort by normal to 0.25
Title: Re: Object procedural texturing issue
Post by: sboerner on October 13, 2020, 04:30:33 PM
Confirmed here, too. I took a look at your shader ball model and couldn't find anything wrong with it. When I substitute a simple sphere OBJ in your file I get the same result, both standard and PT renderers. And it shows up in the RTP as well. Strange that this hasn't been noticed before.
Title: Re: Object procedural texturing issue
Post by: Hannes on October 13, 2020, 04:43:57 PM
Quote from: WAS on October 13, 2020, 01:34:36 PMDistort by normal doesn't understand object normals well is my guess


Thanks, Jordan, you are right. Disabling "distort by normal" makes the faceted stuff go away, but of course it doesn't look the same. Not at all! Hmm, I have to do a lot more tests I guess...

Quote from: sboerner on October 13, 2020, 04:30:33 PMConfirmed here, too. I took a look at your shader ball model and couldn't find anything wrong with it. When I substitute a simple sphere OBJ in your file I get the same result, both standard and PT renderers. And it shows up in the RTP as well. Strange that this hasn't been noticed before.
Thanks Steve. Too bad...
Title: Re: Object procedural texturing issue
Post by: WAS on October 13, 2020, 05:23:42 PM
Curious if this is possible with a more densely subdivided object? Impractical, but maybe that's the issue. Seems to want to read the polygon edges.
Title: Re: Object procedural texturing issue
Post by: WAS on October 13, 2020, 06:11:28 PM
Yeah, seems when the polygon count is high enough, normals are fine for the most part. Though this couldn't be subdivided more without Poseray crashing. Lol
Title: Re: Object procedural texturing issue
Post by: Dune on October 14, 2020, 01:36:44 AM
Distort by normal isn't what I usually use on object texturing (only on planet stuff), and in fact I often decrease it considerably or turn it off in breakup shaders (along with the strong warp). So, I hadn't thought of that (didn't check your insides either, Hannes :P )
But it's not good if that's indeed the culprit.

On another note; I also wondered if the automatic recalculation of normals shouldn't be to off as default. I don't actualy know if it is (will check later), but I often recalculate my normals in Poseray carefully for each part, and don't need it messed up by an average recalculation (no offence for the feature).

EDIT: I think I got it; it only recalculates after a mesh displacer has been added. So does nothing if just importing?
Title: Re: Object procedural texturing issue
Post by: Hannes on October 14, 2020, 05:01:57 AM
Thanks, Jordan and Ulco!

Here is something I'm working on at the moment: a worn and rusty painted metal material.
On the left shaderball I unchecked "use smooth normals" to get the unfaceted look of the power fractal. Unfortunately the object is faceted. Not too obvious, but visible.
The right shaderball has the same texture applied, except "Distort by normal" unchecked, and apart from that I made the smallest scale of the PF even smaller, because the blotchy shapes in the shader to the left, which looked very good to me, were too even and looked really bad without distortion.

I really like the look on the left object. It looks more like paint. The shader of the right object looks more like a weird planet surface.

Btw I sent a bug report about that.
Title: Re: Object procedural texturing issue
Post by: WAS on October 14, 2020, 01:06:34 PM
Yeah the distort by normal definitely gives a better look in this case. More paint like.
Title: Re: Object procedural texturing issue
Post by: Hannes on October 14, 2020, 01:10:36 PM
I increased the smallest scale again a bit, and I think it's a nice compomise. I'll put it into the file sharing section.
Title: Re: Object procedural texturing issue
Post by: Matt on October 14, 2020, 04:14:09 PM
Quote from: Dune on October 14, 2020, 01:36:44 AMOn another note; I also wondered if the automatic recalculation of normals shouldn't be to off as default. I don't actualy know if it is (will check later), but I often recalculate my normals in Poseray carefully for each part, and don't need it messed up by an average recalculation (no offence for the feature).

EDIT: I think I got it; it only recalculates after a mesh displacer has been added. So does nothing if just importing?

"Recalculate normals" on the object's Mesh Modifiers tab only applies when it's applying a mesh displacer or an MDD file, otherwise it does nothing. Even when it is used, some of the options preserve some characteristics from the original file's normals and don't necessarily smooth everything: https://planetside.co.uk/wiki/index.php?title=OBJ_Reader#Mesh_Modifiers_Tab
Title: Re: Object procedural texturing issue
Post by: Matt on October 14, 2020, 04:31:12 PM
There is a known issue with "Distort by normal" on imported objects. At the moment it relies on the underlying geometry to be smooth as it is with the built-in displaceable objects (e.g. Planet, Cube etc.) but that isn't true with imported polygon models so it produces discontinuities.
Title: Re: Object procedural texturing issue
Post by: WAS on October 14, 2020, 06:41:41 PM
Quote from: Matt on October 14, 2020, 04:31:12 PMAt the moment it relies on the underlying geometry to be smooth

Which makes sense high poly models seem to look fine, as those polygons are so dense you can't see any continuity issues. I don't get any of these issues on the same shader ball I shared years ago on the high poly version I exported.

Seems the industry is moving away from "low poly" objects anyways, even in Unreal Engine with dynamic mesh poly calculation based on z depth. UE5 expects as high as poly objects as possible.
Title: Re: Object procedural texturing issue
Post by: WAS on October 14, 2020, 06:53:28 PM
Zooming in on the object you can barely make out the problem issue. Though this couldn't be subdivided anymore [in poseray, a proper 64bit application may be able to] so a real fix would be prudent.
Title: Re: Object procedural texturing issue
Post by: Hannes on October 15, 2020, 01:15:22 AM
Thanks, Matt and Jordan!! :)
Title: Re: Object procedural texturing issue
Post by: Hannes on October 15, 2020, 01:29:02 AM
Seems the facets are still there, even when "Distort by normal" is unchecked, as long as "Lead-in warp effect" is not set to "None".
Probably for the same reason.
Title: Re: Object procedural texturing issue
Post by: Dune on October 15, 2020, 04:37:30 AM
Thanks Matt! And sorry for not reading up beforehand :P 
And your compromise looks good, Hannes.