View Full Version : MR displacement approximation - what is it for?
12-16-2004, 01:27 PM
I try rendering displacement (generated in Zbrush on low poly model) with MR. I have a Subivision approximation node and Displacement approximation node connected to the geometry shape. Deleting the displacement approx. node has no effect on rendering at all. What is it for then? :hmm: Changing settings in subdivision approx. node does have effect, but to get satisfactory result I have to set rather high settings when Maya just makes error and dies (AMD 2,3 1GB ram). I'm very new to MR and I'm definitely doing something wrong. I'd be grateful for any help. Thank you in advance.
12-16-2004, 11:12 PM
Well I think you're not actually doing anything wrong. The problem is that displacement approximation doesn't quite work properly in Maya when combined with subdividoion approximation!
Normally displacement approximation works fine and is very usefull for tuning how your model is displaced. Perhaps try leaving out the subdivision approximation?
I rendered the demonstration ZBrush head model in Maya using displacement and it worked fantastically without needing subdivision approximation.
12-17-2004, 02:09 PM
Thank you for the reply, Jozvex.
I try to render the sword test, downloaded from zbrushcentral forum. It seems disp. approx. works only on polygons, doesn't it? The best result I managed to get is using smooth with 2 iterations (or converting to subdiv. surf.) and subdiv. approx. with maximum settings that maya allowed me (otherwise crashing). Displacement approximation node didn't do anything in this case.
Polygons with displacement approximation seems to give some decent results (I didn't do much tweaking yet) but gives ugly artifacts on sharp edges (sword's blade) and I failed to get rid of them. Using displacement on subdiv. surface (even without subdiv. approx.) does nothing.
Looks like rendering displacement in MR is quite a mess. :sad:
BTW your lessons are very good - I'll spare some time for them. :) Thanks.
12-17-2004, 03:34 PM
Same problem to me!
Changing settings in subdivision approx. node does have effect Solution:
Render Globals/mentalray/overrides/Tesselation/Displace approx > select the one you need.
Be carefull when you are testing...
Try first the LDA approx method (safer).
Then the Spatial+fine ( High details )
for millions of triangles depending on the view <=> Crawling can appear while the camera is moving.
12-19-2004, 07:23 PM
to get a good result i have to smooth it twise or more, or useing the subdivision approx it witch would be the best way but it doesn't work with displacment approx (strange, there must be a way).
how did you get a good result, could you share you seting maby that would be great :)
12-19-2004, 10:08 PM
Ok! I went away and found the actual answers I should have posted in the first place. I new I'd read about this before.
The reason why displacement approximation doesn't work with subdivision approximation is because it's not supposed to! In Mental Ray 3.3 they combined displacement right into subdivision approximation. So you're only supposed to use subdivision displacement in this case (where you need the model smoothed and also displaced). Now you're only meant to use displacement approximation on polys and NURBS.
Apparantly there's also a mistake/bug in the way Maya translates subdivision approximation into the mi format for rendering:
maya exports these lines:
approximate subdivision surface parametric 2. "Triangles"
approximate displace fine view length 0.25 0 4 "Triangles"
but it should be done in one line like this:
approximate subdivision surface view length 0.25 0 4 "Triangles"
That's not official text it's just someone's findings.
So even though in Mental Ray 3.3 it's supposed to be all done at once, Maya still exports it the old way it seems? So perhaps in effect we're actually only ending up with a really dense subD model and not one that's been optimised for displacement? I think that must be it.
Anyway, I think the best way we can do it currently is to apply smooth modifiers and then use the more efficient displacement approximation rather than using subD approximation for displacement.
I think... Haha this would be a lot easier if I owned a copy of Mental Ray standalone and could test things out the 'real' way they're supposed to work. Anyone feel like buying me a copy? :p
Unfortunately I did those ZBrush test scenes quite a while ago and don't have the results anymore. I'll do them again today and post the whole lot, my scenes and maps etc.
12-20-2004, 12:01 AM
The head scene!
I think it worked ok didn't it? It's hard to tell what's right when you have to convert the way ZBrush does displacement maps into the Maya way.
So what I did was apply a Smooth operation (only 1 iteration) to the head first to give some more base polies to work with (which actually may not have been nessessary I'm now thinking.. The reason I did it was because when I displaced the original mesh, it was seperated into individual faces. I thought that may have been due to a lack of polies but now I think it was because the normals were all 'hard'?), then applied Fine Displacement Approximation.
The Alpha Gain is set to 2 and the Alpha Offset is set to -1.25 which just gives more contrast to the map creating better displacement.
And of course, SSS is the flavour of the new millenium and so it was a given. :thumbsup:
Here's a zip file containing 3 files:
1. The displacement map that I've vertically flipped and converted to RGB 8 bits.
2. The scene file containing the displaced head with just a lambert shader.
3. The scene file containing the displaced head with the Misss_fast_simple_maya shader applied for those who have it installed.
I actually changed quite a few settings though in the SSS file so perhaps just use that scene anyway and replace the shader if you don't have the SSS one.
12-20-2004, 02:04 PM
greate joz, it's aktualy pretty fast to :)
we should bye a standalone lincense to jozvex.
12-20-2004, 02:18 PM
The head scene!
So what I did was apply a Smooth operation (only 1 iteration) to the head first to give some more base polies to work with (which actually may not have been nessessary I'm now thinking.. The reason I did it was because when I displaced the original mesh, it was seperated into individual faces. I thought that may have been due to a lack of polies but now I think it was because the normals were all 'hard'?)
The same with me. When all edges are "hard" the mesh's faces are separated. Making them "soft" or averaging normals fixes the situation.
But there is another problem. I get a kind of "footprints" of the mesh on the rendered model.
I also noticed this when rendering your scene file, Jozvex.
To solve this, I tried increasing smooth iterations but the render time jumps up considerably. To render test head with smooth 3 iterations and fine high quality settings I spent about an hour on AMD 2,3 Mhz 1 Gb ram. That is useless for the production.
In a sword test I get bad blade edges when using displacement approximation. Subdivision approximation gives better results on the edges but detailes are lack of some "sharpness" (at lest at the subdivision settings Maya allowed me to set up).
Overall the disp. approx. seems to be a more flexible tool than subdiv. approx. but still there are difficulties that I can't solve:
1. polygons visible on rendered image (mesh "prints")
2. displacement on sharp edges of the form
I would be extremely grateful if someone share the solution.
12-20-2004, 02:51 PM
If your machine don't crash you can set lower values to your LDA settings and get as much details as the fine approx.
Remember you can measure the length on the sword.
The length attribut of the LDA approx means "until what length can I subdivide edges?"
testing fine approx (ftp://ftp.nwavedigital.com/OUT/CGTALK/travel_hlu.mov)
testing LDA (ftp://ftp.nwavedigital.com/OUT/CGTALK/travel_hlu2.mov)
12-20-2004, 08:18 PM
In a sword test I get bad blade edges when using displacement approximation.
On the ZBrush message board Pixolator says that bad edges on the sword are acceptable in this case because it's a very extreme example.
It still looks pretty cool though!
12-21-2004, 11:04 PM
> alphaGain of the map file node controls the overall displacement
> alpha offset = -.5*alpha gain. this is because 0.5 is zero displacement for zbrush and
0.0 is zero displacement for mental ray
> photoshop color management must be turned off to prevent middle gray from shifting
> if you want subdivison AND displacement use only a subd approximation (no displacement) with length | distance | angle method. turn view dependent on, and use the length and min and max subd to control the quality (leave distance and angle at 0). if you have triangles in your mesh, be sure to set "Quads to Triangles".
the reason for only using a subd approx is that as of mental ray 3.3 displace approximation does not work together properly with subdivision. now, they are both done at the same time with a sinlge approximation statement. the mental ray docs says this about using subdivision surface approximation:
"The displace approximation is ignored, and the regular approximation is used. Subdivision surfaces are refined during displacement in a single integrated pass, so the separation between base surface and displaced surface does not apply."
> add the dynamic attrbute miMaxDisplace (double) to the shape node of every displaced object. set this value as close as possible to the maximum that your vertices are displacing in world space without going below. this can greatly speed up your renders, and it will allow motion blur to occur on displaced objects that are bound to deformers. watch the output window to make sure that you are not causing clipping. you can download some scripts i made called mrDynamicAttrs to aid in the use of dynamic attributes. I just uploaded it to highend3d so it should be there in a day or so.
obj must be exported from zbrush with the merge uv setting turned on - in maya, turn on view border edges to make sure uv borders occur where expected.
01-02-2005, 07:02 PM
Is there a way to change the way maya translate the sceen file, cause i realy need to use subd and displacment.
the model i'm curently working on is 37 000 polys, but i still get much better displacment result if i smooth it on more time (140 000 polys).
but if i smooth it one more time it would be somthing like 140k polys and that would take for ever to run simulation on, so that's out of the question.
01-03-2005, 05:09 PM
I'm assuming your having difficulties getting your subd mesh to render in mental ray? If that's the case, your mesh will have to be all quads prior to conversion. mental ray for Maya will not render mixed mesh geometry (quads/tris/n-gons), it has to be all quads, all tris, or all n-gons.
01-20-2006, 04:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.