Artifacts show in render

Started by slowandstupid, August 28, 2015, 05:17:55 PM

Previous topic - Next topic

slowandstupid

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
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?

Dune

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.

slowandstupid

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?

slowandstupid

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.

AP

Did you look carefully in that same area inside your photo editor and see anything out of the ordinary?

Dune

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.

slowandstupid

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.

Dune

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.

Oshyan

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

Dune

Speaking of which; if you paint a mask in Photoshop, is that lineair or non-lineair? never thought about that.

AP


Dune

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  :)

Matt

#12
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
Just because milk is white doesn't mean that clouds are made of milk.

Dune

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.

AP

Yes, that is some very interesting information to read upon.