baking/freezing a displacement to polys

   14612   19   3
User Avatar
Member
119 posts
Joined: July 2005
Offline
hi all.. is there any way to take a model with a displacement map appled and bake the displacement into the model so it can be worked on post displacement ?

basically applying the displacement map to the points so that it can be seen in the viewport.

thanks..
User Avatar
Member
31 posts
Joined: July 2005
Offline
yep, just take the code from your displacement shader and put it into
a vex SOP, refer to the same texture map and you're set.

PS - your code may need a bit of tweaking, in the shading context the
global variables are in “world” space(ie the camera is the origin),
SOPs is in object space.

reply if you run into trouble.
Luca
User Avatar
Member
119 posts
Joined: July 2005
Offline
hey! cheers… but i`m using generic displace so i cant get at the code.. should i build a displace in vexbuilder?
User Avatar
Member
12457 posts
Joined: July 2005
Online
You don't have the original source-code? If you do, change it from a displace mydisp() to a sop mydisp() and you'll compile a SOP with the same capabilities as the displacement shader.

Otherwise VOPs is an excellent alternative
Jason Iversen, Technology Supervisor & FX Pipeline/R+D Lead @ Weta FX
also, http://www.odforce.net [www.odforce.net]
User Avatar
Member
201 posts
Joined: July 2005
Offline
Maybe I'm missing something but what about using the bakeVEX SOP? Are there advantages/disadvantages between this & the VEX SOP method? :?
Cheers,
Rob
Digital Supervisor | Stargate Studios Toronto
User Avatar
Member
12457 posts
Joined: July 2005
Online
Ha! You are completely 100% correct - this is *exactly* what the BakeVex SOP is for, except that, unlike the viewport “VEX Shaded” mode, it only supports parameteric surfaces, and not polys.

Why? We rightly don't know, so we've kinda scrubbed BakeVex from being a truly useful operation since 95% of the time we're working with polys. :twisted:
Jason Iversen, Technology Supervisor & FX Pipeline/R+D Lead @ Weta FX
also, http://www.odforce.net [www.odforce.net]
User Avatar
Member
201 posts
Joined: July 2005
Offline
jason_iversen
Ha! You are completely 100% correct - this is *exactly* what the BakeVex SOP is for, except that, unlike the viewport “VEX Shaded” mode, it only supports parameteric surfaces, and not polys.

Why? We rightly don't know, so we've kinda scrubbed BakeVex from being a truly useful operation since 95% of the time we're working with polys. :twisted:

Really? I could swear I just tried it on a polygonal sphere. Lemme go back and recheck.
Cheers,
Rob
Digital Supervisor | Stargate Studios Toronto
User Avatar
Member
201 posts
Joined: July 2005
Offline
rdms
Really? I could swear I just tried it on a polygonal sphere. Lemme go back and recheck.

Oops … I was wrong … I was using a mesh. But then you could convert to polys, right?
Cheers,
Rob
Digital Supervisor | Stargate Studios Toronto
User Avatar
Member
119 posts
Joined: July 2005
Offline
jason_iversen
You don't have the original source-code? If you do, change it from a displace mydisp() to a sop mydisp() and you'll compile a SOP with the same capabilities as the displacement shader.

Otherwise VOPs is an excellent alternative

ah.. i thought the code from the type properties, which i cant get at in generic displace.. just the string from teh generic displace?

all i see is

“dmap map $HIP/textures/final_1024/octopus_tent_disp.tif amp 0.05 forpoly 1”

i dont know how to build a displacement in vops.. *looks*
User Avatar
Member
2199 posts
Joined: July 2005
Offline
Unfortunately there is no texture map function in Vop sop land.
Your best bet is to bring the image into cops and then use the pic or tex expressions to grab the luminance and then multiple the normal by this value and add it to the original position.
You can do this in vops or just a point sop.

Don't know why you can't access texture maps in vex sops.
The trick is finding just the right hammer for every screw
User Avatar
Member
941 posts
Joined: July 2005
Offline
Simon
Unfortunately there is no texture map function in Vop sop land.

In the SOP context, you can access images (from disk or from inside the session via the ‘op:’ syntax) using the colormap() or rawcolormap() functions. One of the colormap() variants is available as the Colormap VOP.

In general, any operation whose functionality depends on derivative information (like the shader-side texture() shadeop or any anti-aliasing op) will not make sense in the SOP context, since this info is not available there. In a lot of cases the self-antialiasing functions (like all the various noises) will simply default to some very small area measure and carry on (essentially point-sampling). But even that may not make sense in some contexts so the function won't exist there.

This is why you won't always be able to get away with a simple copy/paste. But you can still duplicate functionality – just keep in mind that there's no “area sampling” in SOP land.

Cheers!
Mario Marengo
Senior Developer at Folks VFX [folksvfx.com] in Toronto, Canada.
User Avatar
Member
175 posts
Joined: July 2005
Offline
Hello spaceboy,

I created an example of what I learned yesterday (watching VOPS video tutorials which are great)a little scene, that I hope will work
Basically it's a grid displaced (with a SOP) and textured with mandril.pic
Write back if it works.

cheers

Peter

—edit

Ok, it works now, rightclick saveas and delete the.htm suffix
—edit



http://www.piotrtwardo.neostrada.pl/pelio_texturedispSOP.hipnc
Edited by - May 19, 2005 12:46:14
User Avatar
Member
2199 posts
Joined: July 2005
Offline
Mario Marengo
In the SOP context, you can access images (from disk or from inside the session via the ‘op:’ syntax) using the colormap() or rawcolormap() functions. One of the colormap() variants is available as the Colormap VOP.


Colormap Vop that's the one - thought it was weird that there wasn't any way to access textures in vops.

SESI If you click on colormap in the vex quick reference html file the link is broken by the way.
The trick is finding just the right hammer for every screw
User Avatar
Member
31 posts
Joined: July 2005
Offline
because you can't get at the code from “generic displace” have a lookat the
code in “Vex Displace Map” you should be able to access this via the type properties.

and as Mario says use colormap() instead of texture

SESI If you click on colormap in the vex quick reference html file the link is broken by the way.

thanks for pointing that out Simon, I just had a look in 8.0.233 and it looks like it's fixed.

all the best
Luca
User Avatar
Member
119 posts
Joined: July 2005
Offline
eee.. so much info.. i`m a bit lost!!

