Planetside Software Forums

General => Terragen Discussion => Topic started by: slowandstupid on August 28, 2015, 05:17:55 PM

Title: Artifacts show in render
Post by: slowandstupid on August 28, 2015, 05:17:55 PM
Back again with a new question.

I had my previous question answered here: http://www.planetside.co.uk/forums/index.php/topic,20434.0.html (http://www.planetside.co.uk/forums/index.php/topic,20434.0.html)
I now have adjusted my terrain with an image shader as documented in the other post. Now I am seeing an issue with some artifacting showing up in my renders and not sure how to correct for it. I've included a picture below.

I have tried adjusting my image to create both steeper and shallower slopes at these areas to see if it makes a difference and am still seeing the issue. Any thoughts?
Title: Re: Artifacts show in render
Post by: Dune on August 29, 2015, 03:02:54 AM
Nasty lines, I can't really tell what's happening there. Does it have to do with the image map? Perhaps the black edges (if you painted white on a black screen) aren't really black; you could try masking the edges of the image map shader by 0.05 or so. Or change the color from convert to lineair to is lineair.... just some guessing.
Title: Re: Artifacts show in render
Post by: slowandstupid on August 29, 2015, 09:28:21 AM
Ok will take a look at that. If I change from convert to linear over to linear what does that actually do? What is the convert to linear option doing for the shader?
Title: Re: Artifacts show in render
Post by: slowandstupid on August 29, 2015, 11:08:47 PM
Well I do suspect it has something to do with the image map as they were not there before applying it. Unfortunately both suggestions above did not affect it.
Title: Re: Artifacts show in render
Post by: AP on August 30, 2015, 12:00:15 AM
Did you look carefully in that same area inside your photo editor and see anything out of the ordinary?
Title: Re: Artifacts show in render
Post by: Dune on August 30, 2015, 02:44:57 AM
I don't know exactly what the lineair conversion does, but it has to do with the way black and white is distributed along the curve. Check out changing the 2.2 if you convert; if you make it 4 or 1 there's quite a difference in what comes out of the image map. Is you map 8-bit or 16-bit? For (larger) displacements a 16-bit map is better, because with 8-bit you only have 256 steps from black to white. 256 steps is good enough for a few meters though.
Title: Re: Artifacts show in render
Post by: slowandstupid on August 30, 2015, 09:10:30 AM
I'm not seeing anything out of the ordinary in the photo editor. I tried switching to a 16-bit tiff but am not seeing any improvement.
Title: Re: Artifacts show in render
Post by: Dune on August 30, 2015, 11:13:53 AM
A last shot; do you have displacement intersection on? That sometimes causes strange artifacts if coupled with slope or altitude constrictions. Otherwise I wouldn't know.
Title: Re: Artifacts show in render
Post by: Oshyan on August 30, 2015, 01:02:05 PM
It's very hard to see what's going on in that image. It looks like displacement discontinuities due to noise or unusual values in the image map in those places. After you switch to 16 bit in your image editor try doing a simple Blur filter, then export the result and see if it changes the artifacts.

Regarding linear color mapping: http://www.qvolabs.com/Digital_Images_ColorSpace_Log_vs_Linear.html
Generally speaking you want to have an understanding of how your source data was created/mapped, in a linear or nonlinear way, and then use the same setting in Terragen.

- Oshyan
Title: Re: Artifacts show in render
Post by: Dune on August 31, 2015, 03:48:02 AM
Speaking of which; if you paint a mask in Photoshop, is that lineair or non-lineair? never thought about that.
Title: Re: Artifacts show in render
Post by: AP on August 31, 2015, 04:05:03 AM
I think you can do both but i found some links.

Photoshop CS6 Tutorial - 66 - Linear vs. Non-linear

https://www.youtube.com/watch?v=EvmkPDmJMGY


http://pixinsight.com/forum/index.php?topic=4055.0


http://scanline.ca/nlm/examples.html
Title: Re: Artifacts show in render
Post by: Dune on August 31, 2015, 04:25:24 AM
Interesting, but I still don't understand (these are all processes, I guess); if you make a black square and paint in white, is it lineair or non-lineair?

Sorry about the temporary hijack, SlowandStupid  :)
Title: Re: Artifacts show in render
Post by: Matt on August 31, 2015, 01:09:11 PM
If you're painting a mask, then the only thing deciding whether it's linear or non-linear is you. It depends on what your intentions are. If you are working with an 8-bit image and you paint a value of 127 or 128 with the intention that it will be exactly half of 255, then you intend the values to be linear and you should tell Terragen to read it in as linear.

The usual reason to choose non-linear is if you're creating a colour image where the values should be turned directly into some kind of light intensity, e.g. a colour texture, or a background image, or maybe if you're working on a specularity map. Basically anything where bright parts of the image should produce bright parts of the rendered image, and dark should produce dark. Why? Because when you paint 127 or 128 in Photoshop, the light produced by your monitor is much less than half of what it produces when you paint 255. Terragen's renderer likes to work in linear space (like photons in the real world), so if it reads the image as linear then it will think that 127/128 should be about half as bright as 255. But this is not what you saw on your monitor on Photoshop or any other 8-bit image viewer. So if you want that 128 pixel to look the same in the final render, you tell Terragen that the image has a gamma of about 2.2. When using an 8-bit photograph as a texture, you almost certainly want to do this. The exact value should really depend on lots of different factors, but 2.2 is a reasonable approximation. You can adjust it to make it look more how you want.

Going back to the example of a mask. Masks might be turned into a displacement magnitude, or control the mixing of two colours, or anything else that isn't supposed to map directly from dark to bright. If you're painting the mask yourself, the choice of linear or non-linear might be something of a personal preference. If you've got used to how masks work with Terragen's default image map settings - which treat the image as non-linear - then there isn't anything wrong with that, but it means that if you invert the image in Photoshop it will be different from inverting it in the shader so you need to be aware of that. And it means that a linear gradient in Photoshop won't produce a linear slope when converted to displacement.

No matter whether you choose linear or gamma space, black is always black and white is always white. The gamma conversion affects values that are somewhere between these two extremes. Well, it also affects values brighter than white, but those can only occur when reading in EXR (or whatever other HDR formats Terragen might support in future), not when working with 8-bit or 16-bit non-EXR images.

Matt
Title: Re: Artifacts show in render
Post by: Dune on September 01, 2015, 03:13:33 AM
Thank you, Matt. I didn't really realize this, working more by intuition. I do a lot of masks, so I have to take this knowledge into account.
Title: Re: Artifacts show in render
Post by: AP on September 01, 2015, 05:41:25 PM
Yes, that is some very interesting information to read upon.
Title: Re: Artifacts show in render
Post by: bobbystahr on September 02, 2015, 11:25:23 AM
Thanks Matt, great information....
Title: Re: Artifacts show in render
Post by: bobbystahr on September 02, 2015, 11:27:09 AM
Quote from: slowandstupid on August 29, 2015, 09:28:21 AM
Ok will take a look at that. If I change from convert to linear over to linear what does that actually do? What is the convert to linear option doing for the shader?

One option for help would be to upload the .tgd and dependant image files...sometimes a problem is more solvable with all the information to hand....