Mudbox displacement maps in T2

Started by TheBadger, May 17, 2013, 10:25:30 AM

Previous topic - Next topic

j meyer

Quote from: Tangled-Universe on May 25, 2013, 04:14:46 AM
Quote from: Dune on May 25, 2013, 02:59:33 AM
I don't think the high poly'ness has anything to do with the shadows being accurate. Without RTO the shadows of a displaced (high or low poly) object will turn out fine, but as soon as you RT, the cast shadow will follow the undisplaced/bumped contours, whether it's high or low poly. At least that's what I think.

Yes that's it if you'd ask me.

RTO just can't "see"  (at rendertime) displacement to put it in a very simplistic way.

Judging from my experience it's a bit different.I found that the shadows you get with
RTO on are more like shadows you would get with real displacement.
I think I still have the images of a test I did some time ago,so if anyone is interested
I should be able to post them to illustrate.

Dune

I would be interested.

And to make sure I understand well; is it correct that you make a model and use its vector displacement information to displace the TG planet? 

j meyer

Ok,I'll see that I find them and post.
And yes,that's correct.

Dune

Thanks. And you offered a step-by-step... would you?

j meyer

Sure.
Will take some time,though.Should be ready tomorrow.

Tangled-Universe

Quote from: j meyer on May 25, 2013, 10:42:18 AM
Quote from: Tangled-Universe on May 25, 2013, 04:14:46 AM
Quote from: Dune on May 25, 2013, 02:59:33 AM
I don't think the high poly'ness has anything to do with the shadows being accurate. Without RTO the shadows of a displaced (high or low poly) object will turn out fine, but as soon as you RT, the cast shadow will follow the undisplaced/bumped contours, whether it's high or low poly. At least that's what I think.

Yes that's it if you'd ask me.

RTO just can't "see"  (at rendertime) displacement to put it in a very simplistic way.

Judging from my experience it's a bit different.I found that the shadows you get with
RTO on are more like shadows you would get with real displacement.
I think I still have the images of a test I did some time ago,so if anyone is interested
I should be able to post them to illustrate.

I'm not sure if I understand what you mean?

If you displace an imported object and use RTO then the displacement will be converted into bump.
Thus geometry itself will not change, but lighting/shadow is being mimiced as if the surface was actually displaced.
That's how it works in TG.

Like Ulco I'm of course very interested to see this workflow.
This would offer new creative possibilities.
I don't have ZBrush, but I do have an educational license for mudbox.

j meyer

#66
Ulco wrote: ....but as soon as you RT, the cast shadow will follow the undisplaced/bumped contours, whether it's high or low poly.
This is true for other apps.Bump mapping usually does not react with light,so there should be the same shadows as with no bump map at all.
Disp mapping reacts with light and alters the outline of the model,that's the theory as I know it.

T_U says in his second post regarding this issue: ...If you displace an imported object and use RTO then the displacement will be converted into bump.
Thus geometry itself will not change, but lighting/shadow is being mimiced as if the surface was actually displaced.
That's how it works in TG.
That's what I was refering to and is definitely not what Ulco said and T_U agreed with in
his first post I quoted before.

Here are my images
[attachimg=1]

I'll attach the full images at the bottom and suggest you download them and view with an
image viewer so you can switch,which helps seeing the difference.



TheBadger

#67
So, then, the consensus is dead?

What would the results be for displacement vs bump? Same model, same scene, same frame?
It has been eaten.

Dune

#68
Thanks Jochem. But I think there's a misunderstanding. The shadows on the smooth curves of the object are fine, but if you look carefully at the shadows being thrown on ground, they follow the original contours of the 'undisplaced' object. Actually, whether you have RTO on or off. I also think that if you would be able to discern the shadows trhown on the object itself from the shadows in the bumps on the object, you'd see that the 'thrown shadows' do not follow the bumps., if you get my point. But on a smoothly rounded object that's hard to see and won't distract from it's reality anyway.
I've quickly tested a quite straight object and its shadows, which will clarify what I mean. You'll see that teh shadow on flat ground is straight, and doesn't follow the displacement or bump.

If we have RTO with real displacement and proper shadows all sorrows will be over.

TheBadger

#69
^^Yep. Those are the results I got my in tests too.

But it can be, sort of, dealt with by using diffused light and ruff terrains. Also many many shadows such as those that are created when light passes through a forest will effectively obscure the problem.
Soft shadows will also help.

And as was said, haze and clouds do wonders.

J, you are getting great results, man! I would keep going. Its very useful and also fun. paq too!
It has been eaten.

