PDA

View Full Version : displacement scale and memory issues?



greg
July 6th, 2008, 22:33
so i've been digging into mental ray's displacement shading and it seems to behave somewhat strangely depending on the context of the object. (fyi i'm in 3dsmax 2008)

for example, given two objects the same scale and the same number of faces per area, mental ray will create more detail in the mesh with the smaller total bounding box. to demonstrate this, i created a large plane with enough segments to have a polygon every 7.5 feet. detaching one of these polygons and applying the same shader and displacement settings to both objects will give you different results: the single polygon object will have roughly 2-3 divisions of extra detail where the original plane object is rough and heavily faceted. increasing the "max level" will get you closer to the detail of the single polygon, but it will not match it.

[attachment=0:1nwtezi7]mentalray_displacment_objectsize.jpg[/attachment:1nwtezi7]

you'll also notice that even though the large plane's faces all share the same normal and are part of the same smoothing group there are splits in the displaced mesh. (these do not go away no matter what smoothing options are set or changed)

another odd behavior is that if you scale an object's transforms down by something like an order of magnitude, you can displace the object with greater speed and detail than the same object at it's real size. what's up with that? i imagine this is related to the "area of influence" that mental ray is considering on the object--similar to setting the "maximum displacement" amount so that calculations are not spent on areas of the "potential mesh" that will never be displaced.. however this just seems strange.

something that also took me off guard is that memory usage for render-time displacement doesn't seem to be any better than subdividing a mesh and displacing with a modifier prior to rendertime, which leaves me wondering what the point is?
coming from vray's use of displacement, the context specific requirements and adjustments necessary to get good looking displacement in mental ray seem very cumbersome. what am i missing?

thanks,
greg

ctrl_studio
July 9th, 2008, 13:15
try to consider your problems in a 'view-dependant' concept... :idea:

if you have a very distance or just little object that is covering exactly one pixel of your view.. would you go to displace it in 10mils polys ?
If you tell mr that for every subpixel it has to subdive the mesh two times.. you'll understand that bigger objects (which covers simply more pixels) will have the chance to require more polys to satisfy the disp rules. if you set that 1mil poly is the max limit for displacment subdivision.. a little object will obey that and will result in more detail than a bigger object. you can avoid this behaviour by not using a view-dependand displacement.

about the memory.. is that, if you have enough memory and you did not setup a max limit that will stay in your physical memory range.. mr is going to use all the memory available. just try to setup a very little max memory and you'll see that mr will go to flush your polys(if you're in fine view-dependand mode).

max

greg
July 9th, 2008, 21:53
thanks for your reply, max.

is the "maximum subdivs" setting in the render dialog the "maximum poly limit" you're referring to? your explanation makes sense, but i think what was confusing me is that i interpreted the "max. subdivs" and "max. level" displacement settings not as "poly limits" but as what they're labeled: subdivision limits. if they act as subdivision limits, then total polygon count will be based on a poly by poly basis.. if a polygon is the same "size" as another polygon in the scene and they take up the same amount of pixels, then they will be the same amount of polygons after displacement no matter what. if they are "poly limits" as you explain, then objects that have more polygons to start with will always be inherently handicapped, and getting the same look from the displacement on objects with different starting polycounts becomes difficult. this describes what is happening, but it seems to be a flawed way to handle it... ?

on a side note, does the "maximum subdivs." render setting still apply to objects that are using object-specific settings? (i.e. is it a "global" cap, no matter what?) and does the "Max. Level" setting in the object-specific mental ray dialog correspond in any way to the "maximum subdivs" render setting?

lastly, do you know what differences there are between mental ray's render-time displacment and just adding a bunch of turbosmooth iterations with a displace modifier? it seems the geometry is being created in memory in the same way (i could be wrong, but there doesn't seem to be any added efficiency to the memory usage/performance)

thanks,
greg

ctrl_studio
July 9th, 2008, 22:55
ok, from the begining.. I don't remember what is exposed in 3dsmax but generally you have three parameters to deal with fine approximations.

- view length (edge pixel diagonal.. ie. view dependant)
- edge length (object space edge length)
- parametric (subd)

the one you want if you are trying to have 'uniforme' meshes is the latter.
the one you want to have higly optimized meshes is the former.

if you use the latter, you'll have coherent meshes at the risk of high memory consumption.
if you use the former, you'll have memory flushing.. BUT.. you have to know how to deal with mr memory. if you leave untouched the max memory.. mr will displace and subdivide until it will eat all your memory. if you do set a very low memory cahe.. mr will fill that until it's full, then empty that and so on.. that means you can displace 20mils polys with 500mb of ram.

Here it is very important also to set a max_displace at its best.. ie. the minimum displacement you need to have achived your details.. start with a very low max_displace, enable msg verbosity and look at what value mr is reporting as bad.. go up from there until you have no more warnings.

global approxs overrides all local approximations. they are there to test the scene on-the-fly and reduce all the disp with one click once you don't need displacement in your scene as you're testing something else.

max

greg
July 10th, 2008, 00:15
thank you for your detailed explanation (i appreciate you taking the time). it makes perfect sense, and it confirms my initial suspicions that the controls for the displacement are misleading and that the method for mental ray's displacement is not the greatest.

using a view-INdependent edge length, (i.e. a world distance), although consistent, is not very useful for render-time displacement if subdivisions occur *everywhere* (you will be running out of memory in most real-world scenarios).

when using view-dependent (pixel length) displacement, unless the displacement is very coarse/rough, the pixel length is almost always outweighed by the "Polygon limit" as you explained. however, the "polygon limit" is labeled as "subdivision"! although these are similar things, they are very different, and because we are actually setting a polygon limit (not a subdivision limit) it creates results like those in my first post. if this was a true subdivision limit, all polygons of equal world and screen-size would be broken up equally. (this is not the case, as in my first post)

it may seem like i'm somewhat dense here, but trust me, if you've ever used vray or renderman's displacement you'd have the same trouble. :) with those implementations, you get consistent, true "per pixel" displacement without worrying about running out of memory.

okay.. and FINALLY :) i wanted to clarify my question about global versus local object settings.. here are the settings dialogs in 3dsmax; on the left are local object settings, on the right are the global render settings:

[attachment=0:969keq9c]displacement_settings.jpg[/attachment:969keq9c]

my understanding is that local object properties will override globals if "use global settings" is unchecked. i was also asking whether the "max levels" is correlated to "max. subdivs"--are these the same thing, and if so, which setting has precedent?

again, thank you for taking time to discuss this.
greg

ctrl_studio
July 10th, 2008, 18:50
ehy Greg, I see in 3dsMax it's the other way around regards globlal vs local approximations. honestly I don't see too much use for that.. if you have 100objs with a very fine displacement and you need to test some other features of your scene, you'll have to go to engage global settings on all of them.. mr natively does the opposite.. if you specify a global approx, all local approx will be overridden. to me it makes more sense the latter. it's true that all local settings rely by default to the global settings, so that you don't have to manually disable them.. but with that the max_displace, that's a very sensible parameter, remains on a global scenario and it's hard for the user to understand that it's one of the most important param to setup to have optimal displacements and that for that, it needs to be tweaked on object basis.

max

greg
July 10th, 2008, 20:22
3dsmax strikes again! :)

thanks again for your time,
greg