Questions for efficient shading practices

Started by FlynnAD, March 13, 2012, 03:08:14 PM

Previous topic - Next topic

FlynnAD

Hi all,

I'm looking for generally good and efficient practices in workflow in several areas:

1) How does the painted shader work exactly: If I paint at a far distance, are the triangles kept "large" and so there's not that much painted data yet if I zoom in the data will be "choppy" because the triangle are large;
OR does TG2 scale any large painted shaders as you zoom in;
OR does TG2 save your painted shaders at a small scale to begin with, meaning that if you paint over vast areas from far away you're saving huge amounts of data?

2) In general, is it more computer-resource efficient to have many painted shaders or many individidual grayscale image maps that act as blend shaders? E.g., if I have 20 painted shaders in one TG2 file, that TG2 file size increases. However, if I have 20 painted image maps from Photoshop (reasonably sized), all those 20 image maps are small individual files and don't bulk up a single TG2 file. I probably have greater flexibility in painting in PSD as well. However, does one method take longer to load, or to render, or to other, using one method or the other?

3) In general, while knowing that there are lots of situations where you may want a specific look that requires a specific node path, is it more efficient to have "simple" surface shaders stacked, OR massively combined color/displacement shaders tied into a very few surface shaders? In other words, I could have a color power fractal input into another PF, into another PF, into another PF, all with their own blend shaders, then finally tied into a surface layer;
OR I could put one color PF into one surface shader, then tie that surface shader into a second surface shader which only has one color PF as well, then on and on. Is one method more efficient than the other during processing or rendering?

Thanks,
-Matt

Tangled-Universe

Hi Matt,

1) I seriously have no idea.

2) If you look up the maze topic in general discussion you can read that painted shaders can slow down TG2 quite a lot. So I tend to advice to use imagemaps when you can.
Of course, if you have the time and feel up to it; you can test this yourself.

3) I'm not sure if it would make much a difference in processing power. Well, powerfractals are procedural elements so likely the more you have of them the longer it takes to calculate.
The number of surface layers you need depends on how many layers of surface you want to simulate ;)
What people usually do, I think, is making a surface layer for each surface element (like mud, sand, soil, rock) and then add some powerfractal(s(tacks)) or surface layers to it as child layer.

jo

Hi Matt,

1) The painted shader is entirely procedural. The strokes are essentially made up of many spheres, or blobs of paint. Each stroke is continuous from beginning to end. If you are painting fast or a long distance away you may initially see the stroke as a series of disconnected blobs. However the stroke is interpolated between those blobs and filled in so it's continuous. There is a limit on the number of interpolated blobs so if you are painting over truly vast areas, such as the sky, there may be situations where you see individual blobs, especially if the brush size is relatively small relative to the area covered.

If you paint over vast areas you will be saving a lot of data. It wouldn't be as much data as would be used by a bitmap mind you, for two reasons. One is that the blobs can be stored much more efficiently than bitmap data and the other is that the data is compressed when it's saved. So relatively speaking you would be saving more data but it shouldn't be close to a high resolution image map covering a large area.

One point is that the stroke is linearly interpolated. For example if you paint quite fast that will mean the main blobs in the stroke are further apart and could look as if they're connected by straight segments, because they are. Painting more slowly lets you paint smoother curves.

2) I'm really not sure about the relative efficiency of painted shaders vs image maps. My feeling is that at this stage image maps could be more efficient for large areas. There is also a problem with the painted shader in that it unfortunately doesn't handle large amounts of data very well. The main use for the painted shader at the moment is really for situations where it's more convenient to paint directly without creating an image map and you're not painting something really complex over a big area.

Painted shaders also record all their strokes, even erase strokes. Basically each successive stroke is layered on top of previous ones. Erase strokes prevent strokes underneath being visible. If you have been working a lot with a painted shader and making a lot of changes and erasing it would probably be more efficient to clear the shader and paint your final shape again. It's also more efficient to use the "Clear" button in the painted shader to erase that it would be to use an erase stroke to rub out most or all of the existing strokes.

I think if you are planning on using a lot of masks, especially if they're not simple ones, you'd be better using image maps and doing them in Photoshop. If your mask is relatively simple and a shape that would require a lot of blank space in an image map (a big U for example) then a painted shader could work well. A painted shader might also be good in the foreground where its better resolution (basically infinite) might be an advantage.

3) As a general principle the more nodes you have the more work TG2 will need to do to evaluate them. If you are able to "compress" a network down into fewer and or simpler shaders I would expect it to be more efficient. Beyond that I can't really say.

Regards,

Jo


Dune

Well, following the documentation thread with interest (to say the least), this last answer is great as it is for the painted shader documentation  ;)

jo

Hi Ulco,

The Painted shader does actually have documentation:

http://www.planetside.co.uk/wiki/index.php/Painted_Shader

It doesn't have the sort of information above yet, just basics, as I'm trying to think of the best way to integrate that information.

Regards,

Jo

ajcgi

Regarding painted shaders over large terrain...
Large painted maps over many km become slow to load in and I really don't advise using them to displace terrain that is already displaced. It may depend on your scene though, if it's an animation for example.

I'm actually using image maps in my current scene as a source of texturing for certain areas. Multiple repeats over a huge expanse of scenery, blended through a distribution shader. Loads in quickly, renders speedily enough.

Dune

I know most things have their documentation, Jo, but I thought it was so well explained that it would be a nice annex. I hardly ever look at the docs, but to have all info at one place, a series of annexes such like what you wrote could be helpful for starters in TG (or even advanced users). I have gathered a lot of interesting quotes/lines from all posts I read and copied them to simple text files with relevant titles. Although I must admit I hardly ever have to look up something, they form some kind of database of indepth knowledge.