j meyer

Ulco - I forgot to mention the dropshadows of the object these stay like you said.
         My point is that compared to other apps the shadows on the object itself are
         different in TG.Try to render in Lightwave,XSI or even Bryce and you'll see
         that the shadows on the object are the same with bump as without bump.
         While in TG they are clearly not.I'm not complaining about that,just saying.
         And I wholeheartedly agree with:"If we have RTO with real displacement and
         proper shadows all sorrows will be over."
         
         And please,it's Jochen with an n ;)

But now for the step by step.
         

j meyer

#71
And here we go:

              ZBrush VectorDisplacement Maps for plan-Y projection in TG2

First you will need a onesided square plane to import into ZB,because ZBs plane object is procedural
and as paq already mentioned it can cause problems.So you're better off to use an imported
one. It's orientation should be plan-y,that seems to be important.
[attachimg=1]
The above image illustrates what plan-y means,just incase ;)
In my example it's a 32x32 plane,but you can use a higher or lower divided one of course.
Furthermore it should be UV mapped.
So now that we have our Uv mapped square plane with plan-y orientation,let's export it as
obj file.

Start up ZBrush and import your plane.Draw it on the canvas and switch to edit mode.
Before doing anything else store a morph tartget.  Tool -> MorphTarget -> store
That stores the objects current state and is needed after sculpting to get back to an
unaltered basemesh when extracting the map.
Go to Tool -> Geometry and add a few subdivision levels and start sculpting.
When you are done save your Ztool (that's what it's called in ZB btw).

Now go to Preferences -> Importexport -> Vector Displacement Map and set the
'Flip And Switch' and 'Tangent Flip And Switch' values to 3. (which is the correct value
for TG as shown and explained earlier in this thread)
[attachimg=2]
If you are sure that you will only export maps for TG you could also store these values
with UI configuration.
In case you want to change the size of the map that will be generated,you can do that
Under Tool -> UV Map ,just press one of the presets or push the slider or type it in.
Now go to Tool -> Geometry and swich from your highest subdivision level to your lowest
subdiv level.You will find that you basemesh has been changed by the sculpting process
and that's where we need our previously stored morph target.
Go to Tool -> Morph Target and press Switch  now we have our basemesh back in the state
we started from.
[attachimg=3]
Then go to Tool -> VectorDisplacementMap  leave anything there as is and press
CreateAndExportVDMap a dialogue window will open letting you choose name and location
and format to save.By default it is exr and that's what we want.
A ZB message will open asking,if you want to export your basemesh too,press no and
you're done.
[attachimg=5]

Start TG and create a Vector displacement shader and then an Image map shader and
load your exr into it.On the Image map shader go to the colour tab and activate
'Data is linear'!
Go back to the Projection,Location tab and set the desired size ,for my example it's set
to 12.Projection type should be set to PLan Y.
Connect the Image map shader to the right port of the Vector displ shader.
In the V disp shader window set the Final multiplier to an appropriate value, 5 for this
example.
Connect the Vector displacement shader to the Compute terrain.
Find it in the Preview window,set up your camera and render.
[attachimg=4]
There are small artefacts that mark the edges of the sculpted plane,but that should be
easy to fix with a masked distribution shader or so.
That's why it is better to leave some space between the sculpted area and the planes borders
when you sculpt.
Most likely you'll have to adjust the size and Final multiplier settings to fit your needs.

Hope it'll be of some use to you.

Feel free to ask questions.
And for mudbox,please refer to what paq posted on page 4 of this thread.

Thanks for your attention and have a good time y'all.


Dune

Thanks very much, Jochen. I was experimenting with Lightwave, but I can't seem to export such a VDisp map from UV mapping settings. It probably has to be ZBrush then.

mhaze

Thank you so much, that is really helpful off to fire up ZBrush then!

dandelO

#74
Hi, J. Thanks for taking the time to educate us on this! :)

I have a question. Must you use a planar object with plan-Y mapping to be able to translate the vector output to TG? You likely guess my thinking, you've posted on my last image thread, so, could I import a model to ZB, create a VD map from the normals(displacement wouldn't even be required, just the surface vectors) and then, convert those vectors to a 3D colour function that could be used on a TG volume? I've been to the end of my rope trying to find ways to do this, or a choice of nearly any other method to get there, directly in Terragen and I'm almost ready to throw the lot out of my window! :D
I really think this should work but I can't try it myself, as I don't have access to all my gear right now, no vector exporters on my temporary machine.

Cheers again, man. And to Paq and everyone else contributing here, great! :)