so do i have to build some kind of displace shader to bring my displacement to the poly level at sops? or just read something from my generic displace or my texture into a point sop?
User Avatar
Member
2199 posts
Joined: July 2005
Offline
Weelllll, the “correct” way if there is such a thing would be to write a sop in vops using the rawcolormap() vop. Basically copying the code from the current vex displace shader. But you can hack round it using a point sop and an expression or two if you are more familiar with them and don't like the idea of getting your hands dirty in vex/vops. The vop way will cook quicker but for a small mesh you won't noticed the difference.
The trick is finding just the right hammer for every screw
User Avatar
Member
710 posts
Joined: July 2005
Online
One thing I noticed is that you can't use vertex UVs (or any vertex attributes?) in a VEX SOP, which is kind of a problem. You have to use point UVs, and that's no good for the boundries. :?
User Avatar
Member
2199 posts
Joined: July 2005
Offline
just unique the points at the boundaries
The trick is finding just the right hammer for every screw
User Avatar
Member
132 posts
Joined: July 2005
Offline
One way to do this is by setting up a simple SOP network that reads an image and apply's point color information to points, and then uses that point color information to displace points in a pointSOP.

In COPs, append a fileCOP and source your displacement image there. In my case I called this node “displace_file.”

In SOPs, take the geometry you're wanting to displace and append a pointSOP (after your UV's have been projected). In the point SOP, you're going to adjust your position by overriding the default $TX,$TY,$TZ with:

$TX+(pic(“/img/img1/displace_file”,$MAPU,$MAPV,D_CLUM)*$NX)*1
$TY+(pic(“/img/img1/displace_file”,$MAPU,$MAPV,D_CLUM)*$NY)*1
$TZ+(pic(“/img/img1/displace_file”,$MAPU,$MAPV,D_CLUM)*$NZ)*1

“D_CLUM” will take the luminance value of your image and use that to apply the displacement.

If you want more help on this function, open a textport and type:

exhelp pic

Notice I multiply the pic() function by $NX,$NY,$NZ. This should point the displacement in the direction of the normals. The multiplier at the end sets the amount of displacement.

This method will not necessarely duplicate the exact kind of displacement you're getting through the shader but should help with as an aid in visualization.
User Avatar
Member
313 posts
Joined: July 2005
Offline
I am interested to know how to use the bakeVex to bake the displacement map. Does that mean it can be viewed in the viewer in realtime? Did anyone make that successfully with the bakeVex sop. Can anyone post an example here if it is handly?

thank you for your attention!
  • Quick Links