Jump to content

Baking grass to plane


Saya

Recommended Posts

Hi, I'm looking for a method to bake foliage like gras patches onto a plane. I know how to approach this within Maya but I haven't been able to do so in Houdini.

Ive also looked at the game dev baking node but without succes for baking geometry onto a plane. What are my others options, could someone please elaborate or point me into a direction. 

Thanks in advance. 

Link to comment
Share on other sites

What do you mean by baking ? You want to output a displacement map ?

If you want to bake a disp map, you need a Bake Texture ROP (OUT context), indicate your high rez object and the low rez object - also called UV render object -  (who gets propoer UV), and then check the Displacement or Vector Displacement output in the Images / Main part of the node. You need to tell which rez you wants your map, and you can select various "look up" options between high rez and low rez object (called Unwrap method). I guess yours would be by Trace closest surface but you can use a UV matching option if you work on objects that were created from a subdivided low rez object and that the UV didn't changed (like to get disp map from sculpting details on a subdivided object in ZBrush).

Then you hit render button.

Hope this helps you a bit, but for grass, I would go with point instancing if that's for rendering. If that's for a realtime render engine and you want to bake a map, of course that's different :-)

Edited by StepbyStepVFX
  • Like 1
Link to comment
Share on other sites

Hi Marco,

you can build your own planar baking tool inside SOPs and COPs:

  1. Scale object to unit size with 1 / max(max($SIZEX, $SIZEY), $SIZEZ) in a transform node.
  2. Shoot rays at the mesh from COPs with the intersect() function.
  3. Grab the UV coordinates via primuv().
  4. Transfer any kind of texture map values by using colormap().
  5. This also works for geometry attributes such as normals, depth or bounding box info.

image.png.ecd37662e3c553c59443efc2bed3ec9f.pngimage.png.396b4cd8df1604de8a96258c54e1f231.pngimage.png.bfeb272221e5e5e4bef2fa442db03ab1.png
image.png.4f4da996920f618a57b078b7e35896d9.pngimage.png.77a35ecbe81c48b2ae4f3325932111eb.pngimage.png.5a7d6d753d23f1fe208604c7bdafcab0.png

Here is the minimalist code (to be used in a COP snippet inside a VOPCOP2GEN node):

string geo = 'op:/obj/geo1/OUT';
string tex = '/Users/konstantin/maske_rot_Map_Albedo_4K.jpg';

vector pos_img = set(X, Y, 0.0);
vector dir_ray = set(0, 0, 1);
vector pos_world;
vector uvw_prim;
int prim_mesh = intersect(geo, pos_img, dir_ray, pos_world, uvw_prim);

vector uvw_mesh = primuv(geo, 'uv', prim_mesh, uvw_prim);
vector map = colormap(tex, uvw_mesh);

vector color = map;
R = color.r;
G = color.g;
B = color.b;
A = prim_mesh != -1;

baker.hipnc

Edited by konstantin magnus
